Skip to content

Authentication

API wallets, request signing, expiry, and the difference between public reads and signed exchange actions.

Updated Nov 4, 2026Builders2 min read
On this page

Reads are public. Writes are authorized by a signature from the account or an API wallet scoped to the account.

API wallets

An API wallet is a separate key that can sign trading actions without holding the master key. It cannot withdraw funds to an external chain.

CapabilityMasterAPI wallet
Read public dataYesYes
Place / cancel ordersYesYes
Modify leverage and marginYesYes
Transfer between sub-accountsYesYes
Withdraw to external chainYesNo
Create or revoke API walletsYesNo

Create an API wallet from Settings → API wallets or with the approveAgent action. Revoke it at any time; revocation takes effect on the next block.

Request format

A signed exchange request contains the action, a nonce, a signature, and an optional vault address:

code
{
  "action": {
    "type": "order",
    "orders": [{ "asset": 0, "isBuy": true, "limitPx": "104000", "sz": "0.01", "reduceOnly": false, "tif": "Gtc" }],
    "grouping": "na"
  },
  "nonce": 1762732800123,
  "signature": { "r": "0x...", "s": "0x...", "v": 27 },
  "vaultAddress": null
}

Never ship a master key

Use an API wallet in any client that is not a hardware wallet. If a key leaks, an attacker can trade and cancel, but cannot withdraw your funds. Revoke the wallet and rotate immediately.

Signing steps

  1. Serialize the action deterministically (sorted keys, no whitespace).
  2. Hash the serialized action with the domain separator.
  3. Sign the hash with the account or API wallet key.
  4. Send the action, nonce, and signature to POST /exchange.

The exact typed-data structure is documented in signing. Use an SDK rather than implementing it by hand.

Nonces

Every signed action needs a nonce greater than the last accepted nonce for that signer. Use the current time in milliseconds. See nonces and API wallets.

Expiry

Some actions support expiresAfter, a millisecond timestamp after which the action is rejected. User-signed actions such as usdClassTransfer do not support it. An action canceled because it expired still consumes rate-limit weight (5x the normal weight).

Common errors

ErrorMeaning
Invalid signatureWrong domain, hash, or signer
Nonce too lowReused or out-of-order nonce
UnauthorizedAPI wallet not approved for the account
Action already expiredexpiresAfter is in the past

Was this page helpful?