Error Format

All error responses use a single unified format with string slug codes:

{
    "code": "ERROR_SLUG",
    "message": "Human-readable description",
    "fields": {"field_name": "error detail"}  // only for validation errors
}

The fields property is only present when code is VALIDATION_ERROR.

Error Response Tiers

HTTP StatusCodeWhen
400BAD_REQUESTInvalid input caught by handler (pair not found, invalid format, negative amounts, disabled order type)
400MALFORMED_JSONRequest body is not valid JSON
400Business slug (see table below)Business logic error from trading core
401UNAUTHORIZEDMissing or invalid auth
403FORBIDDENMissing signature, insufficient permissions, pair not permitted for API key
404NOT_FOUNDResource not found
422VALIDATION_ERRORStruct/field validation failed (includes fields map with per-field errors)
429TOO_MANY_REQUESTSRate limit exceeded
500INTERNAL_SERVER_ERRORUnexpected server error
503SERVICE_UNAVAILABLEService temporarily unavailable

Business Error Slugs

These slugs are returned with HTTP 400 when the trading core rejects a request:

SlugDescription
REQUIRED_FIELDMissing required field
INVALID_FORMATInvalid field format or value
INVALID_QUANTITYAmount is zero or violates constraints
INVALID_PRICEPrice is zero or negative
INVALID_ORDER_TYPEUnknown order type
INVALID_SIDEUnknown order side
INVALID_STOP_PRICEMissing or invalid stop price for stop orders
INVALID_PAIRPair not found, disabled, or doesn't support this order type
ORDER_NOT_FOUNDOrder doesn't exist or already completed
INVALID_CURRENCYInvalid currency
INVALID_PRECISIONInvalid decimal precision
INVALID_ORDER_SIZEAmount below minimum_order_size or above maximum_order_size
INVALID_ORDER_VALUEOrder value (amount × price) below minimum_order_value
INSUFFICIENT_FUNDSNot enough available balance
SERVICE_OVERLOADEDService temporarily overloaded, retry later
INTERNAL_ERRORInternal service error

Examples

Handler error (BAD_REQUEST)

HTTP 400
{
    "code": "BAD_REQUEST",
    "message": "pair not found"
}

Business error from trading core

HTTP 400
{
    "code": "INSUFFICIENT_FUNDS",
    "message": "Out of balance: 0.5 BTC"
}

Validation error

HTTP 422
{
    "code": "VALIDATION_ERROR",
    "message": "Input data validation failed",
    "fields": {
        "order_type": "invalid order_type: FANTASY"
    }
}

Malformed JSON

HTTP 400
{
    "code": "MALFORMED_JSON",
    "message": "The request body is not a valid JSON"
}

Authentication Errors

Authentication errors return standard HTTP status codes with a descriptive message.

HTTP StatusCodeDescription
401INVALID_SECRETAPI secret is incorrect
401UNAUTHORIZEDGeneral authentication failure (deleted key, inactive account, department mismatch)
403IP_NOT_ALLOWEDRequest IP is not in the API key whitelist
403FORBIDDENMissing signature or insufficient permissions
403MISSING_SIGNATUREX-SIGN header required but not provided
403INVALID_SIGNATUREX-SIGN signature verification failed
404NOT_FOUNDAPI key does not exist
422VALIDATION_ERRORMissing api_key or api_secret in request body