# Authentication

Use this page to exchange a dealership-controlled access key for the bearer token and routing value required by data requests. Perform the exchange only from a trusted backend after the dealership has authorized the integration and the key’s environment is known.

## Token request

Send the following request from a trusted backend:

```http
POST https://api.dx1app.com/api/Authentication/ValidateAccessKey
Accept: application/json
Content-Type: application/x-www-form-urlencoded
Authorization: Basic <BASE64_ENCODED_DEALERSHIP_API_KEY>
```

The request has no body parameters. Base64-encode the dealership API key before placing it after the `Basic` scheme. Do not send the unencoded key in examples, URLs, query strings, browser code, or logs.

## Successful response

A successful response contains:

```json
{
  "access_token": "<BEARER_TOKEN>",
  "token_type": "bearer",
  "expires_in": 1800,
  "api_url": "<DEALERSHIP_API_BASE_URL>"
}
```

- `access_token` authorizes subsequent data requests.
- `token_type` is documented as `bearer`.
- `expires_in` is 1,800 seconds, or 30 minutes.
- `api_url` is the base URL for subsequent data requests.


Do not add form fields to the token request. DX1 assigns data access during vendor approval; there is no default public scope list.

## Token lifecycle

1. Obtain the token shortly before it is needed.
2. Keep the token and `api_url` in protected server-side memory or an approved secure store.
3. Send `Authorization: Bearer <BEARER_TOKEN>` on data requests.
4. Before or when the 30-minute lifetime ends, authenticate again and re-read both `access_token` and `api_url`.
5. Do not assume the previous `api_url` remains unchanged after renewal.


Do not log the Basic header, bearer token, or returned `api_url`. Validate the returned host against the routing policy maintained by your organization before attaching the bearer token.

## Key inactivity policy

Beginning July 1, 2025, DX1 deactivates a key after 30 consecutive days with no successful authentication or data request. A deactivated key cannot be reactivated; request a replacement through DX1 Support.

Use a legitimate integration health check or normal data activity to monitor a low-traffic integration. Do not generate artificial traffic solely to evade an access policy, and do not exceed the dealership-level limits.

See [Authentication examples](/docs/dx1-dealership-api/examples/authentication) for non-executed placeholder code.