3x-ui3x-ui

API Tokens

Manage scoped Bearer tokens for programmatic auth. admin grants the full panel API; monitor is read-only for status and metrics; node-sync manages node configuration without panel updates; node-admin adds panel self-update to node-sync. Tokens may expire and are stored as SHA-256 hashes. The plaintext is returned only once at creation.

GET
/panel/api/setting/apiTokens

Authorization

headerAuthorizationBearer <token>

Scoped API token from Settings → Security → API Token. Send as Authorization: Bearer <token>.

Response Body

Successful response

application/json
  1. response
success?boolean
msg?string
obj?unknown
Example Request
curl -X GET 'https://example.com/panel/api/setting/apiTokens'
Example Response200
{  "success": true,  "obj": [    {      "id": 1,      "name": "central-panel-a",      "enabled": true,      "createdAt": 1736000000,      "scope": "node-admin",      "expiresAt": 0    }  ]}
POST
/panel/api/setting/apiTokens/create

Authorization

headerAuthorizationBearer <token>

Scoped API token from Settings → Security → API Token. Send as Authorization: Bearer <token>.

Request Body

application/json
  1. body
name*string

Human-readable label, e.g. "central-panel-a".

scope?string

admin (default), monitor, node-sync, or node-admin. node-admin inherits node-sync and may also start a panel update.

Value in"admin""monitor""node-sync""node-admin"
expiresAt?integer

Future Unix milliseconds, or 0 for no expiry.

Response Body

Successful response

application/json
  1. response
success?boolean
msg?string
obj?
Example Request
curl -X POST 'https://example.com/panel/api/setting/apiTokens/create' \  -H 'Content-Type: application/json' \  -d '{  "name": "central-panel-a",  "scope": "node-admin",  "expiresAt": 1798761600000}'
Example Response
{  "success": true,  "obj": {    "createdAt": 1736000000,    "enabled": true,    "expiresAt": 0,    "id": 2,    "name": "central-panel-a",    "scope": "admin",    "token": "new-token-string"  }}
POST
/panel/api/setting/apiTokens/delete/{id}

Authorization

headerAuthorizationBearer <token>

Scoped API token from Settings → Security → API Token. Send as Authorization: Bearer <token>.

Path Parameters

id*integer

Token row ID.

Request Body

application/json
  1. body
expectedScope*string

Stored scope expected by the operator.

Response Body

Successful response

application/json
  1. response
success?boolean
msg?string
obj?unknown
Example Request
curl -X POST 'https://example.com/panel/api/setting/apiTokens/delete/0' \  -H 'Content-Type: application/json' \  -d '{  "expectedScope": "node-sync"}'
Example Response200
{  "success": true}
POST
/panel/api/setting/apiTokens/setEnabled/{id}

Authorization

headerAuthorizationBearer <token>

Scoped API token from Settings → Security → API Token. Send as Authorization: Bearer <token>.

Path Parameters

id*integer

Token row ID.

Request Body

application/json
  1. body
enabled*boolean

New enabled state.

expectedScope*string

Stored scope expected by the operator.

Response Body

Successful response

application/json
  1. response
success?boolean
msg?string
obj?unknown
Example Request
curl -X POST 'https://example.com/panel/api/setting/apiTokens/setEnabled/0' \  -H 'Content-Type: application/json' \  -d '{  "enabled": false,  "expectedScope": "node-sync"}'
Example Response200
{  "success": true}