Error Handling

API error format, lookup, and retry guidance

Use this guide to parse OBSDN API errors, look up error metadata, and decide whether a request should be retried.

Error Response Format

All API errors return an envelope with an error object and a request ID:

{
  "error": {
    "code": "InvalidArgument",
    "ref": "E0101_InvalidArgument",
    "message": "The provided input is invalid."
  },
  "request_id": "5b8a..."
}
FieldDescription
error.codegRPC status code name (e.g., InvalidArgument, Unauthenticated, NotFound)
error.refMachine-readable error reference from the error catalog (e.g., E0101_InvalidArgument); may be absent for low-level transport errors
error.messageHuman-readable error description
request_idServer-generated request identifier; also returned in the X-Request-Id response header

Successful responses follow the same envelope pattern with the payload under data:

{
  "data": {
    /* response payload */
  },
  "request_id": "5b8a..."
}

Error Reference Format

The ref field follows the pattern E{CODE}_{Name} and maps directly to the error catalog available via GET /error-codes.

Example: E0101_InvalidArgument

  • E0101 - Numeric error code
  • InvalidArgument - Machine-readable name

Use ref (not message) for programmatic error handling. The message field is human-readable and may change without notice.

Error Categories

CategoryDescription
authAuthentication and authorization errors
validationRequest validation failures
tradingOrder and trade execution errors
accountAccount and balance issues
marketMarket data and product errors
rate_limitRate limiting errors
fundingFunding and withdrawal errors
systemInternal system errors

Looking Up Error Codes

Use the Error Codes API to look up error metadata:

# Get all error codes
curl https://api.obsdn.trade/error-codes

# Filter by category
curl "https://api.obsdn.trade/error-codes?cat=trading"

# Look up specific error
curl "https://api.obsdn.trade/error-codes?ref=E0101_InvalidArgument"
QueryDescription
catFilter by category (auth, validation, trading, account, market, rate_limit, funding, system)
refFilter by full error reference (e.g., E0101_InvalidArgument)

Error Code Response

{
  "data": {
    "errs": [
      {
        "ref": "E0101_InvalidArgument",
        "code": "E0101",
        "cat": "validation",
        "grpc_code": "InvalidArgument",
        "title": "Invalid Input",
        "msg": "The provided input is invalid.",
        "action": "none",
        "sev": "warning",
        "retry_alwd": true,
        "http_st": 400
      }
    ]
  },
  "request_id": "..."
}

Response Fields

FieldDescription
refFull error reference identifier
codeShort error code
catError category
grpc_codeCorresponding gRPC code name (e.g., InvalidArgument, Unauthenticated)
titleBrief summary for UI display
msgUser-friendly error description
actionSuggested handling (retry, redirect_login, contact_support, none)
sevSeverity level (error, warning, info)
retry_alwdWhether the operation can be retried
http_stCorresponding HTTP status code

Common Errors

Authentication Errors

CodeReferenceHTTPCause
E0001E0001_AuthRequired401Authentication required
E0002E0002_InternalRequired403Endpoint requires internal access
E0003E0003_PermissionDenied403Permission denied for this action
E0004E0004_ReadOnlyKey403this operation requires a full API key
E0005E0005_InvalidAPIKey401API key is invalid
E0006E0006_InvalidSignature401Request signature is invalid

Validation Errors

CodeReferenceCause
E0101E0101_InvalidArgumentInvalid input provided
E0102E0102_InvalidFormatInput format is invalid
E0103E0103_InvalidSymbolTrading symbol is invalid
E0104E0104_InvalidCursorPagination cursor is invalid or expired
E0105E0105_ValueOutOfRangeValue outside allowed range
E0106E0106_AlreadyExistsEntity already exists

Trading Errors

CodeReferenceCause
E0201E0201_InsufficientBalanceNot enough balance for operation
E0202E0202_OrderLimitExceededMaximum open orders reached
E0203E0203_InvalidOrderTypeOrder type not allowed for this symbol
E0204E0204_InvalidStopPriceStop price is invalid for this order

Account Errors

CodeReferenceCause
E0301E0301_UserNotFoundRequested user not found
E0302E0302_AccountRestrictedAccount is restricted from this operation

Market Errors

CodeReferenceCause
E0401E0401_SymbolNotTradingSymbol is not currently available for trading
E0402E0402_MarketClosedMarket is currently closed
E0403E0403_InvalidTimestampRequest timestamp is outside the allowed window

Market Mode Rejections

Order placement and cancellation are gated by the market's lifecycle stage (see Market Lifecycle). When an action is not allowed in the current stage, the API returns InvalidArgument with one of these messages, where {id} is the market identifier from the request:

MessageStageMeaning
only post-only orders are allowed in {id} marketpre-launchOnly maker (post-only) orders are accepted
market {id} is in wind-down mode, only reduce-only orders allowedwinding downOnly position-reducing orders are accepted
market {id} is haltedhaltedNo new orders; cancellations still work
market {id} is outside trading hoursoff-hoursUnderlying exchange is closed; cancellations still work
market {id} is being delisteddelistingMarket is being delisted; all user orders blocked
market {id} has been delisteddelistedAll operations blocked, including cancellation

Rate Limit Errors

CodeReferenceCause
E0501E0501_RateLimitExceededToo many requests
E0502E0502_TooManyRequestsRequest limit exceeded

When you receive a rate limit error, implement your own exponential backoff before retrying.

Funding Errors

CodeReferenceCause
E0601E0601_WithdrawalSuspendedWithdrawals are temporarily suspended
E0602E0602_MinAmountNotMetAmount is below the minimum required

System Errors

CodeReferenceCause
E0701E0701_InternalErrorInternal error; retry the request
E0702E0702_ServiceUnavailableService is temporarily unavailable
E0703E0703_DatabaseErrorDatabase error; retry the request
E0704E0704_ExchangeDegradedExchange cannot process writes right now; retry shortly

Handling Guidance

  1. Use error.ref - match on the ref field for programmatic error handling; it maps to the error catalog
  2. Use the error-codes API - build a local cache from GET /error-codes on startup
  3. Check retry_alwd - retry only operations that explicitly allow it
  4. Handle action - implement flows for redirect_login and contact_support
  5. Log request_id - include it (and ref) when reporting issues

Next Steps

On this page