GaiaExGaiaEx
API

API Error Codes Reference

Complete list of GaiaEx API error codes, their causes, and recommended fixes for common integration issues.

Authentication Errors

HTTP CodeError MessageCauseSolution
401Missing authenticationNo auth headers or Bearer token providedInclude X-GAIAEX-APIKEY + X-GAIAEX-TIMESTAMP + X-GAIAEX-SIGNATURE headers, or Authorization: Bearer
401Invalid API keyThe API key does not exist or has been revokedCreate a new API key via dashboard or API
401Invalid signatureHMAC signature verification failedCheck your signing logic: message = timestamp + METHOD + path + body
401Timestamp expiredX-GAIAEX-TIMESTAMP is more than 5 seconds from server timeSync your clock using GET /time
401Session expiredBearer session token has expiredRe-authenticate via /user/handshake
403Address mismatchAuthenticated user address does not match the request path/body user_addressEnsure the API key belongs to the same address
403Insufficient permissionsAPI key lacks the required permission (e.g., trade)Update key permissions via PATCH /api-keys/{key}
403IP not whitelistedRequest IP is not in the API key's whitelistAdd the IP to the whitelist or remove the restriction

Rate Limit Errors

HTTP CodeError MessageCauseSolution
429Rate limit exceededToo many requests in the current windowWait for the duration in the Retry-After header
429Handshake rate limitToo many handshake attemptsWait 10–15 seconds before retrying

Order Errors

HTTP CodeError MessageCauseSolution
400Price must be divisible by {tick}Price does not match the symbol's tick sizeRound the price to the correct decimal places
400Order must have minimum value of $10Order notional value is below $10Increase order size or price
400Order has invalid sizeSize does not match the symbol's size decimalsRound size to valid step size
400Order has invalid pricePrice is zero, negative, or malformedUse a valid positive decimal price
400Symbol 'XYZ' is not supportedThe symbol is not listed or has been delistedCheck GET /symbols/list for valid symbols
400Trading is haltedThe symbol is temporarily haltedWait and retry. Check symbol status.
400Insufficient marginNot enough available balance for the orderDeposit more USDC or reduce position size
400Order was never placed, already canceled, or filledCancel/modify target order no longer existsVerify the order ID. After modify, use the new order ID.
409Duplicate client_idA client_id was reused for a different orderUse unique client_id values per order

Position Errors

HTTP CodeError MessageCauseSolution
404No open position foundAttempting to close a position that doesn't existCheck GET /user/{addr}/positions first
400Size exceeds positionClose size is larger than the open positionUse a smaller size or omit for full close

Leverage Errors

HTTP CodeError MessageCauseSolution
400Leverage exceeds maximumRequested leverage exceeds the symbol's maxCheck maxLeverage from GET /symbols/list
400Cross margin is not allowedSymbol only supports isolated marginThe backend auto-corrects this, but if you encounter it, set is_cross: false

Deposit / Withdrawal Errors

HTTP CodeError MessageCauseSolution
400Below minimum depositDeposit amount is below the minimum ($5)Increase deposit amount
400Insufficient balance for withdrawalWithdrawal exceeds available balanceCheck available balance first
400Invalid withdrawal signatureEIP-712 signature is invalid or nonce mismatchRe-fetch the withdrawal payload and sign again

Spot Errors

HTTP CodeError MessageCauseSolution
400Spot symbol not foundThe spot pair is not availableCheck GET /spot/symbols for valid pairs
400Insufficient spot balanceNot enough tokens for the sell orderCheck GET /spot/balance/{address}

General Errors

HTTP CodeError MessageCauseSolution
422Validation errorRequest body failed schema validationCheck the detail array for specific field errors
500Internal server errorUnexpected server-side errorRetry after a brief delay. Report persistent issues.
502Upstream unavailableA downstream service GaiaEx depends on is temporarily unreachableRetry with exponential backoff

Order-specific Errors

ConditionCauseSolution
Cancel rejected: Order was never placed, already canceled, or filledThe orderId is stale — usually because a prior /order/modify replaced it, or the order already filled/canceled.Always use the orderId returned by the latest /order/modify response. Query GET /user/{address}/openOrders to reconcile if in doubt.
Insufficient margin to place orderThe account's available USDC does not cover the order's margin requirement.Reduce size, reduce leverage, or deposit more USDC via the GaiaEx mobile app.
NEEDS_TRANSFER (HTTP 449)Deployer markets (xyz:, cash:, vntl:) require a one-time in-app transfer before first trade.Open the GaiaEx mobile app and enter the market once — the app completes the transfer. API-key integrations cannot complete this step.
Invalid signatureHMAC digest did not match. Common causes: path includes the /v1/trade prefix (it should not), body re-serialized between signing and sending, or timestamp in seconds rather than milliseconds.Review the signing walkthrough in General Info. The computed signature for the canonical example must match byte-for-byte.
Invalid timestampClient clock is more than 5 seconds off server time.NTP-sync your client. Pass X-GAIAEX-TIMESTAMP in milliseconds.

Best Practices

  1. Always check the detail field — it contains the human-readable error message.
  2. Handle 429 gracefully — respect the Retry-After header and implement exponential backoff.
  3. After POST /order/modify — always update your local order ID to the new one returned.
  4. Use POST /order/test — validate orders before placing them in production.
  5. Log all responses — include the timestamp field for debugging with support.