Withdraw

POST/withdraw

Withdraws collateral to the account wallet only. Sign the EIP-712 struct WithdrawIntent(address account,uint256 amount,uint64 nonce,uint64 deadline), with account set to your account and amount in USD × 1e6, in the domain with name CRX, version rulebook-1.0, and the chain_id and core from GET /health. Withdrawal approval time: 60 minutes. Follow withdraw.last on GET /balance until final is true.

Authentication

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

Request body

FieldTypeDescription
chain requiredstring

A chains[].key from GET /health.

amount requiredstring

USD amount from 1 to free, up to 6 decimal places.

nonce requiredstring

withdraw.nonce from GET /balance, as a string.

deadline requiredinteger

Intent expiry, in Unix time (seconds). More than 120 seconds and at most 23 hours ahead.

sig requiredstring

Your account key's EIP-712 signature of the intent: 65 bytes as 0x hex.

Responses

200

The same intent was already sent.

FieldTypeDescription
item requiredstring

Withdrawal ID; matches withdraw.last.item.

status requiredstring sending
chain requiredstring
account requiredstring
amount requiredstring

Amount in USD, as a decimal string.

nonce requiredstring
deadline requiredinteger

Intent expiry, in Unix time (seconds).

202

Withdrawal accepted.

FieldTypeDescription
item requiredstring

Withdrawal ID; matches withdraw.last.item.

status requiredstring sending
chain requiredstring
account requiredstring
amount requiredstring

Amount in USD, as a decimal string.

nonce requiredstring
deadline requiredinteger

Intent expiry, in Unix time (seconds).

400

bad_request, invalid_signature.

code bad_request invalid_signature

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.

code not_whitelisted

408

timeout: no answer within 30 seconds. Resend the same body with a new x-crx-ts; it never sends a second withdrawal.

code timeout

409

withdraw_in_progress: another withdrawal is pending. conflict: withdrawals are unavailable now; outcome is platform_paused, unavailable, price_unavailable or account_not_active.

code withdraw_in_progress conflict

413

payload_too_large: the body is over 2 MiB.

code payload_too_large

415

unsupported_media_type: send content-type: application/json.

code unsupported_media_type

422

unprocessable_entity: wrong nonce, amount above free collateral, amount under 1 USD, or deadline out of range.

code unprocessable_entity

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.

500

internal: the withdrawal was not queued or sent.

code internal

502

upstream: a chain read failed. Retry shortly.

code upstream

503

service_unavailable: CRX cannot accept a withdrawal now; nothing was sent.

code service_unavailable