Handle Errors, Retries, and Rate Limits
Respond safely to API errors and stay within Gluecrawl's request limit.
All Gluecrawl API errors use the same JSON envelope:
{
"error": {
"code": "error_code_string",
"message": "Human-readable description."
}
}Use both the HTTP status and error.code to decide what your client should do next.
| Status | Code | What to do |
|---|---|---|
401 | invalid_api_key | Check that the Bearer token is present, valid, and not revoked. |
402 | insufficient_credits | Add credits before trying to create the job or run again. |
404 | not_found | Check the ID and account context. Resources owned by another user also return 404. |
409 | job_not_ready | Poll the job until it is ready, then create the run or schedule. |
422 | validation_error | Correct the request body and submit it again. |
429 | rate_limited | Wait for the Retry-After response header before retrying. |
For the complete API code reference, see Error Codes.
Poll status; do not guess
The normal polling workflow is itself a retry-safe way to wait for asynchronous work:
- Poll a job until it reaches
readyorfailed. - Poll a run until it reaches
completedorfailed. - Stop polling when you receive a terminal state. A failed resource needs investigation, not an endless request loop.
Use a bounded interval and a shared request budget when several jobs run concurrently.
Respect the global rate limit
All /v1/ endpoints share a limit of 60 requests per minute per API key. A rate-limited response includes a Retry-After header, expressed in seconds.
HTTP/1.1 429 Too Many Requests
Retry-After: 15When you receive 429:
- Read
Retry-After. - Wait at least that many seconds.
- Retry the request after the wait.
Coordinate polling workers behind the same API key. For example, a two-second polling interval is 30 requests per minute for one active poller before any create, list, or item requests are counted.
Treat write requests carefully
Creating a job, run, or schedule changes state. Do not blindly resend a write request after a client-side timeout or lost connection: the API may already have processed it even though your client did not receive the response.
Instead, inspect the relevant resource or list before creating another one. Once you have a job or run ID, use its status endpoint to continue the workflow.
Retry only after the cause is clear
- Retry
429after its server-provided wait period. - Correct the credentials, credit balance, input body, or job state for
401,402,422, and409rather than automatically retrying them. - Treat
404as an ID or ownership problem, not a transient failure. - For a job or run with
status: failed, inspect the returned error and decide whether a new job or rerun makes sense for your target.
This keeps retries from creating duplicate work, hiding configuration errors, or exhausting the shared rate limit.