Skip to main content
Buildmarkets uses standard HTTP status codes along with structured JSON error bodies to communicate what went wrong. This page is your reference for understanding and handling error responses.

Error response format

All error responses return a JSON body with a consistent structure:
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "tax_id must be 9–11 characters",
    "field": "identity.tax_id",
    "request_id": "req_abc123xyz"
  }
}
FieldDescription
codeA machine-readable error code string
messageA human-readable description of the error
field(When applicable) The request field that caused the error
request_idA unique ID for this request — include this when contacting Buildmarkets support

HTTP status codes

2xx — Success

CodeMeaning
200 OKRequest succeeded. Response body contains the resource.
201 CreatedResource was created. Response body contains the new resource.
204 No ContentRequest succeeded. No response body (e.g., DELETE, close account).

4xx — Client errors

CodeMeaningCommon causes
400 Bad RequestThe request body or parameters are invalid.Missing required fields, invalid enum values, malformed JSON
401 UnauthorizedAuthentication failed.Missing, invalid, or revoked X-API-Key / X-API-Secret
403 ForbiddenAuthenticated, but not authorized.API key lacks the required scope for this endpoint
404 Not FoundThe requested resource doesn’t exist.Invalid accountId, orderId, etc.
409 ConflictRequest conflicts with the current state of the resource.Duplicate client_order_id, account already closed
422 Unprocessable EntityRequest is syntactically valid but fails business-rule validation.KYC rejection, insufficient balance for withdrawal
429 Too Many RequestsRate limit exceeded.See Rate Limits below

5xx — Server errors

CodeMeaning
500 Internal Server ErrorAn unexpected error occurred on Buildmarkets’s side.
503 Service UnavailableThe service or a dependency is temporarily unavailable.

Common error codes

Authentication & authorization

Error codeHTTPDescription
UNAUTHORIZED401API key or secret is missing or invalid
FORBIDDEN403API key is valid but lacks the required scope
KEY_REVOKED401The API key has been revoked

Validation errors

Error codeHTTPDescription
VALIDATION_ERROR400One or more fields failed validation. Check the field property.
MISSING_REQUIRED_FIELD400A required field was omitted from the request
INVALID_ENUM_VALUE400A field value is not in the allowed set
INVALID_FORMAT400A field value has an incorrect format (e.g., date, phone number)

Account errors

Error codeHTTPDescription
ACCOUNT_NOT_FOUND404No account exists with the given accountId
ACCOUNT_NOT_ACTIVE422The account is not in ACTIVE status and cannot perform this action
ACCOUNT_ALREADY_CLOSED409The account has already been closed
KYC_REJECTED422Account was rejected during KYC verification
KYC_PENDING422Account KYC has not yet completed — certain actions require APPROVED status

Trading errors

Error codeHTTPDescription
ORDER_NOT_FOUND404No order exists with the given orderId
INSUFFICIENT_BUYING_POWER422The account does not have sufficient funds to place this order
INVALID_ORDER_STATE422The order cannot be modified or cancelled in its current state
DUPLICATE_CLIENT_ORDER_ID409An order with this client_order_id already exists
MARKET_CLOSED422The market is closed and the order type does not support extended hours
SYMBOL_NOT_TRADABLE422The requested symbol is not available for trading

Funding errors

Error codeHTTPDescription
ACH_RELATIONSHIP_NOT_FOUND404No ACH relationship exists with the given ID
ACH_RELATIONSHIP_NOT_APPROVED422The ACH relationship has not yet been approved
INSUFFICIENT_BALANCE422The account does not have sufficient settled cash for this withdrawal
FUNDING_ACTIVITY_NOT_FOUND404No funding activity record found for the given ID

Rate limits

Buildmarkets enforces rate limits to ensure platform stability for all partners.
LimitDefault
Requests per second (per API key)10
Requests per minute (per API key)300
Requests per day (per partner)Contact your Buildmarkets representative
When you exceed a rate limit, you receive a 429 Too Many Requests response with a Retry-After header indicating how many seconds to wait before retrying:
HTTP/1.1 429 Too Many Requests
Retry-After: 2
Implement exponential backoff in your retry logic. Do not immediately hammer the API after receiving a 429.

Handling errors in practice

Always check the error code, not just the status

Use the code field in the error body for programmatic error handling.
const response = await fetch('.../orders', { method: 'POST', ... });
if (!response.ok) {
  const { error } = await response.json();
  if (error.code === 'INSUFFICIENT_BUYING_POWER') {
    // Show the user a "not enough funds" message
  } else if (error.code === 'DUPLICATE_CLIENT_ORDER_ID') {
    // This is likely a retry — fetch the existing order
  } else {
    // Log the request_id and alert your on-call team
    console.error('Unexpected error', error.request_id);
  }
}

Log request IDs

Always log the request_id from error responses. When contacting Buildmarkets support, provide this ID so the support team can trace the request through internal systems.

Retry strategy

  • 400, 401, 403, 404, 409, 422 — Do not retry. These are deterministic errors that will not resolve with a retry.
  • 429 — Retry after the Retry-After delay.
  • 500, 503 — Retry with exponential backoff (e.g., 1s, 2s, 4s, 8s). After 3–5 retries, alert your operations team.