API Error Codes: Troubleshooting 400, 401, 403, 429, and 500 Responses
When a request fails, Sorsa API returns a standard HTTP status code and a JSON body with amessage field describing the problem. This page covers every error code you may encounter, what causes it, and how to resolve it.
Error response format
All error responses follow the same structure:message field contains a human-readable description of the error. Always check this field first when debugging - it often points directly to the problem.
Quick reference
| Code | Type | Meaning |
|---|---|---|
| 200 | Success | Request completed successfully |
| 400 | Client error | Bad request - invalid or missing parameters |
| 401 | Client error | Unauthorized - authentication failed |
| 403 | Client error | Forbidden - valid key but no access or credits |
| 404 | Client error | Not found - resource does not exist or is private |
| 429 | Client error | Too many requests - rate limit exceeded |
| 500 | Server error | Internal error - something went wrong on our side |
400 Bad Request
The request could not be processed because of invalid or missing parameters. Common causes:- A required parameter is missing (for example,
link,id,username, orquery) - A parameter value has the wrong type or format (for example, passing a string where a number is expected)
- The JSON body in a POST request is malformed or empty
Content-Type is set to application/json and the body is valid JSON.
401 Unauthorized
Authentication failed. The API could not identify your account. Common causes:- The
ApiKeyheader is missing entirely - The header name is misspelled (it is case-sensitive -
ApiKey, notApi-Key,apikey, orapi_key) - The API key value is incorrect, was copied with extra whitespace, or belongs to a deleted key
ApiKey: your_key_here. Check that the key is still active in your Dashboard. If in doubt, copy the key directly from the dashboard and paste it into your code. For more details, see Authentication.
403 Forbidden
Your API key is valid, but the request was rejected. Common causes:- Your request quota is exhausted (0 requests remaining)
- Your subscription has expired
GET /key-usage-info or by visiting your Dashboard. If your requests are depleted, top up your account or upgrade your plan on the Billing page.
404 Not Found
The requested resource does not exist. Common causes:- The X user has changed their username, deleted their account, or been suspended
- The tweet has been deleted by the author
- The account or tweet is private (protected) - Sorsa API can only access public data
- The endpoint URL itself is incorrect
/username-to-id to resolve the current mapping.
429 Too Many Requests
You have exceeded the rate limit of 20 requests per second. Common causes:- Sending requests in a tight loop without any delay
- Running multiple parallel workers that share the same API key
500 Internal Server Error
Something went wrong on our side. What to do:- Retry the request after a short delay (1-2 seconds). Transient 500 errors often resolve themselves.
- If the error persists across multiple retries or affects multiple endpoints, check the Sorsa Status Page for ongoing incidents.
- If the problem continues, contact support at [email protected] or on Discord with the endpoint URL, request body, and approximate timestamp.
Handling errors in code
A resilient integration should handle all error codes gracefully instead of crashing on unexpected responses. Here is a reusable pattern for both Python and JavaScript. Python429 and 500 (these are transient), but fail immediately on 400, 401, 403, and 404 (these require a code or configuration fix).
Next steps
- Rate Limits - Detailed strategies for staying within the 20 req/s limit
- Pagination - How to fetch large datasets without errors
- API Reference - Full endpoint list with parameter schemas