openapi: 3.1.0
# Single source of truth for the public Load Market REST API (/v1).
# Rendered by the developer portal (Zudoku), the Swagger console and the Postman collection.
# Every API change updates this file, the changelog page and info.version in the same change.
info:
  title: Load Market Tracking API
  version: 2.6.1
  summary: Track truck drivers by phone number or by the carrier's ELD, get live locations, stop ETAs and signed webhooks.
  description: |
    The Load Market Tracking API lets brokers, carriers and TMS platforms request location tracking
    from a truck driver by phone number or from the truck's ELD (electronic logging device), read the
    live position, stop status and ETA, and receive signed webhooks while the load moves.

    Guides, quickstart and code samples: https://developers.load-market.com
  termsOfService: https://www.load-market.com/terms
  contact:
    name: Load Market API support
    email: office@load-market.com
    url: https://www.load-market.com

servers:
  - url: https://api.load-market.com/v1
    description: Production

security:
  - ApiKeyAuth: []

tags:
  - name: Tracking items
    description: Create, edit, read, list, stop and delete tracking items.
  - name: Reports
    description: Location history of a tracking.
  - name: Test mode
    description: Drive a test tracking through its lifecycle. Works only with a TEST partner key.
  - name: System
    description: Service health.

paths:
  /create-tracking:
    post:
      tags: [Tracking items]
      operationId: createTracking
      summary: Create a tracking
      description: |
        Sends a tracking request to the driver's phone and returns the new `trackingId`.

        - **Driver has the Load Market driver app** (the phone number is registered): the tracking is
          created with status `request` ("Pending driver's approval") and the driver gets a push
          notification to accept it.
        - **Driver does not have the app yet**: a *pending installation* tracking is created (status
          `request`, description "Pending installation") and the driver receives an SMS invitation.
          It turns into a regular tracking, with the same `trackingId`, once the driver installs the
          app and signs in with this phone number.
        - **`schedule` instead of `expDate`**: the tracking is created with status `scheduled` and
          starts automatically at `schedule.start` (driver invitation included). No webhooks are sent
          before that.
        - **ELD only (`trackingSource: eld`)**: the truck is tracked through the carrier's ELD instead of
          a phone. The carrier gets an email to approve the request, and the tracking waits with status
          `requestEld` ("Pending ELD admin approval") until it does. No text message is sent and
          `driverPhone` is not used. With `schedule` the status is `scheduledEld`.
        - **Hybrid (`trackingSource: hybrid`)**: the truck's ELD and the driver's phone. The driver is
          invited as above and the carrier gets the approval email. The status is `requestEld` until the
          driver accepts or the carrier approves, whichever comes first.

        **ELD and Hybrid.** Load Market enables them per organization (otherwise
        `403 ELD_TRACKING_NOT_AVAILABLE`), and they need the organization's client key: created by
        `mcNum` / `dotNum` the request answers `400 CLIENT_KEY_REQUIRED` unless your partner key is
        allowlisted for that organization. The carrier must have connected its ELD to Load Market. Before
        anything is saved the create checks the carrier (`eld.carrierDotNumber`), its ELD connection and
        the truck (`eld.truckNumber`) with the carrier's ELD provider, so it can take a few seconds longer
        than a phone-only create. For an ELD only tracking `driverPhone` and `loadInstructions` are ignored
        and the emails never carry the Live Tracking Link (`emailUpdates.realTimeTrackingLink` is always
        `false`). See the ELD and Hybrid tracking guide.

        **Organization.** Send the organization's client key in `x-api-client-key` (recommended).
        Without it the organization is resolved from `mcNum` / `dotNum` in the body (`mcNum` wins when
        both are sent, and neither answers `400 ORG_IDENTIFIER_REQUIRED`). Partners that are not
        allowlisted for number-based creation receive `400 CLIENT_KEY_REQUIRED`. This rule is being
        rolled out and is enforced per partner - until enforcement it runs in shadow mode (the request
        is logged and allowed).

        **Billing.** Every tracking consumes 1 tracking request of the organization's plan, or 2 when it
        spans more than 5 days (`billingWeight`). The create is refused with
        `400 TRACKING_LIMIT_REACHED` only when this tracking would exceed the plan's allowance - the
        last tracking request of the plan is usable. If the last payment for the organization's plan
        failed, the create is refused with `400 PAYMENT_FAILED` until the organization admin updates the
        payment method and the payment goes through. Organizations without a paid plan are on the Free
        plan (5 one-time tracking requests). Stop `expectedArrival` (Smart Arrival Alerts) requires the
        PRO plan (the VIP plan includes it). ELD and Hybrid tracking items are billed the same way.

        **Idempotency.** A create is billed, and a request that timed out may still have created the
        tracking. Send an `Idempotency-Key` header (any unique value, for example a UUID or your load id plus
        an attempt counter) and retry with the SAME key: a key that already created a tracking answers that
        create's response again, with the header `Idempotent-Replayed: true`, and nothing new is created or
        billed. The same key with another request body answers `409 IDEMPOTENCY_KEY_REUSED`, and while the
        first create with the key is still running `409 IDEMPOTENCY_IN_PROGRESS` with `Retry-After`. Only a
        successful create is remembered (24 hours): an error answer frees the key, so the same key can be
        retried after a `5xx` or after fixing a `4xx`. A `5xx` can still mean the tracking was written -
        look for your `customId` in the active list before you retry it.

        **Test keys.** Nothing is sent to a driver and nothing is billed: the plan allowance is neither
        checked nor consumed (`apiUsage` shows the current usage), while the PRO plan check still
        applies. The client key is required: without it the request answers
        `400 ORG_IDENTIFIER_REQUIRED` ("MC or DOT number is required"), or `400 CLIENT_KEY_REQUIRED`
        when `mcNum` / `dotNum` was sent. `driverPhone` `5555550100` simulates a driver who has the
        app. Any other valid number simulates a pending installation. The tracking id starts with
        `api-test-`, the response carries `testMode: true`. A test tracking lasts at most 24 hours:
        `expDate` / `schedule.end` further out answers `400 EXP_DATE_INVALID` / `SCHEDULE_INVALID`.
        A test key can create 200 test tracking items per UTC day (`429 TEST_LIMIT_REACHED`) and send 60
        requests per minute (`429 RATE_LIMITED`). With `trackingSource` `eld` or `hybrid` only the shape of
        the `eld` block is checked - no carrier, ELD provider or truck lookup - and the carrier's side is
        driven with the `carrier.*` events of `POST /test/simulate`. A hybrid with `driverPhone`
        `5555550100` starts in the driver's app, any other number as pending installation.
      security:
        - ApiKeyAuth: []
          ClientKeyAuth: []
        - ApiKeyAuth: []
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTrackingRequest'
            examples:
              regular:
                summary: Regular tracking with two stops (address)
                value:
                  driverPhone: 5555550100
                  refId: LM-48213 CHI-DAL
                  expDate: 1793800800000
                  customId: tms-load-48213
                  notes: Reefer load, keep at 34F.
                  loadInstructions: Call the receiver 30 min before arrival. Dock 12.
                  driverType: solo
                  stopLocations:
                    - streetNumber: '3601'
                      streetName: S Ashland Ave
                      city: Chicago
                      stateProvince: IL
                      zip: '60609'
                      country: US
                      customStopId: PU-1
                    - streetNumber: '4500'
                      streetName: Irving Blvd
                      city: Dallas
                      stateProvince: TX
                      zip: '75247'
                      country: US
                      customStopId: DEL-1
              scheduled:
                summary: Scheduled tracking (starts at schedule.start)
                value:
                  driverPhone: 5555550100
                  refId: LM-48377 ATL-MIA
                  schedule:
                    start: 1794225600000
                    end: 1794484800000
                  stopLocations:
                    - streetNumber: '1880'
                      streetName: Donald Lee Hollowell Pkwy NW
                      city: Atlanta
                      stateProvince: GA
                      zip: '30318'
                      country: US
                    - streetNumber: '7500'
                      streetName: NW 25th St
                      city: Miami
                      stateProvince: FL
                      zip: '33122'
                      country: US
              stopsWithEta:
                summary: Stops by coordinates with appointment times (PRO plan)
                value:
                  driverPhone: 5555550100
                  refId: LM-48402 CHI-DAL
                  expDate: 1793800800000
                  stopLocations:
                    - coordinates:
                        lat: 41.826772
                        lng: -87.665378
                      city: Chicago
                      stateProvince: IL
                      country: US
                      customStopId: PU-1
                      expectedArrival: 1793635200000
                    - coordinates:
                        lat: 32.815311
                        lng: -96.866842
                      city: Dallas
                      stateProvince: TX
                      country: US
                      customStopId: DEL-1
                      expectedArrival: 1793797200000
              emailUpdates:
                summary: Automated Location Updates every 60 minutes
                value:
                  driverPhone: 5555550100
                  refId: LM-48519 DEN-PHX
                  expDate: 1793800800000
                  emailUpdates:
                    reportEmails:
                      - dispatch@example.com
                      - customer.ops@example.com
                    intervalMinutes: 60
                    realTimeTrackingLink: true
                    driverAttachedFilesNotification: true
                    stopStatusEmails: true
              eldOnly:
                summary: ELD only (the truck's ELD, no driver phone)
                value:
                  trackingSource: eld
                  eld:
                    carrierDotNumber: 3012345
                    truckNumber: '1042'
                    approvalEmails:
                      - dispatch@acme-freight.com
                  refId: LM-48655 KC-STL
                  expDate: 1793800800000
                  customId: tms-load-48655
                  stopLocations:
                    - streetNumber: '1601'
                      streetName: Swift Ave
                      city: North Kansas City
                      stateProvince: MO
                      zip: '64116'
                      country: US
                    - streetNumber: '2101'
                      streetName: Cass Ave
                      city: St. Louis
                      stateProvince: MO
                      zip: '63106'
                      country: US
              hybrid:
                summary: Hybrid (the truck's ELD and the driver's phone)
                value:
                  trackingSource: hybrid
                  driverPhone: 5555550100
                  eld:
                    carrierDotNumber: 3012345
                    truckNumber: '1042'
                  refId: LM-48702 KC-STL
                  expDate: 1793800800000
                  loadInstructions: Call the receiver 30 min before arrival.
      responses:
        '200':
          description: Tracking created (or, with an `Idempotency-Key` used before, the response of that create).
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
            Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateTrackingResponse'
              examples:
                driverHasApp:
                  summary: Driver has the app
                  value:
                    message: Tracking request created
                    trackingId: api-7fK2mQ9xLpR4tN8vB1cD
                    customId: tms-load-48213
                    status:
                      value: request
                      description: Pending driver's approval
                    driverHasApp: true
                    billingWeight: 1
                    apiUsage:
                      planName: Premium
                      totalTrackings: 300
                      usedTrackings: 128
                      currentPeriodEnd: 1794484800000
                pendingInstallation:
                  summary: Driver does not have the app yet
                  value:
                    message: Pending tracking created
                    trackingId: api-Qm3xT8vN2kLp9RfW4bYc
                    customId: null
                    status:
                      value: request
                      description: Pending installation
                    driverHasApp: false
                    billingWeight: 1
                    apiUsage:
                      planName: Premium
                      totalTrackings: 300
                      usedTrackings: 129
                      currentPeriodEnd: 1794484800000
                scheduled:
                  summary: Scheduled tracking
                  value:
                    message: Scheduled tracking created
                    trackingId: api-Hs7kP2wQ9zXc4VbN6mLt
                    customId: null
                    status:
                      value: scheduled
                      description: Scheduled tracking
                    driverHasApp: true
                    billingWeight: 1
                    schedule:
                      start: 1794225600000
                      end: 1794484800000
                    apiUsage:
                      planName: Premium
                      totalTrackings: 300
                      usedTrackings: 130
                      currentPeriodEnd: 1794484800000
                testMode:
                  summary: Created with a TEST key (driverPhone 5555550100, current usage, nothing consumed)
                  value:
                    message: Tracking request created
                    trackingId: api-test-Zr8pL3nW6yQ1cV5kT9xB
                    customId: null
                    status:
                      value: request
                      description: Pending driver's approval
                    driverHasApp: true
                    billingWeight: 1
                    apiUsage:
                      planName: Premium
                      totalTrackings: 300
                      usedTrackings: 130
                      currentPeriodEnd: 1794484800000
                    testMode: true
                eldOnly:
                  summary: ELD only (waits for the carrier's approval)
                  value:
                    message: Tracking request created
                    trackingId: api-Ey4nC7tR1wQ8zK5mV2bX
                    customId: tms-load-48655
                    status:
                      value: requestEld
                      description: Pending ELD admin approval
                    driverHasApp: false
                    billingWeight: 1
                    apiUsage:
                      planName: Premium
                      totalTrackings: 300
                      usedTrackings: 131
                      currentPeriodEnd: 1794484800000
                hybrid:
                  summary: Hybrid, the driver has the app
                  value:
                    message: Tracking request created
                    trackingId: api-Hb6wK3pZ8rT2nX5cQ9mL
                    customId: null
                    status:
                      value: requestEld
                      description: Pending ELD admin approval
                    driverHasApp: true
                    billingWeight: 1
                    apiUsage:
                      planName: Premium
                      totalTrackings: 300
                      usedTrackings: 132
                      currentPeriodEnd: 1794484800000
                scheduledEld:
                  summary: Scheduled ELD only
                  value:
                    message: Scheduled tracking created
                    trackingId: api-Sd9eL4kW7vB1yN3qT6xR
                    customId: null
                    status:
                      value: scheduledEld
                      description: Scheduled ELD
                    driverHasApp: false
                    billingWeight: 1
                    schedule:
                      start: 1794225600000
                      end: 1794484800000
                    apiUsage:
                      planName: Premium
                      totalTrackings: 300
                      usedTrackings: 133
                      currentPeriodEnd: 1794484800000
        '400':
          description: |
            Validation or business error. Codes: `INVALID_CLIENT_KEY`, `CLIENT_KEY_REQUIRED`,
            `ORG_IDENTIFIER_REQUIRED`, `ORGANIZATION_NOT_FOUND`, `DRIVER_PHONE_REQUIRED`,
            `DRIVER_PHONE_INVALID`, `REF_ID_REQUIRED`, `EXP_DATE_REQUIRED`, `EXP_DATE_INVALID`,
            `EXP_DATE_SCHEDULE_CONFLICT`, `SCHEDULE_INVALID`, `LOAD_INSTRUCTIONS_INVALID`,
            `EMAIL_UPDATES_INVALID`, `STOP_LOCATION_INVALID`, `EXPECTED_ARRIVAL_INVALID`,
            `CREATED_BY_TMS_INVALID`, `INVALID_JSON`, `NO_ACTIVE_SUBSCRIPTION`, `TRACKING_LIMIT_REACHED`,
            `PAYMENT_FAILED`, `DRIVER_LOOKUP_FAILED`, `GEOCODING_FAILED`, `ORG_IDENTIFIER_INVALID`, `REF_ID_INVALID`,
            `CUSTOM_ID_INVALID`, `NOTES_INVALID`, `DRIVER_TYPE_INVALID`, `METADATA_INVALID`,
            `IDEMPOTENCY_KEY_INVALID` (an `Idempotency-Key` that is empty, longer than 255 characters or holds
            other than visible ASCII without spaces).

            Every field of the request body is checked against its type and limits in the schema. A value
            of another type, or over its limit, answers `400` with the field's code, and `message` names
            the field (for example `stopLocations[1].zip must be a string of up to 200 characters`).

            ELD and Hybrid add `TRACKING_SOURCE_INVALID`, `ELD_DATA_INVALID`, `ELD_CARRIER_NOT_INTEGRATED`,
            `ELD_CONNECTION_UNAVAILABLE` and `ELD_VEHICLE_NOT_FOUND`. `DRIVER_PHONE_REQUIRED` and
            `DRIVER_PHONE_INVALID` do not apply to an ELD only tracking. See the ELD and Hybrid tracking
            guide for each code.

            `TRACKING_LIMIT_REACHED` - the plan has fewer tracking requests left than this tracking
            needs (`billingWeight` 1, or 2 when it is longer than 5 days). `NO_ACTIVE_SUBSCRIPTION` is
            practically never returned: organizations without a paid plan are on the Free plan (5
            one-time tracking requests) and get `TRACKING_LIMIT_REACHED` once those are used.

            `PAYMENT_FAILED` - the last payment for the organization's plan failed. The plan is kept, but
            no new tracking item is created until the organization admin updates the payment method on
            the Billing page of the Load Market web app and the payment goes through. Existing tracking
            items are not affected.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                driverPhoneInvalid:
                  summary: DRIVER_PHONE_INVALID
                  value:
                    message: Driver phone number is not valid
                    code: DRIVER_PHONE_INVALID
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                expDateInvalid:
                  summary: EXP_DATE_INVALID
                  value:
                    message: Tracking expiration date max is 240 hours
                    code: EXP_DATE_INVALID
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                clientKeyRequired:
                  summary: CLIENT_KEY_REQUIRED (live key, created by MC/DOT number)
                  value:
                    message: x-api-client-key is required to create tracking items for this organization.
                    code: CLIENT_KEY_REQUIRED
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                clientKeyRequiredTest:
                  summary: CLIENT_KEY_REQUIRED (test key)
                  value:
                    message: x-api-client-key is required in test mode.
                    code: CLIENT_KEY_REQUIRED
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                orgIdentifierRequired:
                  summary: ORG_IDENTIFIER_REQUIRED
                  value:
                    message: MC or DOT number is required
                    code: ORG_IDENTIFIER_REQUIRED
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                trackingLimitReached:
                  summary: TRACKING_LIMIT_REACHED
                  value:
                    message: Organization have no available tracking requests
                    code: TRACKING_LIMIT_REACHED
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                paymentFailed:
                  summary: PAYMENT_FAILED
                  value:
                    message: The organization's subscription payment failed. New tracking items are paused until the organization admin updates the payment method.
                    code: PAYMENT_FAILED
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                geocodingFailed:
                  summary: GEOCODING_FAILED
                  value:
                    message: 'No geocoding match for address: 4500 Irving Blvd, Dallas TX, 75247 US'
                    code: GEOCODING_FAILED
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                eldDataInvalid:
                  summary: ELD_DATA_INVALID
                  value:
                    message: eld.truckNumber is required
                    code: ELD_DATA_INVALID
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                eldCarrierNotIntegrated:
                  summary: ELD_CARRIER_NOT_INTEGRATED
                  value:
                    message: Carrier is not integrated with our ELD system
                    code: ELD_CARRIER_NOT_INTEGRATED
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                eldConnectionUnavailable:
                  summary: ELD_CONNECTION_UNAVAILABLE
                  value:
                    message: ELD connection problem for this carrier. They need to reconnect their ELD account.
                    code: ELD_CONNECTION_UNAVAILABLE
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                eldVehicleNotFound:
                  summary: ELD_VEHICLE_NOT_FOUND
                  value:
                    message: eld.truckNumber is not valid for this carrier
                    code: ELD_VEHICLE_NOT_FOUND
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: |
            `PRO_PLAN_REQUIRED` - a stop has `expectedArrival` but the organization is not on a PRO or VIP plan.
            `ELD_TRACKING_NOT_AVAILABLE` - `trackingSource` is `eld` or `hybrid` but Load Market has not
            enabled ELD tracking for the organization.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                proPlanRequired:
                  summary: PRO_PLAN_REQUIRED
                  value:
                    message: Expected arrival (Smart Arrival Alerts) requires a PRO plan.
                    code: PRO_PLAN_REQUIRED
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                eldTrackingNotAvailable:
                  summary: ELD_TRACKING_NOT_AVAILABLE
                  value:
                    message: ELD tracking is not available for this organization
                    code: ELD_TRACKING_NOT_AVAILABLE
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
        '409':
          description: |
            `IDEMPOTENCY_KEY_REUSED` - the `Idempotency-Key` created a tracking with another request body: use a
            new key for a new tracking. `IDEMPOTENCY_IN_PROGRESS` - a create with this key is still running:
            retry after `Retry-After` seconds, with the same key.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                idempotencyKeyReused:
                  summary: IDEMPOTENCY_KEY_REUSED
                  value:
                    message: This Idempotency-Key was used for a create with another request. Use a new key for a new tracking.
                    code: IDEMPOTENCY_KEY_REUSED
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                idempotencyInProgress:
                  summary: IDEMPOTENCY_IN_PROGRESS
                  value:
                    message: A create with this Idempotency-Key is still running. Retry after Retry-After seconds.
                    code: IDEMPOTENCY_IN_PROGRESS
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
        '429':
          description: |
            `TEST_LIMIT_REACHED` (test keys) - the test key already created 200 test tracking items
            today (UTC day, and deleting test tracking items does not give the quota back), `Retry-After` points at the
            next midnight UTC. `RATE_LIMITED` - a test key sent more than 60 requests in a minute, or (any
            key, ELD and Hybrid) too many unknown truck numbers were sent for the organization in a short
            time. Wait the number of seconds in `Retry-After`.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                testLimitReached:
                  summary: TEST_LIMIT_REACHED
                  value:
                    message: A test key can create at most 200 test tracking items per day (UTC). Try again after midnight UTC.
                    code: TEST_LIMIT_REACHED
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                rateLimited:
                  summary: RATE_LIMITED
                  value:
                    message: Test keys are limited to 60 requests per minute.
                    code: RATE_LIMITED
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                eldTruckRateLimited:
                  summary: RATE_LIMITED (unknown truck numbers)
                  value:
                    message: Too many invalid ELD truck numbers, please try again later.
                    code: RATE_LIMITED
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          description: |
            `ELD_PROVIDER_UNAVAILABLE` - ELD and Hybrid only. The carrier's ELD provider did not answer
            the truck check. Nothing was created. Retry after the number of seconds in `Retry-After`.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: The carrier's ELD provider is temporarily unavailable, please try again.
                code: ELD_PROVIDER_UNAVAILABLE
                requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
        '504':
          description: |
            `UPSTREAM_TIMEOUT` - ELD and Hybrid only. The truck could not be checked with the carrier's
            ELD provider in time. Nothing was created. Safe to retry with backoff.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: The ELD truck could not be checked in time, please try again.
                code: UPSTREAM_TIMEOUT
                requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe

  /edit-tracking:
    patch:
      tags: [Tracking items]
      operationId: editTracking
      summary: Edit a tracking
      description: |
        Updates an existing tracking. Only the fields you send are changed. `stopLocations`, when
        sent, replaces the whole stop list (new stops are geocoded like on create). An empty array is
        ignored. A stop that is still the same stop keeps its arrival/departure confirmations and its Smart
        Arrival Alerts status: the same `customStopId` (at any position), within 100 m of where the stop was.
        Without ids a stop keeps them at the same position and place, unless stops were removed or inserted and
        another stop of the list is at the same place (a round trip's return and its pickup) - send
        `customStopId` to keep them in every case. Any other stop starts without them. Changing only a stop's
        `expectedArrival` keeps the stop and recomputes its Smart Arrival Alert. Before 2.6.0 every stop
        started over.

        The expiration date, schedule, load instructions and email settings cannot be changed through
        this endpoint.

        The response `status` is the stored status (without the live refinements such as
        `notMoving`) - call get-tracking for the live status.

        **Visibility.** A tracking is visible to the partner key that created it, or to any partner key
        when the organization's client key is sent in `x-api-client-key`. This ownership rule is being
        rolled out and is enforced per partner - until enforcement it runs in shadow mode (the request
        is logged and allowed).

        **Known v1 quirk.** An unknown `trackingId` returns `404 TRACKING_NOT_FOUND` here, while
        get-tracking, stop-tracking, delete-tracking and get-reports answer `400`.
      security:
        - ApiKeyAuth: []
        - ApiKeyAuth: []
          ClientKeyAuth: []
      parameters:
        - $ref: '#/components/parameters/TrackingId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EditTrackingRequest'
            examples:
              referenceAndNotes:
                summary: Change reference and notes
                value:
                  refId: LM-48213 CHI-DAL (rebooked)
                  notes: Receiver moved the appointment to 10:00 CT.
              replaceStops:
                summary: Replace the stop list
                value:
                  stopLocations:
                    - streetNumber: '3601'
                      streetName: S Ashland Ave
                      city: Chicago
                      stateProvince: IL
                      zip: '60609'
                      country: US
                      customStopId: PU-1
                    - streetNumber: '2201'
                      streetName: E Loop 820 N
                      city: Fort Worth
                      stateProvince: TX
                      zip: '76118'
                      country: US
                      customStopId: DEL-2
      responses:
        '200':
          description: Tracking updated.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EditTrackingResponse'
              examples:
                regular:
                  summary: Regular tracking
                  value:
                    message: Tracking request updated
                    trackingId: api-7fK2mQ9xLpR4tN8vB1cD
                    customId: tms-load-48213
                    status:
                      value: active
                      description: Active
                pending:
                  summary: Pending installation tracking
                  value:
                    message: Pending tracking updated
                    trackingId: api-Qm3xT8vN2kLp9RfW4bYc
                    customId: null
                    status:
                      value: request
                      description: Pending installation
        '400':
          description: |
            Validation error. Codes: `TRACKING_ID_REQUIRED`, `STOP_LOCATION_INVALID`,
            `EXPECTED_ARRIVAL_INVALID`, `CREATED_BY_TMS_INVALID`, `GEOCODING_FAILED`, `INVALID_JSON`,
            `REF_ID_INVALID`, `CUSTOM_ID_INVALID`, `NOTES_INVALID`, `DRIVER_TYPE_INVALID`,
            `ORGANIZATION_NOT_FOUND` (the organization the tracking belongs to no longer exists).

            Every field you send is checked against its type and limits in the schema, like on create.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                stopLocationInvalid:
                  summary: STOP_LOCATION_INVALID
                  value:
                    message: Stop locations are not valid
                    code: STOP_LOCATION_INVALID
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                trackingIdRequired:
                  summary: TRACKING_ID_REQUIRED
                  value:
                    message: Tracking ID is required
                    code: TRACKING_ID_REQUIRED
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                organizationNotFound:
                  summary: ORGANIZATION_NOT_FOUND
                  value:
                    message: Organization of this tracking not found
                    code: ORGANIZATION_NOT_FOUND
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: '`PRO_PLAN_REQUIRED` - a stop has `expectedArrival`, the organization is not on a PRO or VIP plan and the tracking item was not created on its PRO trial.'
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Expected arrival (Smart Arrival Alerts) requires a PRO plan.
                code: PRO_PLAN_REQUIRED
                requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
        '404':
          description: '`TRACKING_NOT_FOUND` - no tracking with this id is visible to your key.'
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Tracking not found
                code: TRACKING_NOT_FOUND
                requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'

  /get-tracking:
    get:
      tags: [Tracking items]
      operationId: getTracking
      summary: Get a tracking
      description: |
        Returns the current state of one tracking: status, latest driver position, stops with
        arrival/departure confirmations, Smart Arrival Alert status, driver files (BOL/POD), email
        settings and the Live Tracking Link (`publicLink`).

        - `requestStopsEta=0|1` adds `stopLocationsEta`: the Traffic-based ETA (driving distance and
          duration from the driver's last position to the requested stops, with live traffic: Esri
          routing, and Mapbox driving-traffic when Esri does not answer). A stop whose ETA cannot be
          computed, or an index that does not exist, is left out.
        - `requestDriverAddress=true` adds the reverse-geocoded address to `driverCoords.location`.

        **Driver position.** `driverCoords` is published only while the tracking is live: stored
        status `active`, `stop`, `activeEld` or `stopEld` (the derived `notMoving`, `waiting` and
        `settings` come from `active`). For `request`, `cancel`, `done`, the other ELD statuses, pending
        installation and scheduled tracking items it is `null`. Positions are stored per driver (or
        truck), so outside the live window the latest fix may belong to another load. For the same
        reason, on a mobile tracking it stays `null` after the driver accepts, until the phone sends its
        first position for this tracking.

        **Potential Fraud Alerts (PRO).** `fraudAlerts` reports signals about the driver's phone
        (jailbroken device, emulator, VPN, IP address or GPS position outside the US and Canada) for
        organizations on a PRO or VIP plan, and for tracking items created on the organization's PRO
        trial, in the same live window as `driverCoords`. It is `null` otherwise, always for an ELD only
        tracking, and for a hybrid until the driver accepts it in the app. A signal is not proof of fraud - see the Potential Fraud Alerts guide.

        When an optional enrichment cannot be computed the response is still `200` and `message`
        explains what is missing (for example `Driver location address can not be provided, driver
        coordinates not available.`).

        **Visibility.** A tracking is visible to the partner key that created it, or to any partner key
        when the organization's client key is sent in `x-api-client-key`. This ownership rule is being
        rolled out and is enforced per partner - until enforcement it runs in shadow mode (the request
        is logged and allowed).

        The driver app reports a position about every 20 seconds. An ELD position is read from the
        carrier's ELD provider about once a minute, and its `lastUpdate` is the time the ELD recorded it.
        Poll at most once per minute per tracking and prefer webhooks.
      security:
        - ApiKeyAuth: []
        - ApiKeyAuth: []
          ClientKeyAuth: []
      parameters:
        - $ref: '#/components/parameters/TrackingId'
        - in: query
          name: requestStopsEta
          required: false
          description: |
            Pipe-separated zero-based stop indexes to compute the Traffic-based ETA for, for example
            `0|1`. An index that does not exist is left out of `stopLocationsEta`.
          schema:
            type: string
            pattern: '^\d+(\|\d+)*$'
            examples: ['0|1']
        - in: query
          name: requestDriverAddress
          required: false
          description: When `true`, the driver's current address is added as `driverCoords.location`.
          schema:
            type: boolean
            default: false
        - in: query
          name: requestDriverDetails
          required: false
          description: |
            When `true`, `driverDetails` is added: the driver of the tracking item and the device that tracks it
            (name, phone, picture, app version and language, device). Every plan. Not in webhooks or the list.
          schema:
            type: boolean
            default: false
        - in: query
          name: requestPhoneSettings
          required: false
          description: |
            When `true`, `phoneSettings` is added: the location settings of the phone that tracks the tracking item
            (permission, accuracy, power-save mode) - what the `settings` status is about, without the driver's
            personal data. Every plan. Not in webhooks or the list.
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: Tracking data.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetTrackingResponse'
              examples:
                active:
                  summary: Active tracking with ETA
                  value:
                    message: Ok
                    data:
                      trackingId: api-7fK2mQ9xLpR4tN8vB1cD
                      status:
                        value: active
                        description: Active
                      driverHasApp: true
                      driverInvite:
                        smsStatus: sent
                        smsFailureReason: null
                        smsCount: 1
                        lastSmsAt: 1793628060000
                        appLink: https://notification.load-market.com/enQZ/sb3to39y
                      customId: tms-load-48213
                      notes: Reefer load, keep at 34F.
                      loadInstructions: Call the receiver 30 min before arrival. Dock 12.
                      billingWeight: 1
                      schedule: null
                      emailSettings:
                        reportEmails: []
                        intervalMinutes: null
                        scheduledTimes: null
                        realTimeTrackingLink: true
                        driverAttachedFilesNotification: false
                        stopStatusEmails: false
                      trackingSource: null
                      expDate: 1793800800000
                      publicLink: https://tracking.load-market.com?track=Wd5nR8cK3yT6pJ2mV9sF
                      driverCoords:
                        lat: 39.781721
                        lng: -89.650148
                        speed: 28.6
                        battery: 0.82
                        heading: 205
                        accuracy: 6
                        locationSource: gps
                        lastUpdate: 1793650490000
                      fraudAlerts:
                        alerts: [vpn, ipOutsideUsCa]
                        signals:
                          jailbrokenDevice: false
                          emulator: false
                          vpn: true
                          ipOutsideUsCa: true
                          gpsOutsideUsCa: false
                        ipLocation:
                          country: DE
                          countryName: Germany
                          stateProvince: Berlin
                          city: Berlin
                          zip: '10115'
                      stopLocations:
                        - streetName: S Ashland Ave
                          streetNumber: '3601'
                          city: Chicago
                          stateProvince: IL
                          zip: '60609'
                          country: US
                          formattedAddress: 3601 S Ashland Ave, Chicago, IL 60609
                          latitude: 41.826772
                          longitude: -87.665378
                          customStopId: PU-1
                          expectedArrival: null
                          stopAlertStatusInfo: null
                          locationStatus:
                            arrived:
                              confirm: true
                              date: 1793635620000
                            completed:
                              confirm: true
                              date: 1793638080000
                        - streetName: Irving Blvd
                          streetNumber: '4500'
                          city: Dallas
                          stateProvince: TX
                          zip: '75247'
                          country: US
                          formattedAddress: 4500 Irving Blvd, Dallas, TX 75247
                          latitude: 32.815311
                          longitude: -96.866842
                          customStopId: DEL-1
                          expectedArrival: null
                          stopAlertStatusInfo: null
                          locationStatus:
                            arrived: null
                            completed: null
                      stopLocationsEta:
                        - stopIndex: 1
                          distance:
                            text: 687 mi
                            value: 1105622
                          duration:
                            text: 11 hours 2 mins
                            value: 39720
                      driverFiles:
                        - fileId: Yb2mX7qK4pL9sT1wR6nC
                          name: bol-48213.jpg
                          date: 1793638080000
                          url: https://firebasestorage.googleapis.com/v0/b/example/o/bol-48213.jpg
                          type: bol
                pendingInstallation:
                  summary: Pending installation (driver has no app yet)
                  value:
                    message: Ok
                    data:
                      trackingId: api-Qm3xT8vN2kLp9RfW4bYc
                      status:
                        value: request
                        description: Pending installation
                      driverHasApp: false
                      driverInvite:
                        smsStatus: sent
                        smsFailureReason: null
                        smsCount: 1
                        lastSmsAt: 1793628060000
                        appLink: https://notification.load-market.com/enQZ/sb3to39y
                      driverPhone: '+15555550100'
                      customId: null
                      notes: ''
                      loadInstructions: null
                      billingWeight: 1
                      schedule: null
                      emailSettings:
                        reportEmails: [dispatch@example.com]
                        intervalMinutes: 60
                        scheduledTimes: null
                        realTimeTrackingLink: true
                        driverAttachedFilesNotification: false
                        stopStatusEmails: false
                      trackingSource: null
                      expDate: 1793800800000
                      stopLocations: []
                eldPending:
                  summary: ELD only, waiting for the carrier's approval
                  value:
                    message: Ok
                    data:
                      trackingId: api-Ey4nC7tR1wQ8zK5mV2bX
                      status:
                        value: requestEld
                        description: Pending ELD admin approval
                      driverHasApp: false
                      driverInvite: null
                      driverPhone: null
                      customId: tms-load-48655
                      notes: ''
                      loadInstructions: null
                      billingWeight: 1
                      schedule: null
                      emailSettings:
                        reportEmails: [dispatch@example.com]
                        intervalMinutes: 60
                        scheduledTimes: null
                        realTimeTrackingLink: false
                        driverAttachedFilesNotification: false
                        stopStatusEmails: false
                      trackingSource: eld
                      expDate: 1793800800000
                      stopLocations: []
                eldActive:
                  summary: ELD only, approved by the carrier (position from the truck's ELD)
                  value:
                    message: Ok
                    data:
                      trackingId: api-Ey4nC7tR1wQ8zK5mV2bX
                      status:
                        value: activeEld
                        description: Active ELD
                      driverHasApp: false
                      driverInvite: null
                      customId: tms-load-48655
                      notes: ''
                      loadInstructions: null
                      billingWeight: 1
                      schedule: null
                      emailSettings:
                        reportEmails: [dispatch@example.com]
                        intervalMinutes: 60
                        scheduledTimes: null
                        realTimeTrackingLink: false
                        driverAttachedFilesNotification: false
                        stopStatusEmails: false
                      trackingSource: eld
                      expDate: 1793800800000
                      publicLink: https://tracking.load-market.com?track=Kp4tW9mR2xZ7nC5vB8qL
                      driverCoords:
                        lat: 38.912871
                        lng: -92.330144
                        speed: 27.4
                        battery: null
                        heading: 92
                        accuracy: null
                        locationSource: null
                        lastUpdate: 1793650440000
                      fraudAlerts: null
                      stopLocations: []
        '400':
          description: |
            Codes: `TRACKING_ID_REQUIRED`, `STOPS_ETA_INVALID`, `TRACKING_NOT_FOUND`.
            Known v1 quirk: an unknown `trackingId` answers `400 TRACKING_NOT_FOUND` (edit-tracking answers `404`).
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                trackingNotFound:
                  summary: TRACKING_NOT_FOUND
                  value:
                    message: No tracking found
                    code: TRACKING_NOT_FOUND
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                stopsEtaInvalid:
                  summary: STOPS_ETA_INVALID
                  value:
                    message: 'ETA request should follow pattern: "0|1|2"'
                    code: STOPS_ETA_INVALID
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
        '504':
          description: '`UPSTREAM_TIMEOUT` - the tracking could not be assembled in time (25 s per stage). Safe to retry with backoff.'
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Tracking data could not be assembled in time, please try again.
                code: UPSTREAM_TIMEOUT
                requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe

  /get-all-tracking-items:
    get:
      tags: [Tracking items]
      operationId: listTrackingItems
      summary: List tracking items of your organization
      description: |
        Returns a slim list of the organization's tracking items. The organization comes from the
        mandatory `x-api-client-key` header. The list never crosses organizations.

        - `type=active`: every tracking item that is not finished (including rejected ones) plus
          pending installation and scheduled tracking items, newest first. No pagination, capped at
          500 items per source (regular and pending).
        - `type=history`: finished tracking items (`done` or `doneEld`) whose expiration date (`expDate`) falls in
          the window `fromDate < expDate <= toDate`, ordered by `expDate` ascending, paginated with
          `limit` and `cursor`. Without `fromDate` the window starts 7 days ago.

        History keeps finished tracking items for a limited time only, so sync what you need
        regularly. Stopping a tracking does not change its `expDate`, so a tracking stopped early
        lands in history by its original `expDate`.

        Items are slim by design (no email settings, driver files, ETA or reverse-geocoded address) -
        call get-tracking for the full view. `driverCoords` is set only for live tracking items
        (stored status `active`, `stop`, `activeEld` or `stopEld`). History items always have `driverCoords: null`.

        With a TEST key the list contains test tracking items only, and history returns a single page
        (`nextCursor` is always `null`).
      security:
        - ApiKeyAuth: []
          ClientKeyAuth: []
      parameters:
        - in: query
          name: type
          required: true
          description: '`active` for the live list, `history` for finished tracking items.'
          schema:
            type: string
            enum: [active, history]
        - in: query
          name: fromDate
          required: false
          description: History only. Window start in epoch milliseconds (UTC), exclusive, applied to `expDate`. Defaults to now minus 7 days.
          schema:
            type: integer
            format: int64
            examples: [1792972800000]
        - in: query
          name: toDate
          required: false
          description: History only. Window end in epoch milliseconds (UTC), inclusive, applied to `expDate`. No upper bound when omitted.
          schema:
            type: integer
            format: int64
            examples: [1793577600000]
        - in: query
          name: limit
          required: false
          description: History only. Page size.
          schema:
            type: integer
            minimum: 1
            maximum: 500
            default: 100
        - in: query
          name: cursor
          required: false
          description: History only. Opaque cursor from the previous page's `pagination.nextCursor`. Send it with the same window.
          schema:
            type: string
      responses:
        '200':
          description: Tracking items. `pagination` is present on history responses only.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListTrackingItemsResponse'
              examples:
                history:
                  summary: History page with a next cursor
                  value:
                    message: Ok
                    data:
                      - trackingId: api-7fK2mQ9xLpR4tN8vB1cD
                        status:
                          value: done
                          description: Tracking finished
                        createdAt: 1793628000000
                        expDate: 1793800800000
                        notes: Reefer load, keep at 34F.
                        loadInstructions: Call the receiver 30 min before arrival. Dock 12.
                        billingWeight: 1
                        schedule: null
                        customId: tms-load-48213
                        referenceId: LM-48213 CHI-DAL
                        trackingSource: null
                        publicLink: https://tracking.load-market.com?track=Wd5nR8cK3yT6pJ2mV9sF
                        stopLocations: []
                        driverHasApp: true
                        driverInvite:
                          smsStatus: sent
                          smsFailureReason: null
                          smsCount: 1
                          lastSmsAt: 1793628060000
                          appLink: https://notification.load-market.com/enQZ/sb3to39y
                        driverCoords: null
                    pagination:
                      nextCursor: eyJ2IjoxNzkzODAwODAwMDAwLCJwIjoidHJhY2tpbmcvWGszL3RyYWNraW5nLWxpc3QvYXBpLTdmSzJtUTl4THBSNHROOHZCMWNEIn0
                active:
                  summary: Active list with a pending installation item
                  value:
                    message: Ok
                    data:
                      - trackingId: api-Qm3xT8vN2kLp9RfW4bYc
                        status:
                          value: request
                          description: Pending installation
                        createdAt: 1793628312000
                        expDate: 1793800800000
                        notes: ''
                        loadInstructions: null
                        billingWeight: 1
                        schedule: null
                        customId: null
                        referenceId: LM-48519 DEN-PHX
                        trackingSource: null
                        publicLink: null
                        stopLocations: []
                        driverHasApp: false
                        driverInvite:
                          smsStatus: sent
                          smsFailureReason: null
                          smsCount: 1
                          lastSmsAt: 1793628060000
                          appLink: https://notification.load-market.com/enQZ/sb3to39y
                        driverCoords: null
        '400':
          description: |
            Codes: `CLIENT_KEY_REQUIRED`, `INVALID_CLIENT_KEY`, `LIST_TYPE_INVALID`, `LIST_PARAMS_INVALID`
            (window, limit or cursor not valid, or history parameters sent with `type=active`).
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                clientKeyRequired:
                  summary: CLIENT_KEY_REQUIRED
                  value:
                    message: Client access key is required
                    code: CLIENT_KEY_REQUIRED
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                listParamsInvalid:
                  summary: LIST_PARAMS_INVALID
                  value:
                    message: limit must be a number between 1 and 500
                    code: LIST_PARAMS_INVALID
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'

  /stop-tracking:
    patch:
      tags: [Tracking items]
      operationId: stopTracking
      summary: Stop a tracking
      description: |
        Finishes a tracking: its status becomes `done` (`doneEld` for an ELD or Hybrid tracking), the
        driver's app and the truck's ELD stop sharing the location for it, and it moves to history.
        Works on tracking items that exist in the driver's app or were approved by the carrier (any
        status). A pending installation, a scheduled tracking that has not started, or an ELD only
        tracking still waiting for the carrier's approval is not found here - delete it instead.

        For tracking items created through the API with webhooks enabled on the key, the final `done`
        (or `doneEld`) webhook is sent as well (see Webhooks).

        Stopping does not change the tracking's `expDate`: a tracking stopped early lands in the
        history list by its original `expDate`.

        **Visibility.** A tracking is visible to the partner key that created it, or to any partner key
        when the organization's client key is sent in `x-api-client-key`. This ownership rule is being
        rolled out and is enforced per partner - until enforcement it runs in shadow mode (the request
        is logged and allowed).
      security:
        - ApiKeyAuth: []
        - ApiKeyAuth: []
          ClientKeyAuth: []
      parameters:
        - $ref: '#/components/parameters/TrackingId'
      responses:
        '200':
          description: Tracking stopped.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OkResponse'
              example:
                message: Ok
        '400':
          description: |
            Codes: `TRACKING_ID_REQUIRED`, `TRACKING_NOT_FOUND`.
            Known v1 quirk: an unknown `trackingId` answers `400` (edit-tracking answers `404`).
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: No active tracking found
                code: TRACKING_NOT_FOUND
                requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'

  /delete-tracking:
    delete:
      tags: [Tracking items]
      operationId: deleteTracking
      summary: Delete a tracking
      description: |
        Permanently deletes a tracking with its driver files, chat and location reports. Works for
        every tracking, including pending installation and scheduled ones. Deletion is idempotent on
        partial failure: when you get a `500`, retry the same call.

        Deleting does not refund the tracking request already consumed from the plan.

        **Visibility.** A tracking is visible to the partner key that created it, or to any partner key
        when the organization's client key is sent in `x-api-client-key`. This ownership rule is being
        rolled out and is enforced per partner - until enforcement it runs in shadow mode (the request
        is logged and allowed).
      security:
        - ApiKeyAuth: []
        - ApiKeyAuth: []
          ClientKeyAuth: []
      parameters:
        - $ref: '#/components/parameters/TrackingId'
      responses:
        '200':
          description: Tracking deleted.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OkResponse'
              example:
                message: Ok
        '400':
          description: |
            Codes: `TRACKING_ID_REQUIRED`, `TRACKING_NOT_FOUND`.
            Known v1 quirk: an unknown `trackingId` answers `400` (edit-tracking answers `404`).
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: No tracking found
                code: TRACKING_NOT_FOUND
                requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'

  /get-reports:
    get:
      tags: [Reports]
      operationId: getTrackingReports
      summary: Get the location history of a tracking
      description: |
        Returns the recorded location reports of a tracking, oldest first. While a tracking is active a
        report is recorded about every 15 minutes, only when the driver moved since the previous one.

        **Known v1 quirk.** `data[].date` is an ISO-8601 string (UTC, minute precision). Every other
        timestamp in this API is epoch milliseconds.

        **Visibility.** A tracking is visible to the partner key that created it, or to any partner key
        when the organization's client key is sent in `x-api-client-key`. This ownership rule is being
        rolled out and is enforced per partner - until enforcement it runs in shadow mode (the request
        is logged and allowed).
      security:
        - ApiKeyAuth: []
        - ApiKeyAuth: []
          ClientKeyAuth: []
      parameters:
        - $ref: '#/components/parameters/TrackingId'
      responses:
        '200':
          description: Location reports.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrackingReportsResponse'
              example:
                message: Ok
                data:
                  - location: Chicago, IL
                    lat: 41.826772
                    lng: -87.665378
                    date: '2026-11-02T16:10:00.000Z'
                  - location: Bolingbrook, IL
                    lat: 41.698640
                    lng: -88.068398
                    date: '2026-11-02T17:25:00.000Z'
        '400':
          description: |
            Codes: `TRACKING_ID_REQUIRED`, `REPORTS_NOT_FOUND` (the tracking does not exist, is not
            visible to your key, or has no reports yet). Known v1 quirk: not-found answers `400`.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: No tracking reports found
                code: REPORTS_NOT_FOUND
                requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'

  /test/simulate:
    post:
      tags: [Test mode]
      operationId: simulateTestEvent
      summary: Simulate a driver event
      description: |
        Moves a test tracking through its lifecycle as if a real driver did it, then sends one signed
        webhook for the new state to the webhook URL configured on your TEST key. The response tells you
        what your endpoint answered.

        Works only with a TEST key (a live key gets `403 TEST_MODE_ONLY`). Use the same test key that
        created the tracking.

        | Event | Allowed from | Result |
        | --- | --- | --- |
        | `driver.installed` | pending installation, or `scheduled` whose driver has no app | `request` (driver has the app now). On a scheduled tracking `driverHasApp` becomes `true` and the status stays `scheduled` |
        | `driver.accepted` | `request` | `active` |
        | `driver.rejected` | `request` | `cancel` |
        | `location` | `active` | `active` with the new `driverCoords` (requires `coords`) |
        | `driver.paused` | `active` | `stop` |
        | `driver.resumed` | `stop` | `active` |
        | `tracking.finished` | `active`, `stop` | `done` |
        | `webhook.ping` | any | unchanged - resends the current state |
        | `driver.flagged` | any, except pending installation and `scheduled` | unchanged status. Raises the Potential Fraud Alerts listed in `alerts` on the simulated driver's phone (an empty list clears them). They show in `fraudAlerts` while the tracking is `active` or `stop`, for an organization on a PRO or VIP plan |

        **ELD and Hybrid test tracking items** add the carrier's side (the Start, Stop and Cancel links of
        the carrier's approval email):

        | Event | Allowed from | Result |
        | --- | --- | --- |
        | `carrier.approved` | `requestEld` waiting for the carrier, `scheduledEld`, or a hybrid in the driver's app the carrier has not approved (also after `carrier.rejected`) | `activeEld` (the truck's ELD starts reporting). On `scheduledEld` the approval is recorded and the status stays until `schedule.start`, then becomes `activeEld`. On a hybrid the driver already moved, the status stays |
        | `carrier.paused` | approved by the carrier | unchanged status - the truck's ELD stops reporting |
        | `carrier.resumed` | paused by the carrier | unchanged status - the truck's ELD reports again |
        | `carrier.rejected` | any, until the tracking is finished (not twice in a row) | ELD only: `cancelEld`. Hybrid: only the ELD part ends and the status stays, unless the driver declined too (`cancelEld`) |
        | `driver.installed` | hybrid whose driver has no app | `driverHasApp` becomes `true`. A pending one moves into the driver's app with status `requestEld`, one the carrier already started keeps its status |
        | `driver.accepted` | hybrid in the driver's app, `requestEld` or `activeEld` | `activeEld` (the phone reports too) |
        | `driver.rejected` | hybrid in the driver's app, not accepted | unchanged status, or `cancelEld` when the carrier already cancelled |
        | `driver.paused` | hybrid `activeEld` the driver accepted | `stopEld` - the truck's ELD keeps reporting |
        | `driver.resumed` | `stopEld` | `activeEld` |
        | `location` | `activeEld`, or a hybrid `stopEld` | the new `driverCoords`. A fix from the truck's ELD (no live phone) has `battery`, `accuracy` and `locationSource` `null` |
        | `tracking.finished` | `activeEld`, `stopEld` | `doneEld` |
        | `driver.flagged` | hybrid in the driver's app | as above - only while the driver has accepted the tracking |

        A scheduled ELD or Hybrid test tracking that the carrier did not approve by `schedule.start` becomes
        `requestEld` (a hybrid also loses its `schedule`). The `carrier.*` events answer
        `400 TEST_EVENT_INVALID` on a phone-only test tracking.

        An event that is not allowed from the current status returns `400 TEST_EVENT_INVALID`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SimulateEventRequest'
            examples:
              accepted:
                summary: Driver accepts
                value:
                  trackingId: api-test-Zr8pL3nW6yQ1cV5kT9xB
                  event: driver.accepted
              location:
                summary: New driver position
                value:
                  trackingId: api-test-Zr8pL3nW6yQ1cV5kT9xB
                  event: location
                  coords:
                    lat: 39.781721
                    lng: -89.650148
                    speed: 28.6
                    heading: 205
                    battery: 0.82
                    accuracy: 6.5
                    locationSource: gps
              flagged:
                summary: Raise Potential Fraud Alerts
                value:
                  trackingId: api-test-Zr8pL3nW6yQ1cV5kT9xB
                  event: driver.flagged
                  alerts: [vpn, ipOutsideUsCa]
              carrierApproved:
                summary: The carrier approves an ELD or Hybrid test tracking
                value:
                  trackingId: api-test-Gn5vR8kQ2wM7xT4cL9pB
                  event: carrier.approved
      responses:
        '200':
          description: Event applied. `webhook` reports the delivery to your test webhook URL.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimulateResponse'
              examples:
                delivered:
                  summary: Location applied, webhook delivered
                  value:
                    message: Ok
                    data:
                      trackingId: api-test-Zr8pL3nW6yQ1cV5kT9xB
                      status:
                        value: active
                        description: Active
                      driverHasApp: true
                      driverInvite:
                        smsStatus: null
                        smsFailureReason: null
                        smsCount: 0
                        lastSmsAt: null
                        appLink: https://notification.load-market.com/enQZ/sb3to39y
                      customId: null
                      notes: ''
                      loadInstructions: null
                      billingWeight: 1
                      schedule: null
                      emailSettings:
                        reportEmails: []
                        intervalMinutes: null
                        scheduledTimes: null
                        realTimeTrackingLink: true
                        driverAttachedFilesNotification: false
                        stopStatusEmails: false
                      trackingSource: null
                      expDate: 1793707200000
                      stopLocations: []
                      driverCoords:
                        lat: 39.781721
                        lng: -89.650148
                        speed: 28.6
                        battery: 0.82
                        heading: 205
                        accuracy: 6.5
                        locationSource: gps
                        lastUpdate: 1793650527000
                      fraudAlerts:
                        alerts: []
                        signals:
                          jailbrokenDevice: false
                          emulator: false
                          vpn: false
                          ipOutsideUsCa: false
                          gpsOutsideUsCa: false
                        ipLocation: null
                      publicLink: null
                      driverFiles: []
                    events: []
                    webhook:
                      attempted: true
                      status: 200
                      webhookId: msg_2b7c1f0e-5d3a-4c8e-9b61-7a4f0d2e9c35
                      reason: null
                webhooksDisabled:
                  summary: Driver accepted, webhooks not enabled on the test key, organization without PRO (fraudAlerts null)
                  value:
                    message: Ok
                    data:
                      trackingId: api-test-Zr8pL3nW6yQ1cV5kT9xB
                      status:
                        value: active
                        description: Active
                      driverHasApp: true
                      driverInvite:
                        smsStatus: null
                        smsFailureReason: null
                        smsCount: 0
                        lastSmsAt: null
                        appLink: https://notification.load-market.com/enQZ/sb3to39y
                      notes: ''
                      loadInstructions: null
                      billingWeight: 1
                      schedule: null
                      emailSettings:
                        reportEmails: []
                        intervalMinutes: null
                        scheduledTimes: null
                        realTimeTrackingLink: true
                        driverAttachedFilesNotification: false
                        stopStatusEmails: false
                      trackingSource: null
                      expDate: 1793707200000
                      stopLocations: []
                      customId: null
                      driverCoords: null
                      fraudAlerts: null
                      publicLink: null
                      driverFiles: []
                    events:
                      - id: evt_9c1d2e7f4a0b8c3d5e6f7a81
                        type: driver.accepted
                        at: 1793650000000
                        status: active
                        previousStatus: request
                    webhook:
                      attempted: false
                      status: null
                      webhookId: null
                      reason: Webhooks are not enabled on this test key.
        '400':
          description: |
            Codes: `TRACKING_ID_REQUIRED`, `TEST_EVENT_INVALID` (unknown event, missing `coords` for
            `location`, missing or unknown `alerts` for `driver.flagged`, a `carrier.*` event on a
            phone-only test tracking, or the event is not allowed from the current status),
            `TRACKING_NOT_FOUND`.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                trackingIdRequired:
                  summary: TRACKING_ID_REQUIRED
                  value:
                    message: trackingId is required
                    code: TRACKING_ID_REQUIRED
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                eventInvalid:
                  summary: TEST_EVENT_INVALID
                  value:
                    message: Event 'driver.resumed' is not allowed while the tracking is 'active'.
                    code: TEST_EVENT_INVALID
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
                trackingNotFound:
                  summary: TRACKING_NOT_FOUND
                  value:
                    message: No tracking found
                    code: TRACKING_NOT_FOUND
                    requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: '`TEST_MODE_ONLY` - the endpoint was called with a live key.'
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: This endpoint is only available with a test API key.
                code: TEST_MODE_ONLY
                requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'

  /health:
    get:
      tags: [System]
      operationId: getHealth
      summary: Health check
      description: |
        Returns `200` while the API is up. Needs no key and reads no data - use it for uptime monitors.
      security: []
      responses:
        '200':
          description: The API is up.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/XRequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HealthResponse'
              example:
                status: ok
                time: 1793650527000
        '500':
          $ref: '#/components/responses/InternalError'

webhooks:
  trackingUpdate:
    post:
      operationId: trackingUpdateWebhook
      summary: Tracking update
      description: |
        Sent by Load Market to the webhook URL configured on your partner key (enable it through
        support). Only tracking items created with that partner key while webhooks were enabled on it are
        pushed. Once per minute the server collects every such tracking whose driver position, status
        or driver files changed, or that has new `events`, and sends them in **one** `POST` - the body is a
        JSON array, one item per tracking. Each item carries `events` - what happened since the last delivery
        (the driver accepted, declined or paused, the truck arrived at or left a stop, a Smart Arrival Alert
        turned `late`, the carrier approved or refused, a document was uploaded - see `WebhookEvent`) - and
        `data`, the get-tracking shape with three differences: it never contains `stopLocationsEta` or `driverCoords.location`, it carries
        `driverFiles` only when a file was uploaded during the last minute, and `driverCoords` is
        `null` outside the live window (stored status `active`, `stop`, `activeEld` or `stopEld` - see
        get-tracking).
        `fraudAlerts` follows the same window. A change in `fraudAlerts` alone does not send an
        update, the current value arrives with the next one.

        **Authenticity.** When your partner key has a signing secret, every request is signed following
        the [Standard Webhooks](https://www.standardwebhooks.com/) scheme (`webhook-id`,
        `webhook-timestamp`, `webhook-signature`). Keys provisioned before signing existed get no
        signature headers until a secret is issued - ask support for one. When a bearer token is
        configured for your key the request also carries `Authorization: Bearer <token>`.

        **Delivery.** Answer with any `2xx` within 7 seconds. A timeout, a network error, `408`, `429`
        or a `5xx` is retried up to 2 more times with exponential backoff. A `Retry-After` header is
        honored up to 5 seconds (longer values are capped). Any other `4xx` is not retried. Retries of a
        signed request carry the same `webhook-id` - use it to deduplicate. When every attempt failed, the
        tracking's `events` are sent again with its next item (for up to an hour, at most the newest 50), so
        an event can arrive more than once - deduplicate events by their `id`. The snapshot itself is not
        redelivered: the next change brings the current state.

        **Lifecycle.** A tracking sends updates from its create: before it reaches the driver's app (a
        pending installation, a scheduled tracking, an ELD or Hybrid request waiting for the carrier) only
        items with `events` (`carrier.rejected`, `driver.sms_undeliverable`, ...), with `TrackingPendingData`.
        Once it starts (`driver.installed`, `tracking.started`, `carrier.approved`) every change. It stops after
        its final `done`, `doneEld`, `cancel` or `cancelEld` update, or when the driver uninstalls the app or
        deletes the account. The final `done` (or `doneEld`) is also sent after you stop the tracking yourself
        with stop-tracking. A request removed without starting (expired, deleted) sends nothing more.

        Test keys: webhooks are sent only by `POST /test/simulate`, one attempt per call.
      security:
        - {}
        - WebhookBearerAuth: []
      parameters:
        - $ref: '#/components/parameters/WebhookIdHeader'
        - $ref: '#/components/parameters/WebhookTimestampHeader'
        - $ref: '#/components/parameters/WebhookSignatureHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookPayload'
            example:
              - message: Ok
                data:
                  trackingId: api-7fK2mQ9xLpR4tN8vB1cD
                  status:
                    value: active
                    description: Active
                  driverHasApp: true
                  driverInvite:
                    smsStatus: sent
                    smsFailureReason: null
                    smsCount: 1
                    lastSmsAt: 1793628060000
                    appLink: https://notification.load-market.com/enQZ/sb3to39y
                  customId: tms-load-48213
                  notes: Reefer load, keep at 34F.
                  loadInstructions: Call the receiver 30 min before arrival. Dock 12.
                  billingWeight: 1
                  schedule: null
                  emailSettings:
                    reportEmails: []
                    intervalMinutes: null
                    scheduledTimes: null
                    realTimeTrackingLink: true
                    driverAttachedFilesNotification: false
                    stopStatusEmails: false
                  trackingSource: null
                  expDate: 1793800800000
                  publicLink: https://tracking.load-market.com?track=Wd5nR8cK3yT6pJ2mV9sF
                  driverCoords:
                    lat: 39.781721
                    lng: -89.650148
                    speed: 28.6
                    battery: 0.82
                    heading: 205
                    accuracy: 6
                    locationSource: gps
                    lastUpdate: 1793650490000
                  fraudAlerts:
                    alerts: []
                    signals:
                      jailbrokenDevice: false
                      emulator: false
                      vpn: false
                      ipOutsideUsCa: false
                      gpsOutsideUsCa: false
                    ipLocation: null
                  stopLocations: []
                events:
                  - id: evt_3d8e0c41a7b29f6e15c0d2aa
                    type: stop.arrived
                    at: 1793650410000
                    stopIndex: 0
                    customStopId: PU-1
      responses:
        '2XX':
          description: Received. Return quickly and process the payload asynchronously.
        '4XX':
          description: Rejected. Not retried, except `408` and `429` (a `Retry-After` of up to 5 seconds is honored, longer values are capped).
        '5XX':
          description: Your server failed. Retried up to 2 more times.

components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: |
        Partner API key issued by Load Market. Every partner gets a live key and, on request, a test
        key. Required on every endpoint except `/health`. Keep it on your server - never in a browser
        or mobile app.
    ClientKeyAuth:
      type: apiKey
      in: header
      name: x-api-client-key
      description: |
        Organization key from Settings > API Key (organization admins and managers) in the Load Market
        app. Identifies the organization (broker or carrier) the tracking items belong to.
    WebhookBearerAuth:
      type: http
      scheme: bearer
      description: Optional token Load Market sends to your webhook endpoint when one is configured for your key.

  headers:
    XRequestId:
      description: |
        Unique id of this request, also returned as `requestId` in every error body. Quote it when you
        contact support. When you send your own `X-Request-Id` (8-128 characters of `A-Z a-z 0-9 . _ : -`)
        it is echoed back. Otherwise the server generates a UUID.
      schema:
        type: string
        examples: [9607f3c4-ecc9-4321-a3ff-e67040e85dfe]

    RetryAfter:
      description: Seconds to wait before retrying.
      schema:
        type: integer
        examples: [42]

    IdempotentReplayed:
      description: |
        `true` when this is the stored response of an earlier create with the same `Idempotency-Key` - no
        new tracking was created or billed. Absent otherwise.
      schema:
        type: string
        const: 'true'

  parameters:
    IdempotencyKey:
      in: header
      name: Idempotency-Key
      required: false
      description: |
        Makes the create safe to retry. A unique value of 1 to 255 visible ASCII characters without spaces
        (for example a UUID). The same key with the same request answers the first create's response for 24
        hours. See create-tracking.
      schema:
        type: string
        maxLength: 255
        examples: [3f6c1b1e-6a7e-4d0f-9f0b-2a4c0e1d5b77]
    TrackingId:
      in: query
      name: trackingId
      required: true
      description: The `trackingId` returned by create-tracking.
      schema:
        type: string
        examples: [api-7fK2mQ9xLpR4tN8vB1cD]
    WebhookIdHeader:
      in: header
      name: webhook-id
      required: false
      description: |
        Unique message id (`msg_<uuid>`), identical across retries of the same delivery. Use it to
        deduplicate. Sent only when your partner key has a signing secret.
      schema:
        type: string
        examples: [msg_2b7c1f0e-5d3a-4c8e-9b61-7a4f0d2e9c35]
    WebhookTimestampHeader:
      in: header
      name: webhook-timestamp
      required: false
      description: |
        Unix time in SECONDS when the message was signed. Reject messages older than 5 minutes. Sent
        only when your partner key has a signing secret.
      schema:
        type: string
        examples: ['1793650527']
    WebhookSignatureHeader:
      in: header
      name: webhook-signature
      required: false
      description: |
        Space-separated list of signatures, each `v1,<base64 HMAC-SHA256>` of
        `${webhook-id}.${webhook-timestamp}.${raw body}`, keyed with the base64-decoded part of your
        `whsec_...` secret. Accept the message when any entry matches. Sent only when your partner key
        has a signing secret. Keys provisioned before signing existed get no signature headers until a
        secret is issued.
      schema:
        type: string
        examples: ['v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4=']

  responses:
    Unauthorized:
      description: |
        `MISSING_API_KEY` or `INVALID_API_KEY` - the `x-api-key` header is missing, unknown or revoked.
        Known v1 quirk: an unknown path under `/v1` also answers `401` when no valid key is sent.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/XRequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingApiKey:
              summary: MISSING_API_KEY
              value:
                message: Missing access key
                code: MISSING_API_KEY
                requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
            invalidApiKey:
              summary: INVALID_API_KEY
              value:
                message: Invalid access key
                code: INVALID_API_KEY
                requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
    RateLimited:
      description: |
        `RATE_LIMITED` - test keys are limited to 60 requests per minute. Wait the number of seconds in
        `Retry-After`. Live keys have no general rate limit today (fair use, see Rate limits & best
        practices) - only an ELD or Hybrid create answers `RATE_LIMITED` after too many unknown truck
        numbers for one organization in a short time.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/XRequestId'
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            message: Test keys are limited to 60 requests per minute.
            code: RATE_LIMITED
            requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe
    InternalError:
      description: '`INTERNAL_ERROR` - unexpected server error. Retry with backoff and quote `requestId` if it persists.'
      headers:
        X-Request-Id:
          $ref: '#/components/headers/XRequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            message: Internal server error
            code: INTERNAL_ERROR
            requestId: 9607f3c4-ecc9-4321-a3ff-e67040e85dfe

  schemas:
    ErrorResponse:
      type: object
      description: Body of every error response (HTTP 4xx and 5xx).
      required: [message, code, requestId]
      properties:
        message:
          type: string
          description: Human-readable explanation. It may be reworded at any time - branch on `code`, never on `message`.
          examples: [Driver phone number is not valid]
        code:
          $ref: '#/components/schemas/ErrorCode'
        requestId:
          type: string
          description: Same value as the `X-Request-Id` response header. Quote it when you contact support.
          examples: [9607f3c4-ecc9-4321-a3ff-e67040e85dfe]

    ErrorCode:
      type: string
      description: |
        Stable, machine-readable error code. The list is extensible: new codes can be added at any time
        without a new API version, so treat an unknown code by its HTTP status. An existing code is never
        renamed or reused for a different meaning. See the Errors guide for cause and fix of each code.
      enum:
        - MISSING_API_KEY
        - INVALID_API_KEY
        - INVALID_CLIENT_KEY
        - CLIENT_KEY_REQUIRED
        - ORG_IDENTIFIER_REQUIRED
        - ORGANIZATION_NOT_FOUND
        - DRIVER_PHONE_REQUIRED
        - DRIVER_PHONE_INVALID
        - REF_ID_REQUIRED
        - EXP_DATE_REQUIRED
        - EXP_DATE_INVALID
        - EXP_DATE_SCHEDULE_CONFLICT
        - SCHEDULE_INVALID
        - LOAD_INSTRUCTIONS_INVALID
        - EMAIL_UPDATES_INVALID
        - STOP_LOCATION_INVALID
        - EXPECTED_ARRIVAL_INVALID
        - CREATED_BY_TMS_INVALID
        - TRACKING_ID_REQUIRED
        - STOPS_ETA_INVALID
        - LIST_TYPE_INVALID
        - LIST_PARAMS_INVALID
        - NO_ACTIVE_SUBSCRIPTION
        - TRACKING_LIMIT_REACHED
        - PAYMENT_FAILED
        - PRO_PLAN_REQUIRED
        - DRIVER_LOOKUP_FAILED
        - GEOCODING_FAILED
        - TRACKING_NOT_FOUND
        - REPORTS_NOT_FOUND
        - TEST_MODE_ONLY
        - TEST_LIMIT_REACHED
        - TEST_EVENT_INVALID
        - RATE_LIMITED
        - INVALID_JSON
        - ROUTE_NOT_FOUND
        - UPSTREAM_TIMEOUT
        - INTERNAL_ERROR
        - BAD_REQUEST
        - UNAUTHORIZED
        - FORBIDDEN
        - NOT_FOUND
        - TRACKING_SOURCE_INVALID
        - ELD_DATA_INVALID
        - ELD_TRACKING_NOT_AVAILABLE
        - ELD_CARRIER_NOT_INTEGRATED
        - ELD_CONNECTION_UNAVAILABLE
        - ELD_VEHICLE_NOT_FOUND
        - ELD_PROVIDER_UNAVAILABLE
        - ORG_IDENTIFIER_INVALID
        - REF_ID_INVALID
        - CUSTOM_ID_INVALID
        - NOTES_INVALID
        - DRIVER_TYPE_INVALID
        - METADATA_INVALID
        - IDEMPOTENCY_KEY_INVALID
        - IDEMPOTENCY_KEY_REUSED
        - IDEMPOTENCY_IN_PROGRESS

    OkResponse:
      type: object
      required: [message]
      properties:
        message:
          type: string
          examples: [Ok]

    HealthResponse:
      type: object
      required: [status, time]
      properties:
        status:
          type: string
          const: ok
        time:
          type: integer
          format: int64
          description: Server time, epoch milliseconds (UTC).
          examples: [1793650527000]

    Coords:
      type: object
      required: [lat, lng]
      properties:
        lat:
          type: number
          minimum: -90
          maximum: 90
          description: Latitude in decimal degrees. `0` is rejected.
          examples: [41.826772]
        lng:
          type: number
          minimum: -180
          maximum: 180
          description: Longitude in decimal degrees. `0` is rejected.
          examples: [-87.665378]

    StopLocationInput:
      type: object
      description: |
        A stop on the load. Send the full address (`streetName`, `city`, `stateProvince`, `zip`,
        `country`) OR `coordinates`. Without coordinates the address is geocoded. An address that cannot
        be geocoded fails with `400 GEOCODING_FAILED`.
      anyOf:
        - required: [streetName, city, stateProvince, zip, country]
        - required: [coordinates]
      properties:
        streetNumber:
          type: string
          maxLength: 200
          examples: ['3601']
        streetName:
          type: string
          maxLength: 200
          examples: [S Ashland Ave]
        city:
          type: string
          maxLength: 200
          examples: [Chicago]
        stateProvince:
          type: string
          maxLength: 200
          description: Two-letter state or province code.
          examples: [IL]
        zip:
          type: string
          maxLength: 200
          examples: ['60609']
        country:
          type: string
          maxLength: 200
          description: Two-letter country code, `US` or `CA`.
          examples: [US]
        coordinates:
          $ref: '#/components/schemas/Coords'
        customStopId:
          type: string
          maxLength: 200
          description: Your own stop identifier, returned on every read.
          examples: [PU-1]
        expectedArrival:
          type: integer
          format: int64
          description: |
            Appointment time, epoch milliseconds (UTC) - convert the local appointment to UTC before
            sending. Enables Smart Arrival Alerts (`stopAlertStatusInfo`). PRO or VIP plan only: other plans
            get `403 PRO_PLAN_REQUIRED`, except on an edit of a tracking item created on the organization's
            PRO trial.
          examples: [1793635200000]

    CreatedByTms:
      type: object
      description: |
        Contact shown to the driver in the Load Market driver app as the person who requested the
        tracking (instead of a Load Market user).
      required: [companyName, displayName, phoneNumber, email]
      properties:
        companyName:
          type: string
          minLength: 1
          maxLength: 200
          examples: [Prairie Freight Brokers]
        displayName:
          type: string
          minLength: 1
          maxLength: 200
          examples: [Dana Miller]
        phoneNumber:
          type: string
          pattern: '^\+\d{10,15}$'
          description: E.164 format.
          examples: ['+15555550123']
        email:
          type: string
          format: email
          maxLength: 200
          examples: [dana.miller@example.com]
        photoURL:
          type: string
          maxLength: 2000
          description: An `http` or `https` URL of the contact's picture. An empty string means none.
          examples: ['https://example.com/avatars/dana.png']
        hideChat:
          type: boolean
          description: Hide Driver Chat for this tracking.
          examples: [false]

    ScheduleInput:
      type: object
      description: |
        Scheduled tracking window, epoch milliseconds (UTC). The tracking is created with status
        `scheduled`, starts automatically once `start` passes and expires at `end`. `start` must not be
        in the past. The window must be at least 1 hour and at most 240 hours (10 days). A window longer
        than 5 days is billed as 2 tracking requests.
      required: [start, end]
      properties:
        start:
          type: integer
          format: int64
          examples: [1794225600000]
        end:
          type: integer
          format: int64
          examples: [1794484800000]

    EmailUpdatesInput:
      type: object
      description: |
        Automated Location Updates (email updates). Choose the cadence with `intervalMinutes` OR
        `scheduledTimes` (not both), or neither when you only want file or stop-status notifications.
        At least one of `intervalMinutes`, `scheduledTimes`, `driverAttachedFilesNotification`,
        `stopStatusEmails` must be set. Both cadences run for the whole tracking.
      required: [reportEmails]
      properties:
        reportEmails:
          type: array
          items:
            type: string
            format: email
          minItems: 1
          maxItems: 10
          description: 1 to 10 recipients.
          examples: [[dispatch@example.com]]
        intervalMinutes:
          type: integer
          enum: [30, 60, 120, 240]
          description: Fixed report interval in minutes.
          examples: [60]
        scheduledTimes:
          type: object
          description: Daily wall-clock send times instead of a fixed interval.
          required: [times, timeZone]
          properties:
            times:
              type: array
              items:
                type: string
                pattern: '^([01]\d|2[0-3]):[0-5]\d$'
              minItems: 1
              maxItems: 5
              uniqueItems: true
              description: 1 to 5 unique times, `HH:mm` 24-hour.
              examples: [['08:00', '17:30']]
            timeZone:
              type: string
              description: IANA time zone the times are read in.
              examples: [America/Chicago]
        realTimeTrackingLink:
          type: boolean
          default: true
          description: Include the Live Tracking Link to share with your customer (PRO - branded, with live ETA) in the emails. Always `false` for an ELD only tracking.
        driverAttachedFilesNotification:
          type: boolean
          default: false
          description: Email the recipients when the driver uploads a file (BOL, POD).
        stopStatusEmails:
          type: boolean
          default: false
          description: Email the recipients when the driver arrives at or leaves a stop.

    CreateTrackingRequest:
      type: object
      description: |
        Exactly one of `expDate` or `schedule` is required. The organization comes from the
        `x-api-client-key` header, or from `mcNum` / `dotNum` when no client key is sent.

        `driverPhone` is required unless `trackingSource` is `eld`. `eld` is required when
        `trackingSource` is `eld` or `hybrid`, and ignored otherwise.

        Every field is checked against its type and limits below: a value of another type, or over its
        limit, answers `400` with the field's code. Fields not listed here are ignored.
      required: [refId]
      properties:
        mcNum:
          type: integer
          minimum: 1
          description: |
            Organization MC number. Used only without `x-api-client-key`, and wins over `dotNum`. Anything
            but a positive whole number answers `400 ORG_IDENTIFIER_INVALID`.
          examples: [100001]
        dotNum:
          type: integer
          minimum: 1
          description: |
            Organization US DOT number. Used only without `x-api-client-key`. Anything but a positive whole
            number answers `400 ORG_IDENTIFIER_INVALID`.
          examples: [2000002]
        driverPhone:
          type: integer
          description: |
            Driver's US or Canadian mobile phone number as a JSON **number**, 10 digits without the
            country code. An 11-digit number starting with `1` is accepted and the `1` is stripped. The
            driver gets the app link by text message, so a number that no US or Canadian phone can have
            (an area code or exchange starting with `0` or `1`, such as `0004344444` or `1234567890`) is
            rejected with `400 DRIVER_PHONE_INVALID`. Required unless `trackingSource` is `eld`, which
            ignores it.
          examples: [5555550100]
        refId:
          type: string
          minLength: 1
          maxLength: 200
          description: |
            Your load or reference number, shown to the driver and in the Load Market app. Missing or empty
            answers `400 REF_ID_REQUIRED`, another type or more than 200 characters `400 REF_ID_INVALID`.
          examples: [LM-48213 CHI-DAL]
        expDate:
          type: integer
          format: int64
          description: |
            Tracking expiration, epoch milliseconds (UTC), in the future and at most 240 hours (10 days)
            ahead. More than 5 days ahead is billed as 2 tracking requests. Not allowed together with
            `schedule`.
          examples: [1793800800000]
        schedule:
          $ref: '#/components/schemas/ScheduleInput'
        notes:
          type: string
          maxLength: 5000
          description: Internal note, not shown to the driver. Another type or more than 5000 characters answers `400 NOTES_INVALID`.
          examples: [Reefer load, keep at 34F.]
        loadInstructions:
          type: string
          maxLength: 5000
          description: Instructions shown to the driver in the Load Market driver app. Ignored for an ELD only tracking.
          examples: [Call the receiver 30 min before arrival. Dock 12.]
        emailUpdates:
          $ref: '#/components/schemas/EmailUpdatesInput'
        customId:
          type: string
          maxLength: 200
          description: Your own id for the tracking, returned on every read. Another type or more than 200 characters answers `400 CUSTOM_ID_INVALID`.
          examples: [tms-load-48213]
        driverType:
          type: string
          enum: [solo, team]
          default: solo
          description: |
            Case and surrounding spaces do not matter, and an empty string means `solo`. Any other value
            answers `400 DRIVER_TYPE_INVALID`.
        stopLocations:
          type: array
          maxItems: 50
          description: Up to 50 stops.
          items:
            $ref: '#/components/schemas/StopLocationInput'
        createdByTms:
          $ref: '#/components/schemas/CreatedByTms'
        metadata:
          type: object
          additionalProperties: true
          description: |
            Free-form metadata stored with the tracking, a JSON object of up to 20 KB (`400 METADATA_INVALID`
            otherwise). Only `metadata.shipmentId` is returned on reads.
          examples: [{ shipmentId: SHP-48213 }]
        trackingSource:
          type:
            - string
            - 'null'
          description: |
            What tracks the load:

            - `mobile` (default) - the driver's phone.
            - `eld` - the truck's ELD only, no phone. Needs `eld`.
            - `hybrid` - the truck's ELD and the driver's phone. Needs `eld` and `driverPhone`.

            Absent, `null` or an empty string means `mobile`. Case and surrounding spaces do not matter.
            `eld` and `hybrid` need an organization Load Market enabled for ELD tracking
            (`403 ELD_TRACKING_NOT_AVAILABLE`) and the organization's client key. Any other value answers
            `400 TRACKING_SOURCE_INVALID` for such an organization and is ignored for the others. See the
            ELD and Hybrid tracking guide.
          examples: [eld]
        eld:
          $ref: '#/components/schemas/EldTrackingInput'

    EldTrackingInput:
      type: object
      description: |
        The truck an `eld` or `hybrid` tracking follows. The carrier must have connected its ELD to Load
        Market. The create checks the carrier, its ELD connection and the truck before anything is saved.
        A shape error answers `400 ELD_DATA_INVALID`.
      required: [carrierDotNumber, truckNumber]
      properties:
        carrierDotNumber:
          type: integer
          minimum: 1
          description: |
            US DOT number of the carrier whose ELD tracks the truck (not your organization's). A numeric
            string is accepted. A carrier that has not connected its ELD to Load Market answers
            `400 ELD_CARRIER_NOT_INTEGRATED`.
          examples: [3012345]
        truckNumber:
          type: string
          minLength: 1
          maxLength: 100
          description: |
            The truck (unit) number as the carrier's ELD knows it. A number is accepted, surrounding
            spaces are trimmed. A truck the ELD does not know answers `400 ELD_VEHICLE_NOT_FOUND`, and so
            does a truck whose ELD plan does not include location tracking (the ELD would never send its
            location).
          examples: ['1042']
        providerId:
          type: string
          description: |
            Optional. Leave it out and the carrier's connected, working ELD is used - the right choice for
            almost every integration. Send it only when Load Market told you which of the carrier's
            ELD connections to use. A provider the carrier has not connected answers
            `400 ELD_DATA_INVALID`, one that is not working right now `400 ELD_CONNECTION_UNAVAILABLE`.
        approvalEmails:
          type: array
          items:
            type: string
            format: email
          maxItems: 10
          description: |
            Optional. Who receives the carrier's approval email (up to 10, duplicates are removed). Every
            address must be on the carrier's own company email domain, or on the carrier's own list of
            approval emails, and public email providers (such as Gmail or Yahoo) are not accepted -
            `400 ELD_DATA_INVALID` otherwise. Without it the email goes to the carrier's own approval
            list, or to the carrier's company email.
          examples: [[dispatch@acme-freight.com]]

    CreateTrackingResponse:
      type: object
      required: [message, trackingId, customId, status, driverHasApp, billingWeight, apiUsage]
      properties:
        message:
          type: string
          description: '`Tracking request created`, `Pending tracking created` or `Scheduled tracking created`. ELD and Hybrid answer `Tracking request created` (or `Scheduled tracking created`) also while they wait for the carrier.'
          examples: [Tracking request created]
        trackingId:
          type: string
          description: Id of the new tracking. Keep it - every other endpoint takes it.
          examples: [api-7fK2mQ9xLpR4tN8vB1cD]
        customId:
          type:
            - string
            - 'null'
          examples: [tms-load-48213]
        status:
          $ref: '#/components/schemas/StatusObject'
        driverHasApp:
          type: boolean
          description: '`true` when the phone number already belongs to a Load Market driver app user. Always `false` for an ELD only tracking.'
        billingWeight:
          type: integer
          enum: [1, 2]
          description: Tracking requests consumed - 2 when the tracking spans more than 5 days.
        schedule:
          $ref: '#/components/schemas/Schedule'
        apiUsage:
          $ref: '#/components/schemas/ApiUsage'
        testMode:
          type: boolean
          const: true
          description: Present (and `true`) only when the tracking was created with a TEST key.

    EditTrackingRequest:
      type: object
      description: |
        Fields to change. Only the fields you send are updated. Each one is checked like on create: a
        value of another type, or over its limit, answers `400` with the field's code.
      properties:
        refId:
          type: string
          minLength: 1
          maxLength: 200
          description: An empty string or `null` answers `400 REF_ID_INVALID` - leave the field out to keep the current reference.
          examples: [LM-48213 CHI-DAL]
        notes:
          type: string
          maxLength: 5000
          examples: [Receiver moved the appointment to 10:00 CT.]
        customId:
          type: string
          maxLength: 200
          examples: [tms-load-48213]
        driverType:
          type: string
          enum: [solo, team]
          description: Case and surrounding spaces do not matter, and an empty string changes nothing.
        stopLocations:
          type: array
          maxItems: 50
          description: |
            Replaces the whole stop list (up to 50 stops). An empty array is ignored. A stop that is still the
            same stop (the same `customStopId` within 100 m, or without ids the same position and place - see
            edit-tracking) keeps its arrival/departure confirmations and Smart Arrival Alerts status. Any other
            stop starts without them.
          items:
            $ref: '#/components/schemas/StopLocationInput'
        createdByTms:
          $ref: '#/components/schemas/CreatedByTms'

    EditTrackingResponse:
      type: object
      required: [message, trackingId, customId, status]
      properties:
        message:
          type: string
          description: '`Tracking request updated` or `Pending tracking updated`.'
          examples: [Tracking request updated]
        trackingId:
          type: string
          examples: [api-7fK2mQ9xLpR4tN8vB1cD]
        customId:
          type:
            - string
            - 'null'
          examples: [tms-load-48213]
        status:
          description: |
            The stored status, without the live refinements (`notMoving`, `waiting`, `settings`,
            `noAccount`, `uninstallAccount`) - call get-tracking for the live status.
          allOf:
            - $ref: '#/components/schemas/StatusObject'

    StatusObject:
      type: object
      required: [value, description]
      description: Tracking status. See the Tracking lifecycle guide for when each value appears.
      properties:
        value:
          $ref: '#/components/schemas/TrackingStatus'
        description:
          type: string
          description: Human-readable status, as shown in the Load Market app.
          examples: [Pending driver's approval]

    TrackingStatus:
      type: string
      description: |
        | Value | Description | Meaning |
        | --- | --- | --- |
        | `request` | Pending driver's approval / Pending installation | Waiting for the driver to accept, or to install the app |
        | `scheduled` | Scheduled tracking | Waiting for `schedule.start` |
        | `active` | Active | Location is being shared |
        | `notMoving` | Not moving | The tracking is active, but the truck has not been moving for a while |
        | `waiting` | Waiting for an update | The tracking is active, but no new position has arrived for a while, for example because the phone is offline or has no coverage |
        | `settings` | Driver's device is in Power Save mode, this might disable GPS tracking. / Driver's location permission is not set to ALWAYS. / Driver's location accuracy is not set to PRECISE. | The tracking is active, but a phone setting on the driver's device, such as power-save mode, location permission or precise location, may stop tracking. A location permission or precise-location issue is no longer reported once live positions from the driver's phone show that the setting was turned back on, until the phone reports its settings again |
        | `stop` | Paused by the driver | The driver paused sharing |
        | `cancel` | Rejected by driver | The driver declined the request |
        | `done` | Tracking finished | Stopped through the API or app, or expired |
        | `noAccount` | The driver deleted account | The driver deleted the Load Market account |
        | `uninstallAccount` | The driver uninstalled the app | The driver removed the app |
        | `requestEld` | Pending ELD admin approval | ELD or Hybrid: waiting for the carrier to approve (a hybrid also for the driver to accept) |
        | `scheduledEld` | Scheduled ELD | ELD or Hybrid: waiting for `schedule.start` |
        | `activeEld` | Active ELD | ELD or Hybrid: location is being shared |
        | `stopEld` | Paused by the driver (ELD continuing) | Hybrid: the driver paused the phone, the truck's ELD keeps reporting |
        | `cancelEld` | Rejected by ELD admin | ELD or Hybrid: the carrier refused (a hybrid only once the driver declined too) |
        | `doneEld` | ELD tracking finished | ELD or Hybrid: stopped through the API or app, or expired |

        Only one status is reported at a time. `noAccount` and `uninstallAccount` can appear while the
        tracking is `request`, `active`, `stop` or `stopEld`.

        New status values may be added over time. Handle an unknown value gracefully and show
        `status.description`.
      # Deliberately NOT an `enum`: new values can be added without a new API version, and a strict
      # enum makes generated clients (Java, C#, ...) fail on a value they do not know.
      examples: [active]

    Schedule:
      type:
        - object
        - 'null'
      description: Scheduled tracking window, epoch milliseconds (UTC). `null` for tracking items that were not scheduled.
      required: [start, end]
      properties:
        start:
          type: integer
          format: int64
          examples: [1794225600000]
        end:
          type: integer
          format: int64
          examples: [1794484800000]

    EmailSettings:
      type:
        - object
        - 'null'
      description: |
        Effective Automated Location Updates (email updates) settings. `null` only for tracking items
        created in the Load Market web app without email settings. Tracking items created through the
        API always return an object (`reportEmails` is `[]` when none were set).
      properties:
        reportEmails:
          type: array
          items:
            type: string
          examples: [[dispatch@example.com]]
        intervalMinutes:
          type:
            - integer
            - 'null'
          description: Fixed interval in minutes. `null` when daily times are used or no report is scheduled.
          examples: [60]
        scheduledTimes:
          type:
            - object
            - 'null'
          properties:
            times:
              type: array
              items:
                type: string
              examples: [['08:00', '17:30']]
            timeZone:
              type: string
              examples: [America/Chicago]
        realTimeTrackingLink:
          type: boolean
        driverAttachedFilesNotification:
          type: boolean
        stopStatusEmails:
          type: boolean

    ApiUsage:
      type: object
      description: |
        Plan usage after this tracking was created. With a TEST key: the current usage, nothing
        consumed.
      properties:
        planName:
          type: string
          description: The plan's name (for example `Premium`), `Free` or `VIP`.
          examples: [Premium]
        totalTrackings:
          type: integer
          description: Tracking requests included in the current billing period (plus any granted extra).
          examples: [300]
        usedTrackings:
          type: integer
          description: Tracking requests used in the current period, including this one.
          examples: [128]
        currentPeriodEnd:
          type:
            - integer
            - 'null'
          format: int64
          description: End of the current billing period, epoch milliseconds (UTC). `null` on the Free plan, absent on the VIP plan.
          examples: [1794484800000]

    LocationStatusEvent:
      type:
        - object
        - 'null'
      properties:
        confirm:
          type: boolean
        date:
          type: integer
          format: int64
          description: Epoch milliseconds (UTC).
          examples: [1793635620000]

    StopAlertStatusInfo:
      type:
        - object
        - 'null'
      description: |
        Smart Arrival Alert status, computed by the server for active tracking items whose stop has `expectedArrival`
        (PRO plan). `null` on a stop without `expectedArrival`, also when an edit removed it after a status was computed.
      properties:
        stopAlertStatus:
          type:
            - string
            - 'null'
          enum: [ahead, onTime, tight, late, null]
          description: |
            `onTime`, `tight` or `late`. `ahead` is no longer returned since 2.1.0, `onTime` now covers it.
            `null` until the first computation, and while the arrival cannot be estimated: the driver deleted
            the app account or uninstalled the app and the driver's phone was the only source of the truck's
            position (on a Mobile tracking item `status` then reads `noAccount` or `uninstallAccount`). A stop
            the driver already reached keeps its status. A stop the driver has not reached reads `late` within
            about 15 minutes after its `expectedArrival`. A truck inside the stop's geofence gets up to an hour
            after `expectedArrival` for its arrival to be recorded before it turns `late`.
        calculatedArrival:
          type:
            - integer
            - 'null'
          format: int64
          description: Predicted arrival, epoch milliseconds (UTC). `null` while the arrival cannot be estimated.
        lastCheck:
          type:
            - integer
            - 'null'
          format: int64
          description: Last computation, epoch milliseconds (UTC).

    StopLocationResponse:
      type: object
      description: A stop as returned by get-tracking, list items and webhooks (pending tracking items included).
      properties:
        streetName:
          type: string
          examples: [S Ashland Ave]
        streetNumber:
          type: string
          examples: ['3601']
        city:
          type: string
          examples: [Chicago]
        stateProvince:
          type: string
          examples: [IL]
        zip:
          type: string
          examples: ['60609']
        country:
          type: string
          examples: [US]
        formattedAddress:
          type: string
          examples: [3601 S Ashland Ave, Chicago, IL 60609]
        latitude:
          type:
            - number
            - 'null'
          examples: [41.826772]
        longitude:
          type:
            - number
            - 'null'
          examples: [-87.665378]
        customStopId:
          type:
            - string
            - 'null'
          description: |
            Your `customStopId`, or `null` when the stop was sent without one. Absent on tracking items
            created in the Load Market web app.
          examples: [PU-1]
        expectedArrival:
          type:
            - integer
            - 'null'
          format: int64
          description: Appointment time, epoch milliseconds (UTC), when set.
          examples: [1793635200000]
        locationStatus:
          type: object
          description: Arrival and departure confirmations (geofence or driver).
          properties:
            arrived:
              $ref: '#/components/schemas/LocationStatusEvent'
            completed:
              $ref: '#/components/schemas/LocationStatusEvent'
        stopAlertStatusInfo:
          $ref: '#/components/schemas/StopAlertStatusInfo'

    DriverLocation:
      type: object
      description: |
        Reverse-geocoded driver address, city level. Present only on get-tracking with
        `requestDriverAddress=true` when it could be resolved (never in webhooks).
      properties:
        streetName:
          type: string
          description: Always `''` (the address is resolved to city level only).
          examples: ['']
        streetNumber:
          type: string
          description: Always `''` (the address is resolved to city level only).
          examples: ['']
        city:
          type: string
          description: May be missing when the geocoder returns no city.
          examples: [Springfield]
        stateProvince:
          type: string
          description: Two-letter state or province code, `''` outside the US and Canada.
          examples: [IL]
        zip:
          type: string
          description: May be missing when the geocoder returns no postal code.
          examples: ['62701']
        country:
          type: string
          description: Two-letter country code.
          examples: [US]
        formattedAddress:
          type: string
          description: '`<city>, <zip> <state>`, with `-` in place of an unknown zip.'
          examples: [Springfield, 62701 IL]

    DriverCoords:
      type:
        - object
        - 'null'
      description: |
        Latest driver position, published only while the tracking is live: stored status `active`,
        `stop`, `activeEld` or `stopEld` (the derived `notMoving`, `waiting` and `settings` come from
        `active`). On an ELD or Hybrid tracking the position may come from the truck's ELD. `null` for every
        other status (`request`, `cancel`, `done`, the other ELD statuses, pending installation and scheduled tracking items),
        when no position is available yet, or when the last sample had no valid fix (invalid positions
        are never published). Positions are stored per driver, so outside the live window the latest fix may
        belong to another load.
      properties:
        lat:
          type: number
          examples: [39.781721]
        lng:
          type: number
          examples: [-89.650148]
        speed:
          type:
            - number
            - 'null'
          description: Meters per second. `null` when the source reports no speed.
          examples: [28.6]
        battery:
          type:
            - number
            - 'null'
          minimum: 0
          maximum: 1
          description: Phone battery level as a 0-1 fraction. `null` when not reported, and always for a position from the truck's ELD.
          examples: [0.82]
        heading:
          type:
            - number
            - 'null'
          description: Direction of travel in degrees (0 = north, clockwise). `null` when unknown.
          examples: [205]
        accuracy:
          type:
            - number
            - 'null'
          description: Position accuracy in meters. `null` when not reported, and always for a position from the truck's ELD.
          examples: [6]
        locationSource:
          type:
            - string
            - 'null'
          enum: [gps, cell-tower, null]
          description: How the phone position was obtained (`cell-tower` covers cell and Wi-Fi positioning). `null` when not reported, and always for a position from the truck's ELD.
        lastUpdate:
          type: integer
          format: int64
          description: Time of the position, epoch milliseconds (UTC). For a position from the truck's ELD, the time the ELD recorded it.
          examples: [1793650490000]
        location:
          $ref: '#/components/schemas/DriverLocation'

    StopLocationEta:
      type: object
      description: Traffic-based ETA (Esri routing with live traffic, Mapbox driving-traffic when Esri does not answer) from the driver's last position to one stop.
      properties:
        stopIndex:
          type: integer
          description: Zero-based index into `stopLocations`.
          examples: [1]
        distance:
          type: object
          properties:
            text:
              type: string
              description: Driving distance in whole miles.
              examples: [687 mi]
            value:
              type: number
              description: Meters.
              examples: [1105622]
        duration:
          type: object
          properties:
            text:
              type: string
              description: Days, hours and minutes, for example `1 day 2 hours 5 mins` or `45 mins`.
              examples: [11 hours 2 mins]
            value:
              type: number
              description: Seconds of traffic-based driving time.
              examples: [39720]

    DriverFile:
      type: object
      description: File the driver uploaded in the app (for example a BOL or POD photo).
      properties:
        fileId:
          type: string
          examples: [Yb2mX7qK4pL9sT1wR6nC]
        name:
          type: string
          examples: [bol-48213.jpg]
        date:
          type: integer
          format: int64
          description: Upload time, epoch milliseconds (UTC).
          examples: [1793638080000]
        url:
          type: string
          description: Download URL.
          examples: ['https://firebasestorage.googleapis.com/v0/b/example/o/bol-48213.jpg']
        type:
          type: string
          description: Document type chosen by the driver, `BOL` or `POD`.
          examples: [BOL]

    FraudAlerts:
      type:
        - object
        - 'null'
      description: |
        Potential Fraud Alerts (PRO): signals about the driver's phone while it tracks this load. Filled
        for organizations on a PRO or VIP plan, and for tracking items created on the organization's PRO
        trial, while the tracking is live (stored status `active` or `stop`, the same window as
        `driverCoords`, and for a hybrid `activeEld` / `stopEld` once the driver accepted it in the app).
        `null` when the tracking item has no PRO features, outside the live window, always for an ELD only
        tracking (there is no phone), or when the signals could not be read at that moment.

        A signal is not proof of fraud. Review the load and contact the carrier before you act, and never
        cancel or hold a load on an alert alone.

        | Code | Raised when |
        | --- | --- |
        | `jailbrokenDevice` | The driver's phone is jailbroken or rooted |
        | `emulator` | The driver app runs on an emulator, not on a physical phone |
        | `vpn` | The driver's phone uses a VPN |
        | `ipOutsideUsCa` | The phone's internet connection (IP address) resolves outside the US and Canada |
        | `gpsOutsideUsCa` | The phone's own positions place it outside the US and Canada |

        The signals describe the driver's phone, not one load. They show the current state and stay until
        a later check clears them. A change does not send a webhook on its own, the current value arrives
        with the next update.

        New codes may be added over time. Ignore a code you do not know.
      required: [alerts, signals, ipLocation]
      properties:
        alerts:
          type: array
          description: The codes whose signal is `true`, in the order of the table above. Empty when nothing is raised.
          # Deliberately NOT an `enum` (same reason as TrackingStatus): new codes can be added without a
          # new API version, and a strict enum makes generated clients fail on a code they do not know.
          items:
            type: string
          examples:
            - [vpn, ipOutsideUsCa]
        signals:
          $ref: '#/components/schemas/FraudSignals'
        ipLocation:
          $ref: '#/components/schemas/FraudIpLocation'

    FraudSignals:
      type: object
      description: |
        One entry per signal: `true` = raised, `false` = checked and clear, `null` = the driver's phone has
        not reported it yet (for example an older app version).
      required: [jailbrokenDevice, emulator, vpn, ipOutsideUsCa, gpsOutsideUsCa]
      properties:
        jailbrokenDevice:
          type:
            - boolean
            - 'null'
          description: The phone is jailbroken or rooted.
        emulator:
          type:
            - boolean
            - 'null'
          description: The driver app runs on an emulator, not on a physical phone.
        vpn:
          type:
            - boolean
            - 'null'
          description: The phone uses a VPN.
        ipOutsideUsCa:
          type:
            - boolean
            - 'null'
          description: The phone's internet connection (IP address) resolves outside the US and Canada.
        gpsOutsideUsCa:
          type:
            - boolean
            - 'null'
          description: |
            The phone's own positions place it outside the US and Canada. Roaming can make a phone abroad
            look domestic to `ipOutsideUsCa`, never to this signal.

    FraudIpLocation:
      type:
        - object
        - 'null'
      description: |
        Where the driver's internet connection (IP address) resolves to. Filled only while
        `ipOutsideUsCa` is `true`, otherwise `null`. It is approximate and can be far from the truck,
        for example behind a VPN. The IP address itself is never returned.
      required: [country, countryName, stateProvince, city, zip]
      properties:
        country:
          type:
            - string
            - 'null'
          description: ISO 3166-1 alpha-2 country code.
          examples: [DE]
        countryName:
          type:
            - string
            - 'null'
          examples: [Germany]
        stateProvince:
          type:
            - string
            - 'null'
          examples: [Berlin]
        city:
          type:
            - string
            - 'null'
          examples: [Berlin]
        zip:
          type:
            - string
            - 'null'
          examples: ['10115']

    TrackingData:
      type: object
      description: |
        Full view of a tracking that exists in the driver's app or was approved by the carrier (regular
        tracking): get-tracking, test simulate and webhook payloads. A pending installation, a not yet
        started scheduled tracking, or an ELD or Hybrid tracking still waiting for the carrier is returned
        as `TrackingPendingData` instead.
      required: [trackingId, status, driverHasApp, customId, loadInstructions, billingWeight, schedule, emailSettings, trackingSource, expDate, publicLink, driverCoords, fraudAlerts, stopLocations, driverInvite]
      properties:
        trackingId:
          type: string
          examples: [api-7fK2mQ9xLpR4tN8vB1cD]
        status:
          $ref: '#/components/schemas/StatusObject'
        driverHasApp:
          type: boolean
          description: '`true` for a regular phone tracking. Always `false` for an ELD only tracking. A hybrid has `true` once its driver is known (the carrier can approve before the driver installs the app).'
        customId:
          type:
            - string
            - 'null'
          examples: [tms-load-48213]
        notes:
          type: string
          examples: [Reefer load, keep at 34F.]
        loadInstructions:
          type:
            - string
            - 'null'
          description: Instructions shown to the driver in the app.
          examples: [Call the receiver 30 min before arrival. Dock 12.]
        billingWeight:
          type: integer
          enum: [1, 2]
          description: Tracking requests consumed - 2 for tracking items longer than 5 days.
        schedule:
          $ref: '#/components/schemas/Schedule'
        emailSettings:
          $ref: '#/components/schemas/EmailSettings'
        trackingSource:
          type:
            - string
            - 'null'
          description: '`eld` or `hybrid` for ELD and Hybrid tracking items, `null` for phone tracking items created through the API. Tracking items created in the Load Market web app carry their own value (`mobile`, `eld` or `hybrid`).'
        expDate:
          type: integer
          format: int64
          description: Expiration, epoch milliseconds (UTC).
          examples: [1793800800000]
        publicLink:
          type:
            - string
            - 'null'
          description: Live Tracking Link to share with your customer (PRO - branded, with live ETA). `null` for test tracking items.
          examples: ['https://tracking.load-market.com?track=Wd5nR8cK3yT6pJ2mV9sF']
        metadata:
          $ref: '#/components/schemas/TrackingMetadata'
        driverCoords:
          $ref: '#/components/schemas/DriverCoords'
        fraudAlerts:
          $ref: '#/components/schemas/FraudAlerts'
        stopLocations:
          type: array
          items:
            $ref: '#/components/schemas/StopLocationResponse'
        stopLocationsEta:
          type: array
          description: |
            Present only on get-tracking when `requestStopsEta` was sent, the tracking has stops and a
            live driver position exists (never in webhooks). A stop whose ETA cannot be computed, or an
            index that does not exist, is left out.
          items:
            $ref: '#/components/schemas/StopLocationEta'
        driverFiles:
          type: array
          description: |
            Files the driver uploaded. Always present on get-tracking, in live webhooks only when a file
            was uploaded during the last minute. Always empty for test tracking items.
          items:
            $ref: '#/components/schemas/DriverFile'
        driverInvite:
          $ref: '#/components/schemas/DriverInvite'
        driverDetails:
          $ref: '#/components/schemas/DriverDetails'
        phoneSettings:
          $ref: '#/components/schemas/PhoneSettings'

    DriverDetails:
      type:
        - object
        - 'null'
      description: |
        Present only on get-tracking with `requestDriverDetails=true`: the driver of the tracking item and the device
        that tracks it, as the driver app reports them. `null` for an ELD only tracking item (no phone), a Hybrid one
        whose driver has not installed the app yet, a driver who deleted the account, or when the details could not
        be read - `message` then says why. A field the app has not reported is `null`. The phone's location settings
        are a separate field, `phoneSettings` (`requestPhoneSettings=true`).
      required: [name, phone, photoUrl, accountCreatedAt, appVersion, appLanguage, device]
      properties:
        name:
          type:
            - string
            - 'null'
          examples: [Mike Johnson]
        phone:
          type:
            - string
            - 'null'
          description: E.164 format.
          examples: ['+15555550100']
        photoUrl:
          type:
            - string
            - 'null'
          description: The driver's profile picture (download URL), `null` when the driver has none.
        accountCreatedAt:
          type:
            - integer
            - 'null'
          format: int64
          description: When the driver created the Load Market account, epoch milliseconds (UTC).
          examples: [1781280000000]
        appVersion:
          type:
            - string
            - 'null'
          description: Version of the Load Market driver app on the phone.
          examples: [8.1.0]
        appLanguage:
          type:
            - string
            - 'null'
          description: Language the driver app runs in (ISO 639-1).
          examples: [en]
        device:
          type: object
          required: [manufacturer, model, systemName, systemVersion]
          properties:
            manufacturer:
              type:
                - string
                - 'null'
              examples: [Apple]
            model:
              type:
                - string
                - 'null'
              examples: [iPhone 15]
            systemName:
              type:
                - string
                - 'null'
              examples: [iOS]
            systemVersion:
              type:
                - string
                - 'null'
              examples: ['18.1']

    PhoneSettings:
      type:
        - object
        - 'null'
      description: |
        Present only on get-tracking with `requestPhoneSettings=true`: the location settings of the phone that tracks
        the tracking item, as the driver app reports them - what the `settings` status is about. A value the phone has
        not reported, or that live positions from the phone have since proved out of date, is `null` (not known).
        `null` as a whole for an ELD only tracking item (no phone), a Hybrid one whose driver has not installed the
        app yet, a driver who deleted the account, or when the settings could not be read - `message` then says why.
      required: [locationPermission, locationAccuracy, powerSaveMode]
      properties:
        locationPermission:
          type:
            - string
            - 'null'
          description: '`always` is what tracking needs. Others - `whenInUse`, `deniedForever`, `restricted`, `notDetermined` - can stop it. New values may be added.'
          examples: [always]
        locationAccuracy:
          type:
            - string
            - 'null'
          description: '`precise` or `reduced` (reduced positions can be kilometers off).'
          examples: [precise]
        powerSaveMode:
          type:
            - boolean
            - 'null'
          description: The phone's power-save mode, which may stop background tracking.

    TrackingPendingData:
      type: object
      description: |
        A tracking that is not in the driver's app yet: pending installation (the driver has not
        installed the app), scheduled and not started, or an ELD or Hybrid tracking waiting for the
        carrier's approval (`requestEld`, `scheduledEld`, or `cancelEld` when the carrier refused it). It
        has no position, no Live Tracking Link and no driver files. Once the driver installs the app, the
        schedule starts or the carrier approves, the same `trackingId` is returned as `TrackingData`.
      required: [trackingId, status, driverHasApp, driverPhone, customId, loadInstructions, billingWeight, schedule, emailSettings, trackingSource, expDate, stopLocations, driverInvite]
      properties:
        trackingId:
          type: string
          examples: [api-Qm3xT8vN2kLp9RfW4bYc]
        status:
          $ref: '#/components/schemas/StatusObject'
        driverHasApp:
          type: boolean
          description: '`false` for pending installation, and always for an ELD only tracking. A scheduled tracking or a hybrid waiting for the carrier reports whether the phone already had the app at create time.'
        driverPhone:
          type:
            - string
            - 'null'
          description: Driver phone in E.164 format. `null` for an ELD only tracking.
          examples: ['+15555550100']
        customId:
          type:
            - string
            - 'null'
        notes:
          type: string
        loadInstructions:
          type:
            - string
            - 'null'
        billingWeight:
          type: integer
          enum: [1, 2]
        schedule:
          $ref: '#/components/schemas/Schedule'
        emailSettings:
          $ref: '#/components/schemas/EmailSettings'
        trackingSource:
          type:
            - string
            - 'null'
          description: '`eld` or `hybrid` for ELD and Hybrid tracking items, `null` for phone tracking items created through the API. Tracking items created in the Load Market web app carry their own value (`mobile`, `eld` or `hybrid`).'
        expDate:
          type: integer
          format: int64
          description: Expiration, epoch milliseconds (UTC).
          examples: [1793800800000]
        metadata:
          $ref: '#/components/schemas/TrackingMetadata'
        stopLocations:
          type: array
          items:
            $ref: '#/components/schemas/StopLocationResponse'
        driverInvite:
          $ref: '#/components/schemas/DriverInvite'

    DriverInvite:
      type:
        - object
        - 'null'
      description: |
        The text messages Load Market sends the driver for this tracking - the app invite and its reminders, or
        the new-load text for a driver who already has the app - and whether the number can receive them. `null`
        for an ELD only tracking (no phone). When the driver can never receive a text (`undeliverable`,
        `optedOut`), share `appLink` with the driver another way: a request waits with status `request`
        ("Pending installation") until the driver installs the app.
      required: [smsStatus, smsFailureReason, smsCount, lastSmsAt, appLink]
      properties:
        smsStatus:
          type:
            - string
            - 'null'
          enum: [sent, undeliverable, optedOut, null]
          description: |
            - `sent` - at least one text was sent for this tracking. A temporary delivery problem is not
              reported here, only a number that can never receive a text.
            - `undeliverable` - the number can never receive a text (`smsFailureReason`).
            - `optedOut` - the number replied STOP. No text is sent to it until it replies START.
            - `null` - no text is on record for this tracking yet.
        smsFailureReason:
          type:
            - string
            - 'null'
          description: Why `undeliverable` - `invalid-number` (no US or Canadian mobile number) or `not-mobile` (a landline). `null` otherwise. New values may be added.
          examples: [not-mobile]
        smsCount:
          type: integer
          minimum: 0
          description: Texts on record for this tracking (the invite and its reminders, or the new-load text). A send that failed for a temporary reason is counted too.
          examples: [2]
        lastSmsAt:
          type:
            - integer
            - 'null'
          format: int64
          description: The last text, epoch milliseconds (UTC). `null` when none was sent.
          examples: [1793628060000]
        appLink:
          type: string
          description: Link to the Load Market driver app in the app stores - the link the texts carry.
          examples: ['https://notification.load-market.com/enQZ/sb3to39y']

    TrackingMetadata:
      type: object
      description: Present only when `metadata.shipmentId` was set on create. Other metadata keys are stored but not returned.
      properties:
        shipmentId:
          type: string
          examples: [SHP-48213]

    GetTrackingResponse:
      type: object
      required: [message, data]
      properties:
        message:
          type: string
          description: '`Ok`, or an explanation when a requested enrichment (ETA, driver address, driver details, phone settings) could not be added.'
          examples: [Ok]
        data:
          oneOf:
            - $ref: '#/components/schemas/TrackingData'
            - $ref: '#/components/schemas/TrackingPendingData'

    TrackingItemCoords:
      type:
        - object
        - 'null'
      description: |
        Latest stored driver position of a live list item - stored status `active`, `stop`, `activeEld`
        or `stopEld` (best effort, get-tracking is authoritative). `battery`, `accuracy` and
        `locationSource` are `null` for a position from the truck's ELD. `null` for every other status (history items are
        always `null`), for pending installation and scheduled items, when
        no position exists yet, or when the last sample had no valid fix.
      properties:
        lat:
          type: number
          examples: [39.781721]
        lng:
          type: number
          examples: [-89.650148]
        speed:
          type:
            - number
            - 'null'
          description: Meters per second.
        battery:
          type:
            - number
            - 'null'
          minimum: 0
          maximum: 1
        heading:
          type:
            - number
            - 'null'
        accuracy:
          type:
            - number
            - 'null'
        locationSource:
          type:
            - string
            - 'null'
          enum: [gps, cell-tower, null]
        lastUpdate:
          type: integer
          format: int64
          examples: [1793650490000]

    TrackingItem:
      type: object
      description: Slim list item. Call get-tracking for email settings, driver files, ETA and addresses.
      required: [trackingId, status, createdAt, expDate, driverHasApp]
      properties:
        trackingId:
          type: string
          examples: [api-7fK2mQ9xLpR4tN8vB1cD]
        status:
          $ref: '#/components/schemas/StatusObject'
        createdAt:
          type: integer
          format: int64
          description: Creation time, epoch milliseconds (UTC).
          examples: [1793628000000]
        expDate:
          type: integer
          format: int64
          description: Expiration, epoch milliseconds (UTC). The history window applies to this field.
          examples: [1793800800000]
        notes:
          type: string
        loadInstructions:
          type:
            - string
            - 'null'
        billingWeight:
          type: integer
          enum: [1, 2]
        schedule:
          $ref: '#/components/schemas/Schedule'
        customId:
          type:
            - string
            - 'null'
        referenceId:
          type:
            - string
            - 'null'
          description: The `refId` sent on create.
          examples: [LM-48213 CHI-DAL]
        trackingSource:
          type:
            - string
            - 'null'
          description: '`eld` or `hybrid` for ELD and Hybrid tracking items, `null` for phone tracking items created through the API. Tracking items created in the Load Market web app carry their own value (`mobile`, `eld` or `hybrid`).'
        publicLink:
          type:
            - string
            - 'null'
          description: Live Tracking Link to share with your customer. `null` for pending installation and scheduled items, for ELD and Hybrid items waiting for the carrier, and for test tracking items.
        stopLocations:
          type: array
          items:
            $ref: '#/components/schemas/StopLocationResponse'
        metadata:
          $ref: '#/components/schemas/TrackingMetadata'
        driverHasApp:
          type: boolean
          description: Same rules as `driverHasApp` on get-tracking - always `false` for an ELD only tracking.
        driverCoords:
          $ref: '#/components/schemas/TrackingItemCoords'
        driverInvite:
          $ref: '#/components/schemas/DriverInvite'

    TrackingItemPagination:
      type: object
      description: Present on history responses only.
      required: [nextCursor]
      properties:
        nextCursor:
          type:
            - string
            - 'null'
          description: Opaque cursor for the next page, `null` on the last page. Pass it back as `cursor`.

    ListTrackingItemsResponse:
      type: object
      required: [message, data]
      properties:
        message:
          type: string
          examples: [Ok]
        data:
          type: array
          items:
            $ref: '#/components/schemas/TrackingItem'
        pagination:
          $ref: '#/components/schemas/TrackingItemPagination'

    TrackingReport:
      type: object
      properties:
        location:
          type: string
          description: Nearest place name, or the coordinates as text when none could be resolved.
          examples: [Chicago, IL]
        lat:
          type: number
          examples: [41.826772]
        lng:
          type: number
          examples: [-87.665378]
        date:
          type: string
          format: date-time
          description: ISO-8601 string in UTC (v1 quirk - not epoch milliseconds).
          examples: ['2026-11-02T16:10:00.000Z']

    TrackingReportsResponse:
      type: object
      required: [message, data]
      properties:
        message:
          type: string
          examples: [Ok]
        data:
          type: array
          items:
            $ref: '#/components/schemas/TrackingReport'

    SimulateCoords:
      type: object
      description: New driver position. Required when `event` is `location`, ignored otherwise.
      required: [lat, lng]
      properties:
        lat:
          type: number
          minimum: -90
          maximum: 90
          examples: [39.781721]
        lng:
          type: number
          minimum: -180
          maximum: 180
          examples: [-89.650148]
        speed:
          type:
            - number
            - 'null'
          minimum: 0
          description: 'Meters per second. Optional, `null` or absent publishes `speed: null`.'
          examples: [28.6]
        heading:
          type:
            - number
            - 'null'
          minimum: 0
          maximum: 360
          description: 'Degrees, 0 = north, clockwise. Optional, `null` or absent publishes `heading: null`.'
          examples: [205]
        battery:
          type:
            - number
            - 'null'
          minimum: 0
          maximum: 1
          description: 'Device battery as a 0-1 fraction. Optional, `null` or absent publishes `battery: null`. A fix from the truck''s ELD always publishes `null`.'
          examples: [0.82]
        accuracy:
          type:
            - number
            - 'null'
          minimum: 0
          description: 'Fix accuracy in meters. Optional, `null` or absent publishes `accuracy: null`. A fix from the truck''s ELD always publishes `null`.'
          examples: [6.5]
        locationSource:
          type:
            - string
            - 'null'
          enum: [gps, cell-tower, null]
          description: 'How the phone got the fix. Optional, `null` or absent publishes `gps`. A fix from the truck''s ELD always publishes `null`.'
          examples: [gps]

    SimulateEventRequest:
      type: object
      required: [trackingId, event]
      properties:
        trackingId:
          type: string
          description: A tracking created with the same TEST key.
          examples: [api-test-Zr8pL3nW6yQ1cV5kT9xB]
        event:
          type: string
          description: The `carrier.*` events apply to ELD and Hybrid test tracking items only. See the transition tables of `POST /test/simulate`.
          enum:
            - driver.installed
            - driver.accepted
            - driver.rejected
            - location
            - driver.paused
            - driver.resumed
            - tracking.finished
            - webhook.ping
            - driver.flagged
            - carrier.approved
            - carrier.rejected
            - carrier.paused
            - carrier.resumed
        coords:
          $ref: '#/components/schemas/SimulateCoords'
        alerts:
          type: array
          description: |
            Required when `event` is `driver.flagged`, ignored otherwise. The Potential Fraud Alerts codes
            to raise on the simulated driver's phone. An empty list clears them.
          items:
            type: string
            enum: [jailbrokenDevice, emulator, vpn, ipOutsideUsCa, gpsOutsideUsCa]
          examples:
            - [vpn, ipOutsideUsCa]

    WebhookDeliveryResult:
      type: object
      description: Outcome of the single webhook attempt made for this simulated event.
      required: [attempted, status, webhookId, reason]
      properties:
        attempted:
          type: boolean
          description: '`false` when webhooks are not enabled or no URL is configured on the test key.'
        status:
          type:
            - integer
            - 'null'
          description: HTTP status your endpoint returned, or `null` when not attempted or no response arrived (timeout, network error).
          examples: [200]
        webhookId:
          type:
            - string
            - 'null'
          description: The `webhook-id` header value that was sent, or `null` when not attempted or when the test key has no signing secret.
          examples: [msg_2b7c1f0e-5d3a-4c8e-9b61-7a4f0d2e9c35]
        reason:
          type:
            - string
            - 'null'
          description: Why the delivery was not attempted or failed, or `null` on success.

    SimulateResponse:
      type: object
      required: [message, data, events, webhook]
      properties:
        message:
          type: string
          examples: [Ok]
        data:
          description: The tracking after the event.
          oneOf:
            - $ref: '#/components/schemas/TrackingData'
            - $ref: '#/components/schemas/TrackingPendingData'
        events:
          type: array
          description: |
            The webhook event the simulated event stands for - the same `type` - as the webhook item carries it.
            Empty for `location`, `webhook.ping` and `driver.flagged`, which change only the snapshot.
          items:
            $ref: '#/components/schemas/WebhookEvent'
        webhook:
          $ref: '#/components/schemas/WebhookDeliveryResult'

    WebhookItem:
      type: object
      required: [message, data, events]
      properties:
        message:
          type: string
          examples: [Ok]
        data:
          description: |
            Same shape as the get-tracking `data`, but never with `stopLocationsEta` or
            `driverCoords.location`. It carries `driverFiles` only when a file was uploaded during the last minute,
            and `driverCoords` is `null` outside the live window. A tracking in the driver's app carries
            `TrackingData`. A tracking not in the app yet (a pending installation, a scheduled tracking, an ELD or
            Hybrid request waiting for the carrier) carries `TrackingPendingData`, and only with `events` (for
            example the carrier's `carrier.rejected`). A test `webhook.ping` on a pending test tracking carries
            `TrackingPendingData` too.
          oneOf:
            - $ref: '#/components/schemas/TrackingData'
            - $ref: '#/components/schemas/TrackingPendingData'
        events:
          type: array
          description: |
            What happened to this tracking since the last delivery, oldest first - empty when only the snapshot
            changed (a new position). `data` is the state at the time of the delivery, which can be newer than
            the last event. An event can arrive more than once: deduplicate by its `id`.
          items:
            $ref: '#/components/schemas/WebhookEvent'

    WebhookEvent:
      type: object
      required: [id, type, at]
      description: |
        One thing that happened to a tracking. Only the fields that apply to the `type` are present.

        | `type` | When |
        | --- | --- |
        | `driver.installed` | A pending installation became a tracking in the driver's app (the driver installed it and signed in) |
        | `driver.accepted` | The driver accepted the tracking in the app |
        | `driver.rejected` | The driver declined it (on a Hybrid tracking: declined the phone side) |
        | `driver.paused` | The driver paused sharing (`stop`, or `stopEld` on a Hybrid tracking) |
        | `driver.resumed` | The driver resumed sharing |
        | `driver.sms_undeliverable` | The driver's number can never receive a text (`reason`) - see `driverInvite` |
        | `driver.sms_opted_out` | The driver's number replied STOP - see `driverInvite` |
        | `tracking.started` | A scheduled tracking started |
        | `tracking.finished` | The tracking finished (`done` or `doneEld`): stopped through the API or app, or expired |
        | `carrier.approved` | The carrier approved the ELD side |
        | `carrier.rejected` | The carrier refused or cancelled the ELD side |
        | `carrier.paused` | The carrier paused the ELD side |
        | `carrier.resumed` | The carrier resumed the ELD side |
        | `stop.arrived` | The truck arrived at a stop (`stopIndex`, `customStopId`) |
        | `stop.departed` | The truck left a stop |
        | `stop.arrival_cleared` | A user of the Load Market web app marked a confirmed arrival as not arrived |
        | `stop.departure_cleared` | A user of the Load Market web app marked a confirmed departure as not completed |
        | `stop.alert_status_changed` | A stop's Smart Arrival Alert changed (`stopAlertStatus`, `previousStopAlertStatus`, PRO) |
        | `document.uploaded` | The driver uploaded a file (`fileId`, `fileType`), listed in `data.driverFiles` |

        New types may be added over time. Ignore a type you do not know.
      properties:
        id:
          type: string
          description: Stable id of the event - the same event delivered again has the same id.
          examples: [evt_3d8e0c41a7b29f6e15c0d2aa]
        type:
          type: string
          # Deliberately NOT an `enum` (same reason as TrackingStatus): new types can be added without a new
          # API version, and a strict enum makes generated clients fail on a type they do not know.
          examples: [stop.arrived]
        at:
          type: integer
          format: int64
          description: When it happened, epoch milliseconds (UTC) - the time the app, the ELD or the server recorded.
          examples: [1793644890000]
        status:
          type: string
          description: The tracking's stored status after the event (`driver.*`, `tracking.*` and `carrier.*` types). A Hybrid tracking whose carrier refused keeps its status - only the ELD side ended.
          examples: [stop]
        previousStatus:
          type:
            - string
            - 'null'
          description: The stored status before the event.
          examples: [active]
        stopIndex:
          type: integer
          description: Zero-based index into `stopLocations` (`stop.*` types).
          examples: [1]
        customStopId:
          type:
            - string
            - 'null'
          description: Your `customStopId` of that stop, `null` when the stop has none (`stop.*` types).
          examples: [DEL-2]
        stopAlertStatus:
          type: string
          description: The new Smart Arrival Alert status - `onTime`, `tight` or `late` (`stop.alert_status_changed`).
          examples: [late]
        previousStopAlertStatus:
          type:
            - string
            - 'null'
          description: The status before, `null` on the first computation.
          examples: [tight]
        fileId:
          type: string
          description: The uploaded file's `fileId` in `driverFiles` (`document.uploaded`).
        fileType:
          type:
            - string
            - 'null'
          description: The document type the driver chose, for example `BOL` or `POD` (`document.uploaded`).
        reason:
          type: string
          description: Why the number cannot receive a text - `invalid-number` or `not-mobile` (`driver.sms_undeliverable`).

    WebhookPayload:
      type: array
      description: Batched tracking updates - one item per tracking that changed during the last minute.
      items:
        $ref: '#/components/schemas/WebhookItem'
