# POST /users/{name}/sessions

First published 14 Oct 2026 (release 0.2.0) · Unchanged since publication

UrbeStack release 0.2.35 API operation in the users group.

Open a session as a customer

- Who may call it: administrator, reseller
- Token scope, any of: users, all
- Answers: 201 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

- [urbestack-token-create](https://urbestack.com/docs/commands/urbestack-token-create.md): Creates a token for the active UrbeStack user named by --user.

## Example

Set $API to the base URL and $TOKEN to the token, as the [API overview](https://urbestack.com/docs/api.md) shows.

```
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

- 400: A <kind> token needs the client's address
- 400: A plugin's token names its scopes
- 400: A session is opened by a panel user: name one with --actor
- 400: A session opened by someone else opens no further session
- 400: A session opened for a user is a session
- 400: Invalid <what>: expected a non-negative integer
- 400: Invalid IPv4 address
- 400: Invalid IPv6 address
- 400: Invalid id
- 400: Invalid label: 1 to 64 printable ASCII characters
- 400: Invalid user agent: 1 to 255 printable ASCII characters
- 400: Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
- 400: Username '<value>' is reserved
- 400: Your own panel is the one you are in
- 401: Authentication required
- 403: <opener.name> may not open the panel of <owner>
- 403: Insufficient privileges
- 403: Only a customer's panel is opened: <name> is an administrator
- 403: Only a customer's panel is opened: <owner> is an administrator
- 403: User '<owner>' is suspended
- 404: User '
- 409: <name> is suspended: bring them back first
