Skip to content

Status Codes, Errors

Gainly uses standard HTTP response status codes to indicate the success or failure of an API request.

Success Status Code

Successful responses will have an HTTP status code of 200 - any other status code indicates the failure of an API request.

Error Status Codes

Code Summary Details
400 Bad Request API request was unacceptable (incorrect syntax, parameters, etc.). Error message will include more details.
401 Unauthorized API key is missing, or is invalid.
402 Payment Required Payment is required before the API request can be processed (more details).
403 Forbidden Access to the resource is not allowed. This is usually due to the API key being restricted from performing the request.
404 Not Found Requested resource doesn't exist. This is usually due to incorrect endpoint or ID values in the API request.
405 Method Not Allowed Incorrect HTTP method used in the API request. This is usually caused by mixing up the HTTP method (for example, GET vs. POST) in the API request.
409 Conflict Request could not be completed due to a conflict with the current state of the target resource. Example: Attempting to add a document with an ID that already exists.
422 Unprocessable Entity Data in the API request is invalid (incorrect format, missing parameters, etc.). Error message will include specific details.
429 Too Many Requests Too many API requests over a given time period. This is caused when you exceed the rate limits.
500, 502, 503, 504 Server Errors Gainly server errors, these are rare. We monitor these errors and release fixes. We encourage you to submit a report as well.

Error Types

Type Details
invalid_request_error Error caused by an invalid API request.
response_error Request is valid, but API response encountered an error condition.
search_engine_error Error returned by the search engine (bad requests, etc.)
model_engine_error Error returned by the model engine (bad requests, etc.)
server_error Something went wrong on the server. Please submit a report.

Error Response Format

{
    "error": {
        "message": "body -> query: String should have at least 1 characters. Please verify and retry. Visit https://docs.gainly.ai for details, or contact us at https://gainly.ai/support.",
        "type": "invalid_request_error"
    }
}