# Errors and routing

Check the HTTP status before processing a response. Use the `api_url` returned during authentication for every data request.

## Handle response statuses

| Status | Meaning | What to do |
|  --- | --- | --- |
| HTTP 200 | The request succeeded. | Process the response using the schema for that operation. |
| HTTP 400 | The request is invalid. | Correct the request. Do not retry the same invalid input unchanged. |
| HTTP 401 | The bearer token is invalid or expired, or the integration is not authorized. | Authenticate again and verify the integration’s approved access. Never log credentials while diagnosing the failure. |
| HTTP 503 with `DB Scaling time` | The dealership database is temporarily scaling. | Retry safe read and search requests with bounded exponential backoff and jitter. |


DX1 does not currently define a standard rate-limit response body or guarantee a `Retry-After` header. Enforce the published request limits in the client instead of depending on a particular rate-limit response.

## Use the returned API URL

Authentication returns `api_url`. Use that value for every subsequent call, read it again on token renewal, and avoid hard-coded data hosts.

Before attaching a bearer token, validate the returned URL against a host policy maintained in the trusted backend. Do not infer another data-request base URL, accept arbitrary redirect hosts, or expose the returned route in public diagnostics.

## Record failures safely

Capture the endpoint name, method, UTC timestamp, status, retry attempt, and a safe server-provided correlation identifier. Redact the authorization header, bearer token, returned route, query values containing identifiers, and request/response bodies containing dealership data.