Skip to main content

Error format

All errors follow a consistent envelope:
{
  "error": {
    "code": "account_not_found",
    "message": "Account not found.",
    "requestId": "req_abc123"
  }
}
FieldDescription
codeMachine-readable error code. Use this for programmatic handling.
messageHuman-readable description. Intended for developers, not end users. Messages may change without notice.
requestIdUnique request identifier. Include this when contacting support.

HTTP status codes

StatusMeaning
400Bad request — invalid syntax, missing required fields, or validation failure.
401Unauthorized — missing or invalid API key.
403Forbidden — the API key is valid but lacks permission for this action.
404Not found — the requested resource does not exist, or does not belong to your organization.
409Conflict — the action conflicts with the resource’s current state (e.g., archiving an already-archived beneficiary, executing an expired quote).
500Internal error — something went wrong on our end. Retry the request.
502Upstream error — a dependent service failed (e.g., blockchain node). Retry the request.

Error codes

Authentication

CodeHTTPDescription
missing_api_key401No Authorization header, or it doesn’t start with Bearer .
invalid_api_key401The key doesn’t exist or has been revoked.
authentication_failed401Key verification failed due to a server error. Retry.
forbidden403API key is valid but not authorized for this action.

Resource lookup

CodeHTTPDescription
not_found404Generic resource not found.
organization_not_found404Organization does not exist.
account_not_found404Account does not exist or does not belong to your organization.
quote_not_found404Quote does not exist.
beneficiary_not_found404Beneficiary does not exist or does not belong to the specified account.

Business logic

CodeHTTPDescription
quote_expired409The quote has expired. Create a new one.
quote_already_used409The quote has already been executed.
beneficiary_already_archived409The beneficiary is already archived.
insufficient_funds400The account does not have enough balance for this operation.

Validation and system

CodeHTTPDescription
validation_error400Request body failed validation. Check the message for details.
invalid_request400The request is malformed or contains invalid parameters.
chain_send_failed502The on-chain transaction could not be submitted.
internal_error500Unexpected server error. Retry the request.

Handling errors

const response = await fetch('https://api.sandbox.nxos.io/v1/quotes', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer nxos_sk_test_...',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ /* ... */ }),
});

if (!response.ok) {
  const { error } = await response.json();

  switch (error.code) {
    case 'insufficient_funds':
      // Handle insufficient balance
      break;
    case 'validation_error':
      // Handle invalid input
      break;
    default:
      // Log requestId for debugging
      console.error(`API error: ${error.code} (${error.requestId})`);
  }
}
Always include the requestId when reporting issues. It lets us trace the exact request through our systems.