Get your free beta license ↗
API operation · auth group
POST

/auth/login

First published 3 Oct 20260.1.0Unchanged since publication

Exchange a name and password for a session token or a second-factor challenge

Who may call it
Anyone (no token needed)
Token
none
Answers200 OK

With no second factor enrolled, the response contains token, expires_at, and user. Session tokens carry all scopes except export. If security.require_second_factor_admins requires the administrator to enroll, the response also sets enrol_second_factor to true and the token has no scopes. It can access routes that require no scope, including enrollment.

With a second factor enrolled, the response sets second_factor to true and contains challenge, expires_at, and user with only name. Submit the challenge to POST /auth/login/second-factor within two minutes from the same client IP address. A session token is bound to the client IP address that opened the session. UrbeStack rejects and revokes the token if it is presented from another IP address. UrbeStack records up to 255 characters from User-Agent for the session list when the client sends it.

Malformed credentials, an unknown name, a wrong password, a suspended account, and a client IP address blocked by the login policy all return 401 with the message "Invalid credentials". UrbeStack checks the login policy before verifying the password. A request that passes those checks but lacks a client IP address returns 500.

After verifying the credentials, UrbeStack checks whether the license allows sign-ins. It may refresh a stale result and retries a previous license refusal. If sign-ins are blocked, the response is 402 with the reason and, when available, this server's IP address as seen by the license server. If the license server has never answered, the grace period is seven days from installation.

For a customer whose system password is missing, UrbeStack uses the verified password to set it for SFTP and shell access. UrbeStack also uses the verified password to upgrade an imported SHA-512 crypt hash. A successful hash upgrade revokes the account's existing tokens. Sign-in can continue if either update fails.

As commands

Run as root on the server

Request body

JSON ·LoginRequest· 2 fields
nameUsernameRequired
A username consists of lowercase letters, digits and underscores. For the user role, it also serves as the system account name.
passwordstring, up to 128 charactersRequired

Example

See the API overview for how to set $API and $TOKEN.
Request
curl -sS -X POST "$API/auth/login" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "alice",
    "password": "Sup3r-Secret-Passphrase"
  }'
Response · 200 OK
{
  "challenge": "text",
  "enrol_second_factor": true,
  "expires_at": "2026-09-16T10:15:00Z",
  "second_factor": true,
  "token": "ub_9f3c2a7e1b5d4082a6c1e7f0",
  "user": {
    "backups": true,
    "bandwidth_bytes": 1,
    "bandwidth_cut": true,
    "bandwidth_cut_at": "text",
    "bandwidth_limit_bytes": 1,
    "created_at": "2026-09-09T10:15:00Z",
    "customers": 1,
    "disk_limit_bytes": 1,
    "email": "alice@example.com",
    "home": "text",
    "id": 1,
    "move_state": "leaving",
    "name": "alice",
    "owner": "text",
    "owner_id": 1,
    "package": "basic",
    "package_backups": true,
    "package_id": 1,
    "package_shell": true,
    "role": "user",
    "second_factor": true,
    "shell": true,
    "status": "active",
    "system_password": true,
    "uid": 1
  }
}

Errors

47 errors, each a status and a sentence
400--name is required
400<name> has an owner: move them to the administrator before changing their role
400<name> is an administrator: administrators have no home, so nothing to back up
400<name> is an administrator: administrators have no system account
400<name> is an administrator: administrators have no system account, so no shell
400A <kind> token needs the client's address
400A plugin's token names its scopes
400A session is opened by a panel user: name one with --actor
400A session opened for a user is a session
400Cannot demote or suspend the last active administrator
400Domain name required
400Domain name too long
400Invalid <what>: expected a non-negative integer
400Invalid IPv4 address
400Invalid IPv6 address
400Invalid boolean
400Invalid domain name
400Invalid email address
400Invalid id
400Invalid label: 1 to 64 printable ASCII characters
400Invalid password hash
400Invalid password: 8 to 128 printable characters
400Invalid port
400Invalid role: admin, user or reseller
400Invalid setting key
400Invalid status
400Invalid system password hash
400Invalid user agent: 1 to 255 printable ASCII characters
400Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
400Nothing to change
400Only a customer has an owner: an administrator or a reseller is the administrator's own
400The second factor can only be turned off here; a user enrols from their own page
400Username '<value>' is reserved
401Invalid credentials
401The password is not the panel password
402<s.reason><seen>
403<opener.name> may not open the panel of <owner>
403Only a customer's panel is opened: <owner> is an administrator
403User '<owner>' is suspended
404Setting '<key>' not found
404User '
404User '<name>' not found
409<name> is on the package <p.name> of the reseller <p.owner>: change the package before the move
409<name> owns <owned>
409<who> and its bandwidth for the month is used up:
409<who> and its disk is used up:
409The package <p.name> allows <limit>
Generated from release 0.2.35 (current) · the API’s own descriptionThis entry has been unchanged since it was first published in release 0.1.0 on 3 Oct 2026.
urbestack.com/docs/api/post-auth-login/