Create an access token tо API: Auth.CreateApiToken

Creates an OAuth token for JSON-RPC API access. This method can only be called from localhost

Parameters

params: object


params.ttl: integer

optional

Default:

JSON
3600

Token lifetime in seconds (0 = unlimited)


Result

result: string


POST /api/

JSON
{
  "jsonrpc": "2.0",
  "method": "Auth.CreateApiToken",
  "params": {
    "ttl": 3600
  },
  "id": 123
}
cURL
Bash
curl -k --request POST \
    --url 'https://your-domain/api/' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer <api-authorization-token>' \
    --data '{
  "jsonrpc": "2.0",
  "method": "Auth.CreateApiToken",
  "params": {
    "ttl": 3600
  },
  "id": 123
}'

200 OK

JSON
{
  "jsonrpc": "2.0",
  "result": "your_api_token",
  "id": 123
}

400 Bad Request

JSON
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "Method not found"
  },
  "id": 123
}

500 Internal Server Error

Server error