HTTP Response Codes
The Botsi API uses standard HTTP status codes to indicate the success or failure of an API request. In general:
-
2xx codes indicate success.
-
4xx codes indicate an error caused by the information provided (e.g., a missing parameter or invalid API key).
-
5xx codes indicate an error on Botsi's servers.
Success Codes
| Code | Status | Description |
| 200 | OK | The request was successful. The response body contains the requested data. |
| 201 | Created | The request was successful and a new resource (like a Profile) was created. |
| 204 | No Content | The request was successful, but there is no representation to return (common for deletes or simple updates). |
Client Error Codes (4xx)
These errors usually require a change on your side before retrying.
| Code | Status | Description |
| 400 | Bad Request | The request was unacceptable, often due to missing a required parameter (e.g., missing profileId or an empty custom array). |
| 401 | Unauthorized | No valid API Key was provided in the Authorization header. |
| 403 | Forbidden | The API Key is valid, but it doesn't have permissions for the requested resource. |
| 404 | Not Found | The requested resource (e.g., a specific customerUserId) does not exist. |
| 422 | Unprocessable Entity | The request was well-formed but contains semantic errors (e.g., a string was provided where a number was expected). |
| 429 | Too Many Requests | You have hit the rate limit. Please slow down your requests. |
Server Error Codes (5xx)
| Code | Status | Description |
| 500 | Internal Server Error | Something went wrong on Botsi's end. |
| 503 | Service Unavailable | The server is temporarily overloaded or down for maintenance. |
Error Response Format
When an error occurs, the Botsi API returns a JSON object providing more detail about the failure. This helps your developers debug the issue quickly. Here's an example error payload:
{
"error": "Internal error",
"code": "PAYWALL_FETCH_FAILED"
}
Where:
-
error: A human-readable explanation of the error. -
code: A machine-readable string identifying the error type.