📊 Quick Reference Table
| Code | Type | Meaning | Action Required |
|---|---|---|---|
| 200 | Success | OK | No action needed. |
| 400 | Client Error | Bad Request | Check your parameters. |
| 401 | Client Error | Unauthorized | Check your ApiKey header and value. |
| 403 | Client Error | Forbidden | No credits left or key deleted. |
| 404 | Client Error | Not Found | User/Tweet doesn’t exist or is private. |
| 429 | Client Error | Too Many Requests | You exceeded 20 req/s. Slow down. |
| 500 | Server Error | Internal Error | Something broke on our side. |
🛠 Deep Dive & Solutions
400 Bad Request
The server cannot process the request due to something that is perceived to be a client error.- Common cause: You missed a required parameter like
link,id, orquery. - Fix: Double-check the API Reference for that specific endpoint.
401 Unauthorized
Authentication failed.- Common cause: Missing
ApiKeyheader or the key is misspelled. - Fix: Ensure your header is exactly
ApiKey(case-sensitive) and your key is active in the Dashboard.
403 Forbidden
Your key is valid, but the action is not allowed.- Common cause: You have 0 credits remaining on your balance.
- Fix: Check your usage at
GET /key-usage-infoor top up your account.
404 Not Found
The requested resource does not exist.- Common cause: The X user has changed their handle, deleted their account, or the tweet was removed.
- Note: Also happens if the account is Private (Protected) — we can only access public data.
429 Too Many Requests
You hit the rate limit.- Condition: More than 20 requests in 1 second.
- Fix: Implement a small delay (
time.sleep(0.05)) in your loop. See Rate Limits for more.
🪵 Standard Error Response
When an error occurs, the API returns a JSON body to help you debug: JSON🐍 Python: Graceful Error Handling
Don’t let your script crash. Use atry-except block to handle different status codes.
Python
⏭ Next Steps
- Response Format — Understanding the structure of successful responses.
- Pagination — How to avoid errors while fetching large lists.