Errors

Learn more about error codes and how to resolve them.

Ajaib uses conventional HTTP response codes to indicate the success or failure of an API request. In general: codes in the 2xx range indicate success. Codes in the 5xx range indicate an error with Ajaib's servers.

Errors to bad requests respond with codes in the 4xx range. Typically, this indicate an error which failed given the information provided (e.g., a required parameter was omitted, insufficient wallet balance, etc).

Such errors include a body that contains a message parameter which further indicates the specific cause. Your program should be configured to read the message field from the body so errors could be handled programmatically

Response Codes

200

OK

Everything worked as expected. May contain an optional body. If the response has a body, it is documented under each page.

400

Bad Request

The request was unacceptable, often due to missing a required parameter.

401

Unauthorized

No valid API key provided.

402

Request Failed

The parameters were valid but the request failed.

403

Forbidden

The API key doesn't have the permissions to perform the request.

404

Not Found

The requested resource doesn't exist.

409

Conflict

The request conflicts with another request (perhaps due to using the same idempotent key).

429

Too Many Requests

Too many requests hit the API too quickly. Use an exponential backoff on your request.

500, 502, 503, 504

Server Errors

Something went wrong on Ajaib's end.

Error Body Sample

{
    "error": "invalid_request" 
}

Error Messages

Enum
Cause

invalid_request

Invalid request means your request has missing required or invalid parameters.

invalid_client

Invalid authorization

insufficient_wallet

Insufficient balance in the exchange client's wallet

api_error

API errors cover any other type of problem e.g. a temporary problem with Ajaib's servers.

Last updated