Skip to main content

API Response Codes

The Yahini API uses standard HTTP status codes to indicate the success or failure of a request. This guide provides an overview of the common response codes you will encounter.

Success Responses

Successful responses are indicated by 2xx status codes. The status field in the JSON body will always be "success".

CodeMeaningDescription
200OKThe request was successful, and the response body contains the requested data.
202AcceptedThe request has been accepted for processing, but the processing has not been completed. This is used for asynchronous operations.

Example Success Response

{
"status": "success",
"data": {
"some_key": "some_value"
}
}

Error Responses

Error responses are indicated by 4xx and 5xx status codes. The status field in the JSON body will be either "fail" for client-side errors or "error" for server-side errors. The body will also contain a message field with a description of the error.

Client Errors (4xx)

CodeErrorDescription
400Bad RequestThe request could not be understood or was missing required parameters.
401UnauthorizedThe request requires user authentication.
403ForbiddenThe server understood the request, but is refusing to fulfill it.
404Not FoundThe requested resource could not be found.
429Too Many RequestsThe user has sent too many requests in a given amount of time.

Server Errors (5xx)

CodeErrorDescription
500Internal Server ErrorA generic error message, given when an unexpected condition was encountered.
503Service UnavailableThe server is currently unable to handle the request.

Example Error Response

{
"status": "fail",
"message": "The requested resource could not be found."
}