# Tracking

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

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

## One number

```bash tab="curl"
curl https://api.containerfeed.com/v1/track/MSKU7812341 \
  -H "Authorization: Bearer $OPENCONTAINER_API_KEY"
```

```js tab="JavaScript"
const res = await fetch("https://api.containerfeed.com/v1/track/MSKU7812341", {
  headers: { Authorization: `Bearer ${process.env.OPENCONTAINER_API_KEY}` },
});
if (!res.ok) throw new Error((await res.json()).error.message);
const container = await res.json();
```

```python tab="Python"
import os, requests

res = requests.get(
    "https://api.containerfeed.com/v1/track/MSKU7812341",
    headers={"Authorization": f"Bearer {os.environ['OPENCONTAINER_API_KEY']}"},
)
res.raise_for_status()
container = res.json()
```

Returns a [tracking result](#the-response), or an [error](https://docs.containerfeed.com/errors): `404 not_found` when the line has no record of the number, `400 unknown_carrier` when no line's prefix matches (or the check digit is wrong) and no `carrier` was given.

The lookup is synchronous: the answer comes back in the same request, usually within a few seconds. Results are cached for 5 minutes (a day once the empty container is returned), and `x-cache` says whether this one came from cache (`HIT`) or from the line (`MISS`). A `not_found` is cached for 5 minutes.

## Several numbers

`GET /v1/track?numbers=a,b,c` takes up to 100 numbers, at most 35 for any one line. Containers from different lines can be mixed; duplicates are removed.

```bash tab="curl"
curl "https://api.containerfeed.com/v1/track?numbers=MSKU7812341,MEDU1234562,ONEU1234566" \
  -H "Authorization: Bearer $OPENCONTAINER_API_KEY"
```

```js tab="JavaScript"
const numbers = ["MSKU7812341", "MEDU1234562", "ONEU1234566"];
const res = await fetch(`https://api.containerfeed.com/v1/track?numbers=${numbers.join(",")}`, {
  headers: { Authorization: `Bearer ${process.env.OPENCONTAINER_API_KEY}` },
});
const { results } = await res.json();
```

```python tab="Python"
import os, requests

res = requests.get(
    "https://api.containerfeed.com/v1/track",
    params={"numbers": ",".join(["MSKU7812341", "MEDU1234562", "ONEU1234566"])},
    headers={"Authorization": f"Bearer {os.environ['OPENCONTAINER_API_KEY']}"},
)
results = res.json()["results"]
```

```json
{
  "results": [
    { "trackingNumber": "MSKU7812341", "result": { "carrier": "maersk", "status": "delivered", "events": [] } },
    { "trackingNumber": "MEDU1234562", "result": { "carrier": "msc", "status": "in_transit", "events": [] } },
    { "trackingNumber": "TGHU9123451", "error": { "code": "unknown_carrier", "message": "It is a shipping container number owned by a leasing company or a line we don't detect: pass ?carrier= with the shipping line …" } }
  ]
}
```

- One entry per number, in the order sent, each with `result` (the same shape as a single lookup) or `error`. One bad number never fails the others.
- The call returns `200` unless it is malformed (`400`), unauthorized (`401`) or has no room left on the Free plan (`429`).
- The response comes back when every number has an answer. Each line's numbers are looked up together.
- `x-cache-hits` is how many numbers came from cache.
- On paid plans, `x-opencontainer-numbers-used`, `x-opencontainer-numbers-included` and `x-opencontainer-overage` give the period's count, and a `notice` appears near or past the included containers. See [Plans](https://docs.containerfeed.com/plans#past-the-included-containers).

For a spreadsheet of thousands, see [Bulk container tracking](https://docs.containerfeed.com/bulk-container-tracking-batch-api).

## Line detection

A container number (ISO 6346) is a three-letter owner code, the equipment category `U`, six serial digits and a check digit: `MSKU 781234 1`. The check digit is verified first, so a typo is turned away with `unknown_carrier` before any line is asked, and the owner prefix picks the line. `MSKU7812341` goes to Maersk and `MEDU1234562` to MSC with no `carrier`. Every line's prefixes are in [Carriers](https://docs.containerfeed.com/carriers).

**One line per number.** Detection picks exactly one line and never falls back to another. If that line has no record, the answer is `not_found`.

Pass `carrier` to choose the line yourself:

```bash
curl "https://api.containerfeed.com/v1/track/TGHU9123451?carrier=msc" \
  -H "Authorization: Bearer $OPENCONTAINER_API_KEY"
```

Use it for:

- **bills of lading and booking numbers**, which have no owner prefix or check digit (see [below](#bills-of-lading));
- **leased containers** (Textainer `TGHU`, Triton `TCNU` and `TRHU`, CAI `CAIU`, SeaCo `SEGU` and others), which sail with any line;
- **shipper-owned containers**, whose prefix belongs to the shipper;
- a line's container under a prefix that isn't detected.

On the batch route, `carrier` applies to every number. Carrier ids come from [`GET /v1/carriers`](https://docs.containerfeed.com/carriers#carrier-ids).

## Bills of lading

A bill of lading (B/L) is the line's B/L prefix, usually its SCAC, followed by its booking reference, for example `MAEU…` for Maersk or `HLCU…` for Hapag-Lloyd. Track it with the line named:

```bash
curl "https://api.containerfeed.com/v1/track/$BILL_OF_LADING?carrier=maersk" \
  -H "Authorization: Bearer $OPENCONTAINER_API_KEY"
```

The result has the same shape as a container's. When the line reports them, `ocean.billOfLading` is the bill and `ocean.containers` lists the containers on it; track or [watch](https://docs.containerfeed.com/webhooks) each one for its own moves. A bill of lading counts as one tracked number, like a container.

## Statuses and milestones

Every result has a `status`, and so does each event. A container's trip maps onto it like this:

| `status` | Container trip |
|---|---|
| `label_created` | Booking made or the empty container released to the shipper |
| `in_transit` | Full container received at the origin terminal, loaded, sailing, transshipped, discharged, waiting at the destination terminal |
| `out_for_delivery` | Full container out of the destination terminal to the consignee |
| `delivered` | Empty container returned: the trip is over |
| `exception` | A customs or freight hold, or another problem the line reports |
| `returned` | The line reports the cargo going back to the shipper |
| `unknown` | The line gave no status that could be read |

The lines don't report when the consignee unloads the cargo, so `delivered` means the empty box is back. Watch for `out_for_delivery` to know when the cargo left the port.

When the line's move is recognized, the event also has a normalized `milestone`:

| `milestone` | Move |
|---|---|
| `booking_confirmed` | Booking confirmed |
| `empty_pickup` | Empty container picked up by or released to the shipper |
| `gate_in` | Full container gated in at the origin terminal |
| `loaded` | Loaded on the vessel |
| `vessel_departed` | Vessel departed the port of loading |
| `transshipment_arrived` | Arrived at a transshipment port |
| `transshipment_departed` | Departed a transshipment port |
| `vessel_arrived` | Vessel arrived at the port of discharge |
| `discharged` | Discharged from the vessel |
| `customs_hold` | Held by customs |
| `freight_hold` | Held by the line (freight, documents or charges) |
| `available_for_pickup` | Released and available for pickup at the terminal |
| `gate_out` | Full container gated out to the consignee |
| `empty_returned` | Empty container returned |
| `other` | A move that fits none of the above |

## The response

Every line answers in this shape. The example shows every field a result can have; fields a line doesn't report are `null` or left out.

```json
{
  "carrier": "msc",
  "trackingNumber": "MEDU1234562",
  "status": "in_transit",
  "statusDescription": "Full Transshipment Loaded, Msc Desiree UK642A",
  "service": "20' DRY VAN",
  "deliveredAt": null,
  "deliveredAtLocal": null,
  "signedBy": null,
  "destination": { "city": "Montreal", "state": null, "country": "CA" },
  "estimatedDelivery": "2026-11-21",
  "estimatedDeliveryAt": null,
  "message": "Bill of lading MEDUKU746112",
  "ocean": {
    "scac": "MSCU",
    "billOfLading": "MEDUKU746112",
    "bookingNumber": null,
    "containerSize": "20",
    "containerType": "Dry",
    "pol": { "name": "…", "unlocode": "…", "country": "…", "terminal": null },
    "pod": { "name": "Montreal", "unlocode": "CAMTR", "country": "CA", "terminal": null },
    "vessel": { "name": "MSC Desiree", "imo": "…", "voyage": "UK642A" },
    "etd": null,
    "atd": "…",
    "eta": "2026-11-21",
    "ata": null,
    "lastFreeDay": null
  },
  "events": [
    {
      "timestamp": null,
      "localTime": "2026-11-06",
      "status": "in_transit",
      "milestone": "transshipment_departed",
      "description": "Full Transshipment Loaded, Msc Desiree UK642A",
      "location": "…",
      "portCode": "…",
      "vessel": "MSC Desiree",
      "voyage": "UK642A",
      "actual": true,
      "code": "Full Transshipment Loaded"
    }
  ]
}
```

| Field | |
|---|---|
| `carrier` | Carrier id, e.g. `msc`. |
| `trackingNumber` | The container or bill of lading, upper-cased and trimmed. |
| `status` | See [Statuses and milestones](#statuses-and-milestones). |
| `statusDescription` | The line's wording of the latest move. |
| `service` | Container size and type as the line writes it, e.g. `40' HQ`. Can be `null`. |
| `deliveredAt` | When the empty container was returned, in UTC, or `null`. |
| `deliveredAtLocal` | The same time as the line printed it, no zone. |
| `signedBy` | Always `null` for containers. |
| `destination` | The port of discharge or final destination as `{ city, state, country }`, or `null`. |
| `estimatedDelivery` | ETA at the port of discharge, local time with no zone (often a date only), or `null`. |
| `estimatedDeliveryAt` | The same moment in UTC, only when the line states its zone (ONE). |
| `message` | The line's own note, e.g. the bill of lading or booking the container sails under. |
| `ocean` | Ocean detail when the line reports it (below). |
| `events` | The container's moves, newest first. Planned moves are never mixed in. |

`ocean` fields, each present when the line reports it:

| Field | |
|---|---|
| `scac` | The line's Standard Carrier Alpha Code. |
| `billOfLading`, `bookingNumber` | The bill of lading and booking the container travels under. |
| `containerSize`, `containerType` | e.g. `20`, `40`, `45`; `Dry`, `High Cube`, `Reefer`. |
| `pol`, `pod` | Port of loading and port of discharge: `{ name, unlocode, country, terminal }`. `unlocode` is the UN/LOCODE, e.g. `CNSHA`, `USLAX`. |
| `vessel` | `{ name, imo, voyage }` for the current or last leg. |
| `etd`, `atd` | Estimated and actual departure from the port of loading. |
| `eta`, `ata` | Estimated and actual arrival at the port of discharge. |
| `lastFreeDay` | The last free day at the terminal, as a date, when the line publishes it. |
| `containers` | For a bill of lading or booking: the containers on it. |

Each event has `status`, `description`, `location` (or `null`), `code` (the line's own event code, or `null`), and when known `milestone`, `portCode` (UN/LOCODE), `vessel`, `voyage` and `actual` (`true` for a move that happened, `false` for a planned one). Two times:

- `timestamp`: UTC, ISO 8601 with `Z`. It is `null` when the line gave no time of day or no zone to convert from, which is most lines.
- `localTime`: the time as the line printed it, at the port's local time, no zone (`2026-10-16T14:37:00`). A date alone means no time of day was given. Never read a container's `localTime` as UTC.

ONE gives both, so both are exact. Maersk, COSCO and Yang Ming give local times without a zone; MSC and Evergreen give dates only. Each line's page under [Carriers](https://docs.containerfeed.com/carriers) says what it reports.
