Reference
HTTP Status Codes
Complete reference for all HTTP status codes returned by the KLOAKD API
5 min read
The KLOAKD API uses standard HTTP status codes. Error responses carry a JSON body with a detail field (below).
2xx - Success
| Code | Meaning | When returned |
|------|---------|---------------|
| 200 OK | Request handled | Successful GET, POST responses. A fetch or extraction that could not get the page is also 200, with success: false and the reason in error: check success |
| 202 Accepted | Job enqueued | Async job creation, or a synchronous request still running at its limit (fetch); returns job_id |
4xx - Client Errors
| Code | Meaning | When returned |
|------|---------|---------------|
| 400 Bad Request | Invalid request, URL_NOT_ALLOWED | Malformed request. URL_NOT_ALLOWED: the start page of a crawl or crawl-extract job is not a public web address (a loopback, private or link-local address, a cloud metadata host, or a name that resolves to one); nothing is recorded, queued or fetched |
| 401 Unauthorized | unauthorized, invalid_api_key, expired_api_key | No Authorization header, or a revoked, invalid or expired key |
| 402 Payment Required | payment_required | A paid plan whose last payment failed; settle it in Settings → Billing |
| 403 Forbidden | forbidden, not_entitled, tier_access_denied | The org_id in the URL is not your API key's organization (IDOR protection), the plan doesn't include the module, or the feature needs another plan |
| 404 Not Found | Resource does not exist | Job or crawl not found or expired (handed-off jobs after 1 hour, a crawl's pages after 2 hours), unknown endpoint |
| 409 Conflict | concurrent_limit, restart_not_supported, ROBOTS_DISALLOWED | ROBOTS_DISALLOWED: the site's robots.txt stopped the request and nothing was fetched; send it again with the host in robots_acknowledged_hosts to go on (robots.txt). concurrent_limit: all of your plan's work slots are in use, on a route that cannot queue: refused at once on Free, and after a wait of up to 10 seconds on a paid plan (a fetch or an extraction is queued instead: concurrent work); the body has concurrent_limit, active_crawls and active_requests. restart_not_supported: POST …/jobs/{job_id}/restart; a job cannot be restarted, so submit the request again. A 409 is also the answer to a cancel of a crawl already cancelled, a continue of a crawl that cannot be continued, and a resume of a login session that is not paused |
| 422 Unprocessable Entity | Validation failed | The request body failed validation: missing required fields, wrong types or out-of-range values. It is not a fetch failure |
| 429 Too Many Requests | gb_exhausted, rate_limited or queue_full | GB allocation used up (not retried), the test key's quota used up, gb_exhausted with reason test_key_daily_budget_used: the anonymous test keys have used their shared 10 GB for the UTC day (not retried; Retry-After runs to 00:00 UTC), a request-rate limit where one applies (see Retry-After), or queue_full: all of your work slots are in use and too many of your requests are already waiting for one (Retry-After: 30) |
5xx - Server Errors
| Code | Meaning | When returned |
|------|---------|---------------|
| 500 Internal Server Error | Unexpected server fault | A bug — contact support. detail is a fixed text that names the step (for example Analysis failed, or An internal server error occurred), never the fault's own message, which is logged on our side |
| 502 Bad Gateway | The request could not be run | The job could not be started or dispatched; detail is a fixed text such as Fetch failed, without the cause. A target site that refuses the fetch is reported as 200 with success: false, not 502, except a Level 2 extraction whose browser fetch got no page (extract errors) |
| 503 Service Unavailable | billing_unavailable, ROBOTS_CHECK_UNAVAILABLE, crawler_task_not_run, or the API is unavailable | Usage could not be checked (retry after Retry-After), maintenance or overload. crawler_task_not_run: a Fetchyr login or form call did not run to its end on a crawler; detail.reason says why and detail.message is the text (Fetchyr). ROBOTS_CHECK_UNAVAILABLE: KLOAKD could not check the site's robots.txt (reason: exits_refused when every exit refused to connect to the site); not a stop, nothing to acknowledge, retry after Retry-After (robots.txt) |
| 504 Gateway Timeout | Upstream response too slow | Target site took too long to respond |
Error response body
{
"detail": {
"error": "rate_limited",
"message": "Rate limit exceeded",
"retry_after": 42,
"reset_at": "2026-10-28T10:15:00Z"
}
}
detail.error names the case: URL_NOT_ALLOWED, unauthorized, invalid_api_key, expired_api_key, forbidden, not_entitled, tier_access_denied, test_key_not_allowed, concurrent_limit, restart_not_supported, payment_required, gb_exhausted, rate_limited, queue_full, billing_unavailable or crawler_task_not_run. Some errors (a 404, a 502) carry a plain string in detail instead. A 422 carries FastAPI's list of validation errors in detail.
Retry behaviour
The SDKs retry 429 rate_limited and 503 billing_unavailable on any method, and 500, 502, 503, 504 and network errors only for GET, HEAD and DELETE (a POST may already have done the work), with exponential backoff: 1 s, 2 s, 4 s … capped at 60 s, or the Retry-After the API sent. 429 gb_exhausted, a test key's used-up quota, 400, 401, 402, 403, 404, 409 and 422 are not retried.
Configure via max_retries (default 3):
client = Kloakd(api_key="...", organization_id="...", max_retries=2)
const client = new Kloakd({ apiKey: '...', organizationId: '...', maxRetries: 2 });
Kloakd client = Kloakd.builder()
.apiKey("...")
.organizationId("...")
.maxRetries(2)
.build();
Rate limit headers
Where a request-rate limit applies, responses carry:
| Header | Description |
|--------|-------------|
| X-RateLimit-Limit | Requests allowed per window |
| X-RateLimit-Remaining | Requests left in current window |
| X-RateLimit-Reset | Unix timestamp when the window resets |
| Retry-After | Seconds to wait (only on 429) |
A 429 gb_exhausted carries X-GB-Used, X-GB-Limit and X-GB-Remaining instead. Test-key requests carry X-Quota-Used, X-Quota-Limit and X-Quota-Remaining.
