> ## Documentation Index
> Fetch the complete documentation index at: https://detrack.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication: Pass X-API-KEY on every Detrack API request

> Detrack API v2 authenticates every request with an API key sent in the X-API-KEY header. Learn where to get your key and how to use it.

The Detrack API authenticates every request with an API key sent in the `X-API-KEY` HTTP header. There is no OAuth flow or session; a single long-lived key represents your account.

## Get your API key

Find your API key in the Detrack dashboard under **Integrations > API Key**. Copy the key exactly as shown, with no extra spaces.

<Warning>
  Treat your API key like a password. It grants full read and write access to your Detrack account, including all jobs, depots, and routes.
</Warning>

## Send the header

Include the `X-API-KEY` header on every request:

```bash theme={null}
X-API-KEY: <YOUR_API_KEY>
```

Full example:

```bash theme={null}
curl https://app.detrack.com/api/v2/dn/jobs \
  -H "X-API-KEY: $DETRACK_API_KEY"
```

## Authentication errors

If the header is missing or the key is invalid, the API responds with `401 Unauthorized`. If the key is valid but lacks permission for the requested action, the API responds with `403 Forbidden`. See [Errors](/errors) for the full list of client error statuses.

## Best practices

* Store your API key in an environment variable or secret manager, never in source code.
* Rotate keys immediately if they may have been exposed.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.