Error Response Format
Every failed request returns a JSON object with anerror field containing three properties.
Error response body
HTTP Status Code Reference
Common Error Types
authentication_error (401)
authentication_error (401)
Your request did not include a valid API key. Make sure you are passing the key in the
Authorization header as Bearer YOUR_API_KEY. Keys are available from the API Keys page in your dashboard.invalid_request_error (400 / 422)
invalid_request_error (400 / 422)
Something about the structure or values in your request is wrong. The
error.message field describes the problem precisely — for example, a missing required field or a parameter value outside the allowed range.rate_limit_error (429)
rate_limit_error (429)
You have sent too many requests in a short window. Check the
Retry-After response header for the number of seconds to wait before retrying. Implement exponential backoff to avoid hammering the API after the window resets.server_error (500 / 503)
server_error (500 / 503)
An error occurred on Swytcho’s infrastructure. These are rare and typically transient. Retry the request with exponential backoff. If the problem persists for more than a few minutes, check status.swytcho.com or contact support.
Error Handling Best Practices
Follow these practices to make your integration resilient and easy to debug. Retry transient errors with backoff. Network hiccups and5xx errors are often temporary. Retry up to three times using exponential backoff (e.g. wait 1 s, then 2 s, then 4 s) before surfacing an error to users.
Never retry 4xx errors blindly. A 400, 401, 403, or 422 indicates a problem with your request. Retrying without fixing the underlying issue wastes quota. Log the full error body and fix the root cause.
Log error.code and error.message. Store both fields in your application logs so you can debug production issues without reproducing them locally.
Show user-friendly messages. Translate API error codes into plain-language messages for end users — they should not see raw JSON or HTTP status codes.