Read status and response together#
Check HTTP status before treating a body as a successful result. The public health/404 responses and portal client use success and message; not every endpoint publishes a formal error-body schema. Keep a fallback for non-JSON or incomplete responses.
{
"success": false,
"message": "Illustrative error description",
"error": "Illustrative error detail"
}Status handling guide#
| Status | Typical next step | Retry automatically? |
|---|---|---|
| 400 | Correct the documented request validation problem. | No. |
| 401 | Check credential type, expiry, active state and ownership. | Not with the same invalid credential. |
| 402 | Email lookup: review available credits. | No, until account state changes. |
| 403 | IP lookup: check the configured browser Origin. | Not until the restriction mismatch is resolved. |
| 404 | Check the route or account-owned resource identifier. | Usually no. |
| 409 | Check operation-specific conflicts such as existing account state. | Resolve the conflict first. |
| 429 | Reduce traffic and inspect any actual response guidance. | Use a bounded policy, after considering duplicate lookup effects. |
| 502 / 503 / 504 | Provider failure, availability or timeout as documented per endpoint. | Potentially transient; do not replay charged operations blindly. |
Rate-limit boundaries#
The IP lookup and several authentication operations declare 429. A fixed requests-per-second quota and guaranteed rate-limit header set are not published in this contract. Do not document a made-up number or assume a Retry-After header is always present.
Design bounded retries#
- Classify validation/authentication problems separately from temporary failures.
- Set your own connection and total-request timeouts.
- Respect Retry-After if the actual response provides it.
- Use backoff with jitter and a strict maximum for safe retry cases.
- For an ambiguous lookup, inspect usage before replaying it.
- Stop retrying when the account or credentials require a human/configuration change.