Errors

When a request fails, you get a 4xx or 5xx status and a single error object that tells you what went wrong. Point at a member below, or select it, to see it in the example.

A failed request
{  "error": {    "type": "invalid_request_error",    "code": "parameter_unknown",    "message": "amout is not a parameter of this operation",    "param": "amout",    "doc_url": "https://docs.stridge.com/errors#parameter_unknown",    "request_log_url": "/v2/request-logs/req_0123456789abcdefghijklmn"  }}
  • The exact condition, one of the codes below. Branch on this. A code never changes meaning.
  • A human-readable explanation. Its wording can change in any release, so never branch on it.
  • The parameter, body member or header the failure is about, or null. Nested members are dotted, such as amount.decimals.
  • A link to this code's entry on this page: https://docs.stridge.com/errors#<code>.
  • Where to find the request in your request log in the dashboard. It ends in the response's Request-Id. It is null when the request carried no credential, or one the API refused.

Every member is present on every failure. A few codes add members after these, when you need more to act on the failure:

The members a few codes add
CodeAdds
payout_reference_taken

payout: the payout that already holds the reference.

settlement_retry_too_soon

retry_after: the earliest time a retry is accepted.

step_up_required

What satisfies it: methods, max_age and, for a person with no authenticator, enrolment_required. A person's session in the dashboard can meet this code.

Each operation's page lists the codes it can return and shows example error bodies.

Handling a failure

Branch on the status first, then on error.code when the body has one. That order handles every failure, including the few with an older body.

  1. Read the status

    Every failure has a 4xx or 5xx status. The status codes below say what each one means.

  2. Then read the body

    The body has error.code

    Branch on error.code. A code never changes meaning. Don't branch on message: its wording can change in any release.

    The body has no error.code

    Two kinds of failure use an older, simpler body, { "success": false, "code": <status>, "error": "<text>" }. The status tells you what happened:

    • A path that matches no operation, such as a mistyped one, returns 404 with { "success": false, "code": 404, "error": "not found" }.
    • An unexpected failure on our side returns its 5xx status, such as { "success": false, "code": 500, "error": "internal server error" }. Retry with the same Idempotency-Key. See Idempotency.
  3. Keep the Request-Id

    Every response, success or failure, has a Request-Id header: req_ followed by 24 lowercase letters and digits. Include it whenever you ask us about a request.

Status codes

The status tells you what kind of failure you have before you read the body. Each status that has error codes links to them in the catalogue below.

  • 2xxSuccess
  • 4xxRequest
  • 401, 403Auth
  • 429Rate limit
  • 5xxServer
  • 200, 201
    Success. 201 means the request created an object.
  • 204
    Success, with no body.
  • 400
    The request can't be read, or carries something the operation doesn't take. For example: an unknown parameter, a malformed header, a body that isn't valid JSON, a search query the search doesn't support, or an Idempotency-Key reused for a different request.
    6 codes
  • 401
    No credential, or one the API doesn't accept. See Authentication.
    9 codes
  • 403
    The credential isn't allowed to make this request.
    4 codes
  • 404
    One of three things. The object doesn't exist in the credential's environment: an object in your other environment returns 404 too. Or the operation isn't available to this environment. Or no operation lives at that path.
    5 codes
  • 409
    The request conflicts with the current state of an object. It also means the sandbox is being reset or set up, or an earlier request with the same Idempotency-Key is still running.
    15 codes
  • 413, 415
    The body is larger than 1 MiB, or isn't sent as application/json.
    2 codes
  • 422
    A value the operation doesn't take, or a missing required one. It also means the current state of your funds or routes can't carry out the request.
    13 codes
  • 429
    You've spent a rate budget. See Rate limits.
    3 codes
  • 503
    Something the request needs isn't available right now: a price, a route quote, or a deposit address that isn't ready yet. Retry after a short wait.
    4 codes
  • 5xx
    Something failed on our side. Retry with the same Idempotency-Key. See Idempotency.

Error codes

Here is every code the API returns, grouped by type. Search by code, title or cause, or narrow the list by type and status. Open a code to see what causes it, what to do, and which operations return it.

59 codes
invalid_request_error37
authentication_error9
  • The request carries no credential.

    Causes

    • The request has no Authorization header (missing authentication token).
    • The operation is a server's alone and the request carries a person's session rather than a secret key (secret key required).
    • The operation is the browser's alone and the request carries a person's session rather than the publishable key (publishable key required).

    What to do

    Send a bearer token in Authorization, a session token from signing in to the dashboard.

    Returned by

    Every operation.

  • The bearer token is malformed, expired, revoked, or not one this operation accepts.

    Causes

    • The access token expired (invalid or expired token).
    • The session was signed out or revoked.
    • The account the session was signed in to no longer exists (no active session).
    • A publishable key no environment holds, or one rolled past its overlap (invalid publishable key).
    • A secret key no environment holds (invalid api key).
    • A secret key that was revoked, expired, or rolled past its overlap (api key is not active).
    • A secret key sent to the API that does not serve its kind of environment, which Stridge prevents by routing a key by its prefix (sandbox api key reached the live api, live api key reached the sandbox api).

    What to do

    Refresh the session, or sign in again, and retry with the new token. For a secret key that reached the API for the other kind of environment, send it unchanged to the same base URL as every other key: Stridge routes it by its prefix, so a sandbox key reaches the sandbox and a live key reaches live.

    Returned by

    Every operation.

  • The request carries an API key where none is accepted.

    Causes

    • The operation is a person's alone, such as the account's administration (API keys, the team, environments, go-live), and does not list apiKeyAuth (api key not accepted).
    • The key holds only the scopes /v1 reads (uda, wallet, deposit and the rest), and no catalog permission (api key not accepted).
    • The key was sent in an X-API-Key header, which /v2 does not read (api key not accepted, with a hint to send it as a bearer token).

    What to do

    Send a secret key as Authorization: Bearer <key> to /v2, on an operation that lists apiKeyAuth, and mint a key holding catalog permissions for it; call a person's operation with a person's session.

    Returned by

    Every operation.

  • The request carries the environment's publishable key where none is accepted.

    Causes

    • The operation does not list publishableKeyAuth: it is a server's or a person's (publishable key not accepted).

    What to do

    Call the operation from your server with a secret key, or call one that lists publishableKeyAuth from the browser.

    Returned by

    Every operation.

  • The operation acts for one end customer and the request carries no client secret.

    Causes

    • The request sent a publishable key without X-Stridge-Client-Secret (client secret required).

    What to do

    Mint a customer session from your server (POST /customer-sessions), claim its client secret in the browser, and send the session token in X-Stridge-Client-Secret.

  • The client secret or session token is not one this environment issued.

    Causes

    • The value is unknown, malformed, or was issued for another environment (client secret invalid).

    What to do

    Fetch a fresh client secret from your server and claim it.

  • A customer session's client secret was sent where its session token belongs.

    Causes

    • A css_ client secret was sent to an operation other than the claim (client secret unclaimed).

    What to do

    Claim the client secret at POST /customer-sessions/claim and send the session token it answers.

  • The customer session has passed its expires_at.

    Causes

    • The client secret or the session token is older than the session's 30 minutes (client secret expired).

    What to do

    Fetch a fresh client secret from your server, claim it, and retry the request once.

  • A secret key was sent the way only a browser sends a credential.

    Causes

    • A secret key arrived beside X-Stridge-Client-Secret, or with a browser Origin (secret key exposed in a browser: roll it).

    What to do

    Roll the key now: it has been exposed. Call /v2 from the browser with the publishable key and a client secret, and keep secret keys on your server.

permission_error4
idempotency_error2
rate_limit_error3
api_error4
  • The deposit address exists but could not yet be readied to detect deposits, so it is not answered.

    Causes

    • Registering the address for deposit detection failed for a moment (uda address not ready for deposits).

    What to do

    Wait the seconds Retry-After names, then retry the same request. The retry answers the address, with 200, once it detects deposits.

  • The sandbox has no deposit address ready to hand out yet.

    Causes

    • A sandbox made moments ago has not derived its deposit addresses yet (uda wallet pool exhausted).

    What to do

    Wait the seconds Retry-After names, then retry with the same Idempotency-Key.

  • The asset is one Stridge prices, and it cannot price it right now.

    Causes

    • The price source Stridge relays did not answer for the symbol (price temporarily unavailable).

    What to do

    Retry later. A screen pricing many assets reads the batch, which answers usd_price null for such an asset instead.

  • No provider can quote the route right now.

    Causes

    • Every bridge and swap provider that carries the route failed to answer (upstream unavailable).

    What to do

    Retry later; nothing was reserved by the failed quote.