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

# Authentication

> Authenticate requests with a Bearer token.

Obtain a token, then send it as a Bearer token on every request.

## Obtain a token

`POST /auth/tokens` with your credentials returns a short-lived JWT.

<RequestExample>
  ```bash Get a token theme={null}
  curl -X POST https://api.primefreight.com/auth/tokens \
    -H "Content-Type: application/json" \
    -d '{"username":"YOUR_USERNAME","password":"YOUR_PASSWORD"}'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 Created theme={null}
  {
    "token": "<jwt>",
    "type": "Bearer",
    "expiresIn": "2h"
  }
  ```
</ResponseExample>

## Call an endpoint

Send the token in the `Authorization` header.

<RequestExample>
  ```bash Authenticated request theme={null}
  curl https://api.primefreight.com/v2/shipments/shp_100001 \
    -H "Authorization: Bearer <token>"
  ```
</RequestExample>

## Status codes

| Code | Description                                      |
| ---- | ------------------------------------------------ |
| 200  | Request succeeded                                |
| 401  | Authentication failed — missing or invalid token |
| 404  | Resource not found                               |
| 429  | Rate limit exceeded                              |
