Authorization API
Authorization APIs are called through Command WS. auth.create_session is anonymous; all other methods require a valid session on the current connection.
Methods
| Method | Parameters | Response data | Notes |
|---|---|---|---|
auth.create_session | token: string required | session_token: string, expires_in: number, auth_context: AuthContext | Creates a connection-bound session from an API key. |
auth.get_context | none | session_token: string, auth_context: AuthContext | Reads current connection auth context. |
auth.refresh_session | none | session_token, expires_in, auth_context | Refreshes current connection session. |
auth.activate_offline | auth_code: string required | session_token, expires_in, auth_context | Activates the current machine and session with an offline device activation code. |
auth.destroy_session | none | destroyed: boolean | Destroys the session and cleans streams/devices opened by the current connection. |
AuthContext
| Field | Type | Notes |
|---|---|---|
is_valid | boolean | Whether auth is valid. |
account_type | string | vip, svip, svip_plus, custom, trial, or unknown. |
account_type_code | number | Numeric account type. |
auth_scene | string | Auth scene. |
license_mode | string | online_api_key or offline_api_key. |
entitlement_state | string | Entitlement state. |
machine_code | string | Current machine code; used for offline activation. |
device_scope[] | array | { vid: number, pid: number }. |
expires_at | number | Expiration timestamp; 0 means not set. |
capabilities[] | string[] | Methods callable by the current session. |
quota_buckets[] | array | Quota bucket with bucket, methods, limit, remaining, and enforcement. |
Before calling quota-limited methods, clients must use the quota_buckets[].limit and quota_buckets[].remaining values returned by the server and must not assume a fixed quota locally.
Example
json
{
"request_id": "req-auth-001",
"method": "auth.create_session",
"params": {
"token": "sk-sq-v1-..."
}
}