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

/users/{name}/sessions

First published 14 Oct 20260.2.0Unchanged since publication

Open a session as a customer

Who may call it
AdministratorResellerCustomer
Token scope, any of
usersall
Answers201 Created

Administrators can open a session for any customer, and resellers can open one for their own customers. Use a token with the users scope. The customer's password and second factor are unnecessary. The web interface uses this operation to open the customer's panel in a separate tab as the customer sees it.

The session lasts up to one hour and ends when the token used to open it is revoked. If you used a session token, signing out of that session also ends the customer's session. It is bound to the caller's IP address. Presenting the token from another IP address rejects the request and revokes the token. The customer's session list includes opened_by. The audit log records each request made with the session with the caller as the actor and the customer's name in the as field.

The response contains token, expires_at, opened_by and the customer's account details in user. The API returns 400 if you target your own account or use a session opened by this operation. It returns 403 for an administrator target or insufficient management permissions, 409 for an inactive target account and 500 if the request lacks a client IP address.

As a command

Run as root on the server

Example

See the API overview for how to set $API and $TOKEN.
Request
curl -sS -X POST "$API/users/{name}/sessions" \
  -H "Authorization: Bearer $TOKEN"
Response · 201 Created
{
  "expires_at": "2026-09-16T10:15:00Z",
  "opened_by": "text",
  "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

22 errors, each a status and a sentence
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 by someone else opens no further session
400A session opened for a user is a session
400Invalid <what>: expected a non-negative integer
400Invalid IPv4 address
400Invalid IPv6 address
400Invalid id
400Invalid label: 1 to 64 printable ASCII characters
400Invalid user agent: 1 to 255 printable ASCII characters
400Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
400Username '<value>' is reserved
400Your own panel is the one you are in
401Authentication required
403<opener.name> may not open the panel of <owner>
403Insufficient privileges
403Only a customer's panel is opened: <name> is an administrator
403Only a customer's panel is opened: <owner> is an administrator
403User '<owner>' is suspended
404User '
409<name> is suspended: bring them back first
Generated from release 0.2.35 (current) · the API’s own descriptionThis entry has been unchanged since it was first published in release 0.2.0 on 14 Oct 2026.
urbestack.com/docs/api/post-users-name-sessions/