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",
    "message": "E0101_InvalidArgument: The provided input is invalid."
  },
  "request_id": "5b8a..."
}
FieldDescription
error.codegRPC status code name (e.g., InvalidArgument, Unauthenticated, NotFound)
error.messageHuman-readable message; for application-level errors begins with the error reference (e.g., E0101_InvalidArgument: ...)
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

Error messages follow the pattern: E{CODE}_{Reference}: {Description}

Example: E0101_InvalidArgument: The provided input is invalid.

  • E0101 - Numeric error code
  • InvalidArgument - Machine-readable reference
  • The provided input is invalid. - Human-readable message

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

CodeReferenceCause
E0001AuthRequiredAuthentication required
E0003PermissionDeniedPermission denied for this action
E0004ReadOnlyKeyAPI key is read-only; operation requires a full key
E0005InvalidAPIKeyAPI key is invalid
E0006InvalidSignatureRequest signature is invalid

Validation Errors

CodeReferenceCause
E0101InvalidArgumentInvalid input provided
E0102InvalidFormatInput format is invalid
E0103InvalidSymbolTrading symbol is invalid
E0104InvalidCursorPagination cursor is invalid or expired
E0105ValueOutOfRangeValue outside allowed range

Trading Errors

CodeReferenceCause
E0201InsufficientBalanceNot enough balance for operation
E0202OrderLimitExceededMaximum open orders reached
E0203InvalidOrderTypeOrder type not allowed for this symbol
E0204InvalidStopPriceStop price is invalid for this order

Account Errors

CodeReferenceCause
E0301UserNotFoundRequested user not found
E0302AccountRestrictedAccount is restricted from this operation

Market Errors

CodeReferenceCause
E0401SymbolNotTradingSymbol is not currently available for trading
E0402MarketClosedMarket is currently closed

Rate Limit Errors

CodeReferenceCause
E0501RateLimitExceededToo many requests
E0502TooManyRequestsRequest limit exceeded

When you receive a rate limit error, check the Retry-After header for when to retry.

Funding Errors

CodeReferenceCause
E0601WithdrawalSuspendedWithdrawals are temporarily suspended
E0602MinAmountNotMetAmount is below the minimum required

System Errors

CodeReferenceCause
E0701InternalErrorInternal error; retry the request
E0702ServiceUnavailableService is temporarily unavailable
E0703DatabaseErrorDatabase error; retry the request

Handling Guidance

  1. Parse error references - extract the error ref from error.message for programmatic handling
  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 the full error ref) when reporting issues

Next Steps

On this page