# Authentication

> For the complete documentation index, see [llms.txt](https://docs.containerfeed.com/llms.txt).

URL: https://docs.containerfeed.com/authentication

Send your key in either header:

```http
Authorization: Bearer lsk_live_…
x-api-key: lsk_live_…
```

Every `/v1/*` route needs a key except `GET /v1/carriers`.

## Without a key

`GET /v1/track/{number}` works once a day without a key, per IP address, so you can try the API. A malformed number, a failure on our side, or a `not_found` (up to 5 a day) doesn't use it up. Requests from cloud and hosting networks (AWS, Google Cloud, Azure, Alibaba Cloud, DigitalOcean, Hetzner and the like) don't get it: use a free key there. Documented example containers (such as `MSKU7812341` and `ONEU1234566`) are answered from a stored sample and don't use it up either.

Once it is used:

```json
{
  "error": {
    "code": "payment_required",
    "message": "You've used today's free lookup. Pay with MPP (see the WWW-Authenticate header): $0.50 by card for 25 tracking numbers. Or sign up for a free account.",
    "lookup_url": "https://containerfeed.com/lookup?number=MSKU7812341&autorun=1"
  }
}
```

`lookup_url` is the same lookup as a web page, for a person rather than a program: an assistant helping someone find a container can hand it over. Opening an API tracking URL in a browser goes to that page too.

## Pay per request

AI agents can pay instead of signing up, with the [Machine Payments Protocol](https://mpp.dev) (MPP), settled by Stripe. A tracking request without a key (once the free lookup is used, and always for `GET /v1/track?numbers=`) answers `402 Payment Required` with a `WWW-Authenticate: Payment` challenge. Pay and retry with `Authorization: Payment …`; any MPP client does this for you.

| Pay with | Price |
|---|---|
| A card, as a Stripe shared payment token (`stripe/charge`) | $0.50 for 25 containers or bills of lading |
| Stablecoins: USDC on Tempo (`tempo/charge`) or Solana (`solana/charge`) | 2 cents per container or bill of lading |

On Solana you pay the network fee in SOL.

The paid request spends what it looks up, and only if it gets an answer (a result, or the line saying it has no such number). What's left comes back as a credit key, in the `x-opencontainer-key` header and a `credits` field:

```json
{ "carrier": "maersk", "status": "in_transit", "…": "…", "credits": { "key": "lsk_pack_…", "remaining": 24, "note": "Send this key as an API key on later tracking requests." } }
```

Send it like an API key on later tracking requests (REST or MCP). Each response carries `x-opencontainer-credits` with what's left. Credit keys work only for tracking; when one runs out you get `402 credits_used`, and a request without the key pays again.

Paid routes and their prices are also listed for MPP clients at `https://api.containerfeed.com/openapi.json`.

## Keys

- A key is `lsk_live_` followed by 32 hex characters.
- It is shown once, when it is made. Only a hash is stored, so a lost key can't be recovered; make a new one.
- Create and revoke keys in the [dashboard](https://app.containerfeed.com/keys), or with [`POST /v1/keys`](https://docs.containerfeed.com/reference/account/createKey) and [`DELETE /v1/keys/{prefix}`](https://docs.containerfeed.com/reference/account/revokeKey). The prefix is `lsk_live_` plus the key's first 8 hex characters, e.g. `lsk_live_1a2b3c4d`.
- All keys on an account share its plan and usage.

Call the API from your server. A key in front-end code is a leaked key.

## 401 Unauthorized

```json
{ "error": { "code": "unauthorized", "message": "Invalid API key" } }
```

Returned for a missing, malformed or revoked key, or a disabled account.
