Authentication
Public
Generates a token for a new subject id. This method can be used to switch between subaccounts.
Rules:
- subject_id must differ from the subject of the supplied refresh token (otherwise -32602) and must identify an active user (otherwise -32602).
- Regular clients can only switch within their own account family (the main account and its subaccounts). A token issued directly for a subaccount cannot switch to the main account or to sibling subaccounts (-32602 on subject_id). Vault subaccounts are rejected with 14049 (vault_subaccount_not_allowed).
- Without scope, the new token inherits the scope of the supplied refresh token. A supplied scope replaces it (it is not merged), and cannot exceed the scope of the refresh token (13403 scope_exceeded). If it contains neither session: nor connection, a session with a generated name is created.
- The new access token's lifetime is counted from the issue time of the supplied refresh token.
- Over WebSocket, the returned access token is also installed on the current connection, so subsequent private requests act as the new subject.
- An invalid, expired or already-replaced refresh token (or one bound to another connection) returns -32602 on refresh_token; session_not_found means the session of the token no longer exists.
📖 Related Articles:
get/public/exchange_token
Request
- Base URLhttps://test.deribit.com/api/v2
- URLhttps://test.deribit.com/api/v2/public/exchange_token
- Authnone declared
Query parameters
refresh_tokenstring required
Example:1568800656974.1CWcuzUS.MGy49NK4hpTwvR1OYWfpqMEkH4T4oDg4tNIcrM7KdeyxXRcSFqiGzA_D4Cn7mqWocHmlS89FFmUYcmaN2H7lNKKTnhRg5EtrzsFCCiuyN0Wv9y-LbGLV3-Ojv_kbD50FoScQ8BDXS5b_w6Ir1MqEdQ3qFZ3MLcvlPiIgG2BqyJX3ybYnVpIlrVrrdYD1-lkjLcjxOBNJvvUKNUAzkQ
Refresh token
subject_idinteger required
Example:10
Id of the user (main account or subaccount) to switch to. Must differ from the current subject.
scopestring
Optional scope for the new token. Replaces (does not merge with) the scope of the refresh token and cannot exceed it (13403 scope_exceeded). Supports session:name for direct session creation. If omitted, the scope of the refresh token is kept.
Response
Success response
Example response
{
"result": {
"access_token": "843SehgeX5n6XxEU4XbABx4Cny5Akai5iHiJePTsvUw7",
"expires_in": 900,
"refresh_token": "6faf8L36JdaSqsjCEEiwqifPpj6JB18RWwiWHrsGTZ91"
}
}Changes
No recorded changes to this operation across all 11 revisions of this API.