Guides
Errors and retries
Every failure has a stable error code, an HTTP status and a clear billing rule. Retry only what is safe to retry.
Read lookupStatus first
A 200 response can still be a miss. lookupStatus is found or not_found. A found result carries data; a not_found result is explicit, billed once, and cached briefly so the same miss does not bill again.
HTTP and error codes
400 invalid_body or missing_parameter means the request was malformed and nothing was charged. 401 unauthorized means the key is missing or inactive. 402 plan_required or free_tier_exhausted means the plan or daily cap blocked the call before any provider work. 404 not_found means no endpoint matches the path. 429 rate_limited includes Retry-After. 503 upstream_not_configured marks a mapped operation whose adapter is not connected yet.
What is billed
A successful extraction and a verified not_found are billed. Validation errors, auth errors, plan and free-cap rejections, rate limits, upstream 5xx, network failures, cache hits and unconnected mapped routes cost 0 credits. meta.creditsCharged is authoritative.
Safe retry policy
Retry 429 after Retry-After and 5xx with exponential backoff; neither charges. Do not retry 400, 401 or 402 without changing the request or the plan. A not_found will not become found by retrying the same public URL within the cache window.
Debugging checklist
Confirm the key with GET /v1/whoami, confirm the path on its endpoint page, then reproduce with one curl call. The requestId in meta and the error body is the same id used in support and in the API usage log.
Check the account
curl -s https://api.cleanfetch.dev/v1/whoami \
-H "x-api-key: $CLEANFETCH_API_KEY"Check the catalog
curl -s https://api.cleanfetch.dev/v1/ask \
-H "x-api-key: $CLEANFETCH_API_KEY" \
-H "content-type: application/json" \
-d '{"query":"hacker news top"}'