Skip to main content
The AnySpend Platform API uses a consistent, structured error format across all endpoints. Errors follow the Stripe convention — a JSON object with an error key containing the type, code, human-readable message, and (where applicable) the parameter that caused the error.

Error response format

Every error response has this shape:

Error types

Error types group errors into broad categories. Use these for top-level error handling.

Error codes

Error codes provide specific, machine-readable identifiers for each error condition.

Request validation errors

Authentication and authorization errors

Resource errors

Rate limiting and idempotency errors

Server errors

HTTP status codes

Example error responses

Missing required field

Invalid Ethereum address

Authentication failure

Insufficient permissions

Resource not found

Rate limit exceeded

Idempotency conflict

Handling errors in code

TypeScript / JavaScript

Python

Best practices

Use error.type for broad control flow (e.g., retry on rate_limit_error, fail fast on authentication_error). Use error.code for specific handling within a type.
When error.param is present, you can map it directly to a form field to show inline validation errors in your UI.
rate_limit_error and api_error (500) are transient. Use exponential backoff when retrying:
Client errors like 400, 401, 403, and 404 will not resolve on retry. Fix the request or credentials before retrying.
Always log error.type, error.code, error.message, and error.param together. This gives you the full picture when debugging production issues.