error code. Use these codes to build reliable integrations with automatic recovery.
Error Codes
| Status | Code | Description | Recommended Action |
|---|---|---|---|
| 400 | invalid_input | Request body failed validation | Fix the request body. Check required fields and types. |
| 400 | invalid_id | Path parameter is not a valid ID | Fix the path parameter. IDs are numeric strings. |
| 401 | unauthenticated | Missing or invalid API key | Check the x-api-key header. Regenerate the key if revoked. |
| 403 | monitor_limit_reached | Plan monitor limit exceeded | Delete an existing monitor or add capacity ($10/month per extra monitor). |
| 404 | not_found | Resource does not exist | Verify the resource ID. It may belong to another account or have been deleted. |
| 409 | monitor_already_exists | Duplicate monitor for this X account | Use the existing monitor. Call Update Monitor to change event types. |
| 429 | — | Rate limited | Retry with exponential backoff. Respect the Retry-After header. |
| 500 | internal_error | Server error | Retry with backoff. Contact support if the error persists. |
| 502 | stream_registration_failed | Upstream stream registration failed | Retry the request. |
Retry with Exponential Backoff
Retry only on429 and 5xx responses. Use exponential backoff with random jitter to avoid thundering herds. Max 3 retries.
Formula: delay = baseDelay * 2^attempt + random(0, jitter)
Rate Limit Handling
When you exceed the rate limit, Xquik returns a429 Too Many Requests response with a Retry-After header indicating how many seconds to wait.
Detecting rate limits:
| Signal | Value |
|---|---|
| HTTP status | 429 |
Retry-After header | Seconds until the limit resets (e.g. 2) |
Best Practices
Distinguish client errors from server errors
Distinguish client errors from server errors
4xx errors (except 429) indicate a problem with your request. Fix the request before retrying. 5xx errors and 429 are transient — retry with backoff.
Log error codes for debugging
Log error codes for debugging
Always log the full error response including status code and error body. This makes it easy to diagnose issues in production.
Handle 409 gracefully
Handle 409 gracefully
monitor_already_exists is not a failure — the monitor you need already exists. List monitors to find it instead of treating this as an error.Set request timeouts
Set request timeouts
Set a 30-second timeout on all API requests. If a request hangs, retry it rather than waiting indefinitely.
Use idempotent operations
Use idempotent operations
Creating a monitor for the same username returns
409. Deleting a non-existent resource returns 404. Both are safe to retry.