# Data formats

## JSON

Requests with a body use `Content-Type: application/json`. A body that is not valid JSON answers
HTTP 400 - usually rejected by the hosting platform before the API runs, so the body is an HTML
page without a `code` (when the API itself sees it, the code is `INVALID_JSON`). Numbers must be JSON numbers where the reference says `integer` or `number` -
`"5555550100"` in quotes is a string and is rejected for `driverPhone`.

## Timestamps

All timestamps are **epoch milliseconds in UTC**, in requests and responses: a JSON integer in bodies
(`expDate`, `schedule.start`, `schedule.end`, `expectedArrival`, `createdAt`, `driverCoords.lastUpdate`,
`locationStatus.arrived.date`, and so on), and digits in the `fromDate` and `toDate` query parameters.

```js
const expDate = Date.now() + 48 * 60 * 60 * 1000; // 48 hours from now
```

```python
import time
exp_date = int(time.time() * 1000) + 48 * 60 * 60 * 1000
```

The exceptions are `get-reports` `data[].date`, an ISO-8601 string such as
`"2026-11-02T16:10:00.000Z"` (a v1 quirk), and the `webhook-timestamp` header (Unix seconds).

Convert local appointment times to UTC before sending them as `expectedArrival`.

## Driver phone

`driverPhone` is the driver's US or Canadian (+1) mobile number as a JSON **number** with 10 digits and
no country code: `5555550100`. An 11-digit number starting with `1` is accepted and the leading `1` is
stripped (`15555550100` becomes `5555550100`). Do not send `+`, spaces, dashes or parentheses.

The driver gets the app link by text message, so the number must be one a US or Canadian phone can have.
A number whose area code or exchange starts with `0` or `1` (such as `0004344444` or `1234567890`) is
rejected with `400 DRIVER_PHONE_INVALID`. See [Errors](/errors).

Responses that show the driver's phone (pending tracking items) use E.164: `"+15555550100"`. It is
`null` for an [ELD only](/eld-tracking) tracking, which has no driver phone.

`createdByTms.phoneNumber` is a string in E.164 format: `"+15555550123"`.

## Stops

Each item of `stopLocations` is either a full address or coordinates:

```json
{
  "stopLocations": [
    {
      "streetNumber": "3601",
      "streetName": "S Ashland Ave",
      "city": "Chicago",
      "stateProvince": "IL",
      "zip": "60609",
      "country": "US",
      "customStopId": "PU-1"
    },
    {
      "coordinates": { "lat": 32.815311, "lng": -96.866842 },
      "city": "Dallas",
      "stateProvince": "TX",
      "country": "US",
      "customStopId": "DEL-1",
      "expectedArrival": 1793721600000
    }
  ]
}
```

- **Address**: `streetName`, `city`, `stateProvince` (two-letter code), `zip` and `country` are
  required, `streetNumber` is optional. `country` is `US` or `CA`. Other values are not rejected but
  are not supported. The address is geocoded. If it cannot be found the request fails with
  `400 GEOCODING_FAILED` (also when the geocoding service is unavailable).
- **Coordinates**: `coordinates.lat` and `coordinates.lng` as decimal degrees. Address fields are then
  optional and only used for display. `0` is not accepted for either value.
- Stops keep the order you send. `stopIndex` in ETA results and the order of `stopLocations` in
  responses follow it.
- `customStopId` is yours and is returned on every read.
- `expectedArrival` (PRO plan) is the appointment in epoch milliseconds (UTC).

## Distances, durations, speed

| Field | Unit |
| --- | --- |
| `driverCoords.speed` | meters per second (multiply by 2.23694 for mph) |
| `driverCoords.heading` | degrees, 0 = north, clockwise |
| `driverCoords.accuracy` | meters |
| `driverCoords.battery` | 0 to 1 |
| `stopLocationsEta[].distance.value` | meters (`text` is a rounded miles label, for example `687 mi`) |
| `stopLocationsEta[].duration.value` | seconds of driving |

## Email update times

`emailUpdates.scheduledTimes.times` are wall-clock times in 24-hour `HH:mm` format (`"08:00"`,
`"17:30"`), 1 to 5 unique values, interpreted in `emailUpdates.scheduledTimes.timeZone` - an IANA
time zone name such as `America/Chicago`, `America/New_York`, `America/Denver`,
`America/Los_Angeles` or `America/Toronto`. Use the region name rather than an abbreviation such as
`CST` or `EST`, so daylight saving time is applied correctly. An unknown name is rejected with
`400 EMAIL_UPDATES_INVALID`.

`emailUpdates.intervalMinutes` is one of `30`, `60`, `120`, `240`.

## Identifiers

- `trackingId` - `api-` followed by 20 letters and digits (`api-test-` for test tracking items). Treat it
  as an opaque string.
- `refId` - your reference, any non-empty string of up to 200 characters, returned as `referenceId` in
  list items.
- `customId` - any string you choose, up to 200 characters, returned on every read.
- `metadata` - a free-form JSON object of up to 20 KB stored with the tracking. Only
  `metadata.shipmentId` is returned on reads.

## Limits

create-tracking and edit-tracking check every field they store against its type and limit, and
answer `400` with the field's code when one does not fit. `message` names the field, for example
`stopLocations[1].zip must be a string of up to 200 characters`. Fields the reference does not list
are ignored.

| Field | Limit |
| --- | --- |
| `refId`, `customId` | 200 characters |
| `notes`, `loadInstructions` | 5000 characters |
| `stopLocations` | 50 stops. Each address field and `customStopId` up to 200 characters |
| `createdByTms` | `companyName`, `displayName`, `email` up to 200 characters, `email` a valid address, `photoURL` an `http` / `https` URL up to 2000 characters |
| `metadata` | a JSON object, 20 KB |
| `driverType` | `solo` or `team` (case does not matter) |
