1. CRX
  2. API reference
  3. Session
  4. Mint a session token

Mint a session token

POST/session

Returns a token that replaces the signed headers for 8 hours, on the calls that list it. Send no body. The token can read the account, open RFQs, cancel quotes and decline RFQs; an accept, a quote and a withdrawal still need the account key's signature. A session token cannot grant or remove a viewer or mint a session. The token can end before 8 hours. Mint a new token after a 401 unauthorized.

Authentication

  • x-crx-address x-crx-ts x-crx-sig
  • x-crx-address x-crx-signer x-crx-ts x-crx-sig

Responses

200

Token created.

FieldTypeDescription
token requiredstring

Value for x-crx-session: 64 lowercase hex characters. Keep it secret.

expires_at requiredintegerminimum 0

Token expiry time.

custody requiredstring

Account the token acts for, in lowercase.

signer requiredstring

Wallet that signed, in lowercase.

ttl_ms requiredinteger

Token lifetime in milliseconds: 28800000 (8 hours).

401

unauthorized: a header is missing or malformed, x-crx-ts is out of range, the call was already used, the signature does not match, or the caller lacks access.

code unauthorized

403

not_whitelisted: the account is not approved for this call. setup_pending: the account is approved and its setup is in progress. seat_cannot_sign: the account wallet cannot sign trades. Contract wallets such as a Safe are refused; an EOA with an EIP-7702 delegation is accepted.

code not_whitelisted setup_pending seat_cannot_sign

404

not_found: session tokens are disabled.

code not_found

408

timeout: no answer within 30 seconds.

code timeout

413

payload_too_large: the body is over 4 MiB. Send no body.

code payload_too_large

429

rate_limited: retry after Retry-After seconds.

code rate_limited

HeaderTypeDescription
Retry-Afterinteger

Seconds until the next call is accepted.

ratelimit-limitinteger

Maximum calls in a burst.

ratelimit-remaininginteger

Calls remaining before the limit.

ratelimit-resetinteger

Seconds until the full limit is restored.

ratelimit-refillinteger

Calls restored per minute.

502

upstream: a chain read failed. Retry shortly.

code upstream

503

service_unavailable: access cannot be checked now. mark_unavailable: start-up checks are on hold. service_restarting: the service is restarting. Retry shortly.

code service_unavailable mark_unavailable service_restarting