Skip to Content
XebraDocs
Errors

Errors

Every error code the API answers with, what it means and what to do.

Every failed request answers with an RFC 9457 problem, served as application/problem+json:

{
  "type": "https://docs.xebra.exchange/errors/amount_below_minimum",
  "title": "Amount below the minimum",
  "status": 422,
  "detail": "Fees would take more than a tenth of this transfer. Send at least 2.4 USDC to Base.",
  "code": "amount_below_minimum",
  "minimum": "2.4"
}
  • code is stable. Branch on it, not on title or detail.
  • detail is a sentence written for a person. You can show it to your user as it is.
  • type is the page for that code, on this site.
  • Some codes add fields, such as minimum, maximum, have, need, total and limit. Amounts are decimal strings of USDC, like everywhere else in the API.

The SDK throws these as XebraApiError, with the extra fields on err.extra:

import { ,  } from "@xebra/sdk";

const  = ();
try {
  await .({ : "stellar", : "base", : "0.5" });
} catch () {
  if ( instanceof  && . === "amount_below_minimum") {
    .(`Send at least ${(..minimum)} USDC.`);
  }
}

The SDK adds three codes of its own, with status 0, for failures that never reached the API: network_error, timeout and invalid_response.

All codes

CodeStatusTitle
invalid_request400Invalid request
unauthorized401Unauthorized
not_found404Not found
not_ready409Not ready
already_delivered409Already delivered
invalid_amount422Invalid amount
invalid_recipient422Invalid recipient
route_unavailable422Route unavailable
amount_below_minimum422Amount below the minimum
amount_above_maximum422Amount above the maximum
insufficient_balance422Insufficient balance
fee_above_limit422Fee above your limit
transaction_rejected422Transaction would be rejected
rate_limited429Rate limited
internal_error500Internal error
upstream_unavailable503Upstream unavailable

On this page