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"
.
Code | Meaning | Description |
---|---|---|
200 | OK | The request was successful, and the response body contains the requested data. |
202 | Accepted | The 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
)
Code | Error | Description |
---|---|---|
400 | Bad Request | The request could not be understood or was missing required parameters. |
401 | Unauthorized | The request requires user authentication. |
403 | Forbidden | The server understood the request, but is refusing to fulfill it. |
404 | Not Found | The requested resource could not be found. |
429 | Too Many Requests | The user has sent too many requests in a given amount of time. |
Server Errors (5xx
)
Code | Error | Description |
---|---|---|
500 | Internal Server Error | A generic error message, given when an unexpected condition was encountered. |
503 | Service Unavailable | The server is currently unable to handle the request. |
Example Error Response
{
"status": "fail",
"message": "The requested resource could not be found."
}