# Tracking

Look up the current tracking status and scan history for one of your shipments by tracking number.

**Scope:** `read:shipments`. A **Shipping API** key (`read:*`, `write:*`) has it. See [Authentication](authentication.md#scopes).

## Get Tracking

```
GET /api/v1/tracking/:trackingNumber
```

The tracking number must belong to a shipment on your account and must match exactly. Any other tracking number, including one for a shipment on another account, returns `404 NOT_FOUND`.

When the shipment has a carrier tracker, ShipWave fetches the latest status and scan events from it on each request. If there is no tracker, or the live lookup fails, the response uses the last status ShipWave stored for the shipment and `events` is an empty array.

### Example

```bash
curl https://shipwave.app/api/v1/tracking/9400111899223100012345 \
  -H "Authorization: Bearer sw_live_abc123..."
```

```typescript
const res = await fetch(
  "https://shipwave.app/api/v1/tracking/9400111899223100012345",
  { headers: { Authorization: "Bearer sw_live_abc123..." } }
);
const { data } = await res.json();
```

### Response

```json
{
  "data": {
    "trackingNumber": "9400111899223100012345",
    "carrier": "USPS",
    "service": "Priority",
    "status": "in_transit",
    "statusDetail": "departed_facility",
    "estimatedDelivery": "2026-02-21T00:00:00Z",
    "events": [
      {
        "timestamp": "2026-02-19T18:45:00Z",
        "status": "in_transit",
        "location": "CHICAGO, IL",
        "description": "Departed USPS Regional Facility"
      },
      {
        "timestamp": "2026-02-19T10:22:00Z",
        "status": "in_transit",
        "location": "PORTLAND, OR",
        "description": "Arrived at USPS Regional Origin Facility"
      },
      {
        "timestamp": "2026-02-18T16:30:00Z",
        "status": "pre_transit",
        "location": "PORTLAND, OR",
        "description": "Shipping Label Created, USPS Awaiting Item"
      }
    ]
  }
}
```

### Response Fields

| Field | Type | Description |
|-------|------|-------------|
| `trackingNumber` | string | The tracking number you requested |
| `carrier` | string | Carrier of the purchased label, for example `USPS` or `UPS`. `Unknown` if not recorded. |
| `service` | string | Carrier service of the purchased label, for example `Priority` or `Ground`. `Unknown` if not recorded. |
| `status` | string | Current tracking status (see [Tracking Statuses](#tracking-statuses)) |
| `statusDetail` | string | A short code passed through from the carrier, for example `departed_facility` or `arrived_at_facility`. It isn't a fixed list and isn't prose. Empty string when none is available. |
| `estimatedDelivery` | string \| null | Carrier's estimated delivery date as an ISO 8601 timestamp, or `null` |
| `events` | array | Scan events, newest first. Empty when there is no live tracker data. |

### Event Object

| Field | Type | Description |
|-------|------|-------------|
| `timestamp` | string | ISO 8601 time of the scan |
| `status` | string | Tracking status at this scan (same values as `status`) |
| `location` | string | `City, State` of the scan as the carrier reports it, or `Unknown` if the carrier gave no city or state |
| `description` | string | The carrier's description of the scan |

### Tracking Statuses

| Status | Description |
|--------|-------------|
| `unknown` | No status yet |
| `pre_transit` | Label created; the carrier hasn't scanned the package |
| `in_transit` | In transit |
| `out_for_delivery` | Out for delivery |
| `available_for_pickup` | Waiting for pickup at a carrier location |
| `delivered` | Delivered |
| `return_to_sender` | Being returned to the sender |
| `failure` | Delivery failed |
| `cancelled` | The label or shipment was cancelled |
| `error` | The carrier reported a tracking error |

### Errors

| Status | Code | Cause |
|--------|------|-------|
| 404 | `NOT_FOUND` | No shipment on your account has this tracking number (`Tracking number not found`) |

For `401`, `403`, and `429` responses, see [Errors](errors.md).
