IPRout

JSON Error Response Schema

IPRout uses HTTP status codes to distinguish authentication, validation, capacity, and server failures, with a JSON error message in the response body. Clients should branch on status before decoding a success schema, preserve a safe diagnostic message, and avoid retrying errors that require changed credentials, input, or capacity.

Last updated September 12, 2026

How is an error different from success?

A lookup success contains IP intelligence fields, while an error contains a human-readable error value. Do not deserialize every body directly into IpInfo and then infer failure from missing country data. Status-first parsing creates clearer code and preserves nullable success fields.

Which errors are permanent?

HTTP 401 remains until authentication is corrected, HTTP 422 remains until the explicit address changes, and HTTP 429 generally remains until capacity resets or account/key configuration changes. Immediate retries waste resources. Network failures and HTTP 500 can be retried cautiously with a strict limit.

What should application errors expose?

Return a stable internal error category to calling code and log the upstream status with secret redaction. Avoid showing raw infrastructure details to end users. Include enough route and timing context for support, but do not log Authorization, X-API-Key, or more IP information than the incident requires.

How should safe error-body parsing be implemented?

Decode errors into a small status-plus-message model before mapping them to application categories. Do not attempt to parse a failed lookup as an IpInfo object with missing fields. Keep this responsibility close to the IPRout client so the behavior documented in JSON Error Response Schema remains consistent across web requests, workers, and scheduled jobs.

How should safe error-body parsing be verified?

Test documented JSON errors, an empty body, malformed JSON, and an HTML response from a proxy. The client should preserve a safe diagnostic while avoiding secondary parser exceptions. Automate the stable cases and reserve live checks for controlled environments so verification is repeatable without consuming unnecessary production allowance.

How should safe error-body parsing be operated?

Expose stable internal categories to product code and retain sanitized upstream detail for support. Keep credentials and excessive IP data out of exception messages and traces. Write down the owner and expected behavior so an alert or product change can be handled without reconstructing the original integration decisions.

Where does safe error-body parsing stop?

The human-readable error may improve diagnosis, but application behavior should primarily follow the HTTP status. Messages can evolve without becoming a machine-readable control contract. Treat that limit as part of the feature contract and direct callers to the related guide when they need a different guarantee or control.

What belongs in the release review for safe error-body parsing?

Review the deployed implementation of JSON Error Response Schema, not only a local sample. Confirm the intended endpoint, credential source, timeout, response model, and fallback from the environment that will carry real traffic. Use the verification cases above as release evidence, inspect generated browser assets and logs for secret exposure, and make sure dashboards identify the workload without storing raw credentials or unnecessary IP data. Record the configuration owner and rollback action before enabling the feature broadly.

When should safe error-body parsing be revisited?

Revisit safe error-body parsing when traffic volume, plan capacity, application ownership, deployment regions, browser origins, data retention, or the product consequence of a lookup changes. Compare the current implementation with the documented operating boundary rather than assuming the original decision still fits. Update tests and internal runbooks together, then verify the public API contract and related IPRout guides before rolling the change across every service that shares the client or account.

External references

Continue with the standards and official documentation most relevant to this guide.

Continue building with IPRout

Test the API, browse runnable examples, or return to the documentation directory.