# Loads

> List, create, read, change, assign and track loads with the Techvia TMS public API: filters, stops, documents, status, notes, arrival and departure.

Source: https://techvia.software/docs/tms/guides/loads/

## List loads: `GET /api/public/v1/loads` (scope `loads.read`)

Newest first. All filters are optional and can be combined.

| Query | Meaning |
|---|---|
| `status` | One status name, exactly as written in [Status values](/docs/tms/concepts/statuses/) (for example `EnRoute`; case matters). Anything else is a `422` |
| `customerId`, `driverId`, `carrierId` | TMS ids |
| `pickupFrom`, `pickupTo` | First pickup on or after / on or before this date (`YYYY-MM-DD`, UTC days). 1900-01-01 to 9999-12-31; `9999-12-31` works as "no end date". For no start date, leave the "from" filter out (`0001-01-01` is a `422`). A "from" after its "to" is a `422` |
| `deliveryFrom`, `deliveryTo` | Last delivery on or after / on or before this date (`YYYY-MM-DD`, UTC days). Same range and rule as the pickup dates |
| `search` | Part of the load number or work order number. At most 100 characters, no control characters |
| `page` | Page number, from 1 (default 1) up to 42949672 |
| `pageSize` | 1 to 50 (default 50) |

```
curl -H "Authorization: Bearer $TMS_KEY" \
  "https://tms-api.techvia.software/api/public/v1/loads?status=Covered&pickupFrom=2026-12-01&pageSize=2"
```

```json
{
  "items": [
    {
      "id": "01a20943-75ec-7d91-9309-8c400cddd516",
      "loadNumber": "LD-2026-000123",
      "workOrderNumber": "WO-4471",
      "status": "Covered",
      "equipment": "Reefer",
      "customerName": "Acme Foods",
      "dispatcherName": "Dana Ruiz",
      "origin": "Acme DC Dallas",
      "destination": "FreshMart Phoenix",
      "pickupDate": "2026-12-01T15:00:00+00:00",
      "pickupLocal": "2026-12-01T09:00:00-06:00",
      "pickupTimeZoneId": "America/Chicago",
      "deliveryDate": "2026-12-02T16:00:00+00:00",
      "deliveryLocal": "2026-12-02T09:00:00-07:00",
      "deliveryTimeZoneId": "America/Phoenix",
      "assignmentMode": "Driver",
      "assignedTo": "Sam Lee",
      "rowVersion": 825,
      "isSample": false,
      "finalRate": 2475.00
    }
  ],
  "page": 1, "pageSize": 2, "total": 1, "hasMore": false, "sort": []
}
```

`finalRate` is present only for a key with `billing.read` or `loads.rates`. `pickupDate`/`deliveryDate` are UTC;
`pickupLocal`/`deliveryLocal` are the same instants as the wall clock at the facility, with its offset (null when the
facility has no time zone): show those to people. `isSample` is `true` only for the sample load a new
workspace starts with (number `SAMPLE-1`); skip it if your script should see only your own loads.

## Create a load: `POST /api/public/v1/loads` (scope `loads.write`)

The new load starts `Open` (no carrier, driver or truck yet). Send an `Idempotency-Key` header ([Idempotency](/docs/tms/concepts/idempotency/)) so a
retry never makes a second load.

```
curl -X POST -H "Authorization: Bearer $TMS_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: 6f1c2a52-3d0e-4d7e-9b5e-1f0c8d1e2a77" \
  -d '{
    "customerId": "01a20943-75ec-78ad-9764-7a1d1cc95684",
    "workOrderNumber": "WO-4471",
    "equipment": "Reefer",
    "stops": [
      { "facilityId": "01a20943-7600-7c11-8a2e-111111111111", "type": "Shipper",
        "scheduledDate": "2026-12-01T09:00:00-06:00", "commodity": "Produce", "weightLbs": 38000 },
      { "address": { "name": "FreshMart Phoenix", "street": "9 Market St", "city": "Phoenix", "state": "AZ", "zip": "85001" },
        "type": "Consignee", "scheduledDate": "2026-12-02T09:00:00-07:00" }
    ]
  }' \
  https://tms-api.techvia.software/api/public/v1/loads
```

| Field | Meaning |
|---|---|
| `customerId` | Required. One of your customers (`GET /api/public/v1/customers`), active and not blacklisted |
| `dispatcherId` | One of your dispatchers (`GET /api/public/v1/dispatchers`). Left out: the workspace's default dispatcher, the oldest active one (the owner's, unless it was made inactive). An inactive dispatcher, or no active dispatcher at all, is a `422` |
| `workOrderNumber` | The customer's reference or PO number, at most 100 characters |
| `equipment` | `DryVan`, `Flatbed`, `Reefer`, `Tanker`, `StepDeck` or `Other` (exact case) |
| `type` | `Spot` (default), `Dedicated` or `Contract` (exact case) |
| `stops` | Required, 2 to 50, in the order the truck visits them: the first a `Shipper` (pickup), the last a `Consignee` (delivery). A stop may not be scheduled before the stop before it |
| `stops[].facilityId` or `stops[].address` | Exactly one. `facilityId` is one of your active facilities (`GET /api/public/v1/facilities`). `address` (`name`, `city`, `state` required, state at most 50 characters; `street`, `zip`, `country`), at most 10 per call: matched to one of your facilities (the same name, city and state; or the same street, city, ZIP and state; or the same place on the map) and a new facility is created only when none matches. Without a `street` only the exact name, city and state can match. Finding the place on the map is one address lookup from your workspace's monthly allowance (the plan's place lookups, the same allowance the app's address search uses); when it is used up (or your plan has none) the stop is refused and nothing is looked up; a lookup that fails on the map provider's side gives its unit back, uses no request quota and keeps no answer on your `Idempotency-Key`, so retrying with the same key looks the address up again (lookups made for earlier stops of that call were billed and stay used; the message says how many). An address that cannot be found, has no street and no exact match, or would need a lookup past the allowance is a `422` on `stops[n].address` |
| `stops[].type` | `Shipper` or `Consignee` (exact case) |
| `stops[].scheduledDate` | Required. The appointment, ISO 8601, between 2000 and 2100. With an offset (`2026-12-01T09:00:00-06:00`, `...Z`) it is that instant. Without one (`2026-12-01T09:00:00`, or a date alone = midnight) it is the local time at that stop's facility, in the facility's time zone; a facility with no time zone needs the offset (`422`). Each stop must be at or after the stop before it |
| `stops[].appointmentConfirmed`, `commodity`, `quantity`, `weightLbs`, `referenceNumber`, `notes` | Optional |
| `rate` | Customer rate in USD, 0 to 99,999,999.99, at most 2 decimals. Needs `loads.rates` |
| `otherCharges` | `[{ "type", "description", "amount" }]`, `type` one of your workspace's load charge types (for example `OtherCharge`, `Detention`), `amount` 0 to 99,999,999.99 with at most 2 decimals; at most 50. Needs `loads.rates` |
| `allowDuplicate` | `true` to create it although this customer already has a load with this `workOrderNumber` |

- The answer is `201` with a `Location` header and the new load as `GET /api/public/v1/loads/{id}` returns it, but
  never with `rate`, `finalRate` or `otherCharges` (a retry can replay it to another key of your workspace). Read the
  load with a `billing.read` key to see them.
- Names (customer, dispatcher, facility) are always taken from your records, never from the request.
- A blacklisted or inactive customer, an inactive dispatcher and an inactive facility are refused (`422` "This customer is
  blacklisted in your workspace..."): a person books those in the TMS app.
- Everything is checked before anything is saved: a refused create leaves no new facility behind. The body is at most
  256 KB (`413`).
- `rate` or `otherCharges` without `loads.rates` is a `422` naming the scope; nothing is created and no quota is used.
- **Duplicate reference.** When this customer already has a load (not cancelled) with the same `workOrderNumber`
  (case and spaces ignored), the answer is `409` with `code` `duplicate_load`, `canOverride: true`, `existingId` (that
  load) and `candidates` (up to 5: `id`, `name` = load number, `detail` = its stored reference). To create it anyway,
  send the request again with `"allowDuplicate": true` and a **new** `Idempotency-Key` (the old key is bound to the
  refused request).
- The load's timeline and History show "API key: &lt;key name&gt;" as the creator, and a facility made from an address shows
  the key in that facility's History.

## Read one load: `GET /api/public/v1/loads/{id}` (scope `loads.read`)

```
curl -H "Authorization: Bearer $TMS_KEY" https://tms-api.techvia.software/api/public/v1/loads/01a20943-75ec-7d91-9309-8c400cddd516
```

```json
{
  "id": "01a20943-75ec-7d91-9309-8c400cddd516",
  "loadNumber": "LD-2026-000123",
  "workOrderNumber": "WO-4471",
  "status": "Covered",
  "type": "Spot",
  "equipment": "Reefer",
  "customer": { "id": "01a20943-75ec-78ad-9764-7a1d1cc95684", "name": "Acme Foods" },
  "dispatcherName": "Dana Ruiz",
  "assignment": { "mode": "Driver", "driverNames": ["Sam Lee"], "truck": "T-101", "trailer": "R-22", "carrierName": null },
  "rowVersion": 825,
  "stops": [
    {
      "id": "01a20943-7611-7d01-9309-8c400cddd601",
      "order": 1, "type": "Shipper", "facilityName": "Acme DC Dallas",
      "scheduledDate": "2026-12-01T15:00:00+00:00", "scheduledLocal": "2026-12-01T09:00:00-06:00",
      "timeZoneId": "America/Chicago", "appointmentConfirmed": true,
      "commodity": "Produce", "quantity": 22, "weightLbs": 38000.00, "referenceNumber": "PO-88123",
      "notes": "Check in at gate 4", "arrivedAt": null, "departedAt": null
    },
    {
      "id": "01a20943-7611-7d01-9309-8c400cddd602",
      "order": 2, "type": "Consignee", "facilityName": "FreshMart Phoenix",
      "scheduledDate": "2026-12-02T16:00:00+00:00", "scheduledLocal": "2026-12-02T09:00:00-07:00",
      "timeZoneId": "America/Phoenix", "appointmentConfirmed": false,
      "commodity": null, "quantity": null, "weightLbs": null, "referenceNumber": null,
      "notes": null, "arrivedAt": null, "departedAt": null
    }
  ],
  "createdAt": "2026-11-23T16:35:45.886322+00:00",
  "updatedAt": "2026-11-23T16:35:45.886322+00:00",
  "isSample": false,
  "notes": [
    { "id": "01a20943-7700-7a00-9309-8c400cddd700", "createdAt": "2026-12-01T16:10:00+00:00",
      "by": "API key: Claude", "text": "Driver called: 30 min late" }
  ],
  "rate": 2400.00,
  "finalRate": 2575.00,
  "otherCharges": [ { "id": "01a20943-7800-7b00-9309-8c400cddd801", "type": "Lumper", "description": "Lumper at pickup", "amount": 75.00 } ],
  "autoCharges": [ { "id": "01a20943-7800-7b00-9309-8c400cddd802", "type": "Detention", "description": "Detention at Acme DC Dallas — 2.0h over 2.0h free", "amount": 100.00 } ]
}
```

- `rate`, `finalRate`, `otherCharges` and `autoCharges` are present for a key with `billing.read` or `loads.rates` (a key
  that may change the rate and charges sees them).
  `otherCharges` are the charges people added, in the order they were added; `autoCharges` are made by the TMS
  (detention worked out from the stop times) and are never added or removed by a key. `finalRate` is the rate plus both.
  A charge `id` names a line for `removeChargeIds`; ids change whenever the load's charges are saved, so read the load
  again before the next change (its `rowVersion` makes a stale call a `409` anyway). Carrier-side charges and cost are
  never shown.
- Each stop has its `id`, for `update_load` and the arrival/departure calls.
- `notes` are the notes added with `add_load_note` (the newest 100, oldest first): when, by which key, and the text. The
  load's own notes field in the TMS app is not part of the API.
- Times are UTC instants. `scheduledDate` is an appointment at the facility; `scheduledLocal` is the same instant as
  the wall clock at the facility with its offset (`2026-12-01T09:00:00-06:00` is 9 in the morning in Chicago), in the
  stop's `timeZoneId` (an IANA zone name). Show people `scheduledLocal`, never the UTC hour. Both are null when the
  facility has no time zone. `arrivedAt` and `departedAt` are when the truck actually arrived and left (UTC).
- `assignment`: in `Carrier` mode the carrier, its drivers and its truck; in `Driver` mode your drivers and truck.
- `isSample`: `true` for the sample load a new workspace starts with, as in the list.
- An id from another workspace and an id that does not exist both return the same `404`.

## Documents of a load (scope `loads.read`)

Read only (no upload). `GET /api/public/v1/loads/{id}/documents` lists the documents of a load, newest first, 200 at
most: `id`, `loadId`, `category` (`BOL`, `POD`, `RateCon`, `CarrierInvoice`, `Receipt`, `Other`), `fileName`, `contentType`,
`sizeBytes`, `source` and `createdAt`. `GET /api/public/v1/documents/{id}/link` returns `{ "url": ..., "expiresAt": ... }`,
a presigned download link that lives 2 minutes at most. Ask again when it has expired. Treat the link as a secret: we do not
log it, and you should not either.

- Only `BOL`, `POD`, `Receipt` and `Other` documents are open to every `loads.read` key. `RateCon` and `CarrierInvoice` carry the carrier's pay, and any category added later is treated the same way: without `loads.rates` on the key they are not in the
  list, and a link request for one is the same `404` as for a document that does not exist.
- A load or document of another workspace, an unknown id and a file still being uploaded are all `404`.

## Change the status: `PATCH /api/public/v1/loads/{id}/status` (scope `loads.write`)

Send the new status and the `rowVersion` from your last read of the load. Both are required. `status` must be one of
the six names a key may set ([Status values](/docs/tms/concepts/statuses/)), written exactly (case matters). Any other value (an unknown or not-allowed
name, a different case, a number, `null`) is a `422` whose `errors.status` lists the allowed values.

```
curl -X PATCH -H "Authorization: Bearer $TMS_KEY" -H "Content-Type: application/json" \
  -d '{"status":"AtPickup","rowVersion":825}' \
  https://tms-api.techvia.software/api/public/v1/loads/01a20943-75ec-7d91-9309-8c400cddd516/status
```

```json
{ "id": "01a20943-75ec-7d91-9309-8c400cddd516", "loadNumber": "LD-2026-000123", "status": "AtPickup", "rowVersion": 828 }
```

- The change follows the same rules as the TMS app (for example, `Covered` needs a carrier, truck or driver on the
  load) and has the same effects: the load's timeline and History show it as made by "API key: &lt;key name&gt;", and
  marking a load `Delivered` notifies your dispatchers.
- Use the returned `rowVersion` for your next change. A `rowVersion` that is no longer current returns `409`, so a
  call that is retried after it succeeded is not applied twice. On a `409`, read the load again and decide.
- Sending the status the load already has is accepted (`200`) and changes nothing: the response carries the same
  `rowVersion`, and nothing is added to the timeline. The `rowVersion` must still be current.

## Change a load: `PATCH /api/public/v1/loads/{id}` (scope `loads.write`)

Send the `rowVersion` from your last read and only the fields you want to change; everything you leave out stays as it
is (including what a key cannot see, such as the carrier cost, and the load's status and assignment).

```
curl -X PATCH -H "Authorization: Bearer $TMS_KEY" -H "Content-Type: application/json" \
  -d '{"rowVersion":825,"equipment":"Flatbed","stops":[
        {"id":"01a20943-7611-7d01-9309-8c400cddd601","referenceNumber":"PO-88124"},
        {"facilityId":"01a20943-7600-7c11-8a2e-333333333333","type":"Shipper","scheduledDate":"2026-12-01T14:00:00"},
        {"id":"01a20943-7611-7d01-9309-8c400cddd602"}]}' \
  https://tms-api.techvia.software/api/public/v1/loads/01a20943-75ec-7d91-9309-8c400cddd516
```

| Field | Meaning |
|---|---|
| `rowVersion` | Required, from your last read. Not current: `409` (read the load again). Missing or `0`: `422` |
| `workOrderNumber` | At most 100 characters; `""` clears it. A reference this customer already uses on another load is a `409` `duplicate_load` (as on create); send `"allowDuplicate": true` to keep it |
| `equipment`, `type` | As on create |
| `stops` | When sent, the **whole** new stop list in visiting order (2 to 50, first a `Shipper`, last a `Consignee`, each at or after the one before); a stop left out is removed. An existing stop by its `id` (from the read) with only the fields to change: `facilityId`, `type`, `scheduledDate`, `appointmentConfirmed`, `commodity`, `quantity`, `weightLbs`, `referenceNumber`, `notes` (text `""` clears). A new stop has no `id` and needs `facilityId`, `type` and `scheduledDate`. Dates as on create (no offset = local time at that stop's facility). A new stop takes a `facilityId` only (addresses are for `create_load`). An existing stop keeps its recorded arrival and departure unless it moves to another facility |
| `rate` | Needs `loads.rates`, as on create |
| `addCharges` | Needs `loads.rates`. New lines `[{ "type", "description", "amount" }]` (as on create, at most 50), added after the stored ones. A line of a type the TMS already bills by itself on this load (for example `Detention` once an automatic detention line exists) is a `422`, whatever its description, so it is never billed twice |
| `removeChargeIds` | Needs `loads.rates`. Ids of lines from `otherCharges` to remove (at most 50). An id that is not a line people added on this load (an `autoCharges` line, another load's, unknown) is a `422` |
| `otherCharges` | Not accepted (`422`): a key never replaces the whole charge list. Every line not named in `removeChargeIds` stays exactly as stored, deductions (negative amounts) included |
| `status` | Not changed here: any value is a `422` pointing to `PATCH .../status` |
| `customerId`, `dispatcherId` | Not changed with a key: any value is a `422` (a person changes the customer and dispatcher in the TMS app). Other unknown fields are ignored |
| `carrierId`, `carrierCost` | Not changed here: any value is a `422` pointing to `PUT .../assignment` (`assign_load`) |

- The change runs through the same rules as an edit in the TMS app, and History shows "API key: &lt;key name&gt;".
- The answer is the load as `GET` returns it, with the new `rowVersion`. A body with only `rowVersion` changes nothing.
- A billed load (status `Invoiced`, or an invoice issued for it) keeps its customer, rate, charges, references and stops:
  changing them is a `422` that says why (the same rule as the app), keyed on the fields you sent (`rate`,
  `workOrderNumber`, `stops`, `addCharges`, `removeChargeIds`).

## Assign a load: `PUT /api/public/v1/loads/{id}/assignment` (scope `loads.write`)

Who carries the load: **either** a carrier **or** your own fleet. The assignment you send replaces the one the load had.

```
curl -X PUT -H "Authorization: Bearer $TMS_KEY" -H "Content-Type: application/json" \
  -d '{"rowVersion":825,"carrierId":"01a20943-7a00-7c11-8a2e-444444444444",
       "carrierDriverIds":["01a20943-7a00-7c11-8a2e-555555555555"],"carrierCost":1850.00}' \
  https://tms-api.techvia.software/api/public/v1/loads/01a20943-75ec-7d91-9309-8c400cddd516/assignment
```

| Field | Meaning |
|---|---|
| `rowVersion` | Required, from your last read. Not current: `409`. Missing or `0`: `422` |
| `carrierId` | A carrier of your workspace (`list_carriers`). Another workspace's or an unknown id is a `422`. A **blacklisted** or **inactive** carrier is a `422`; a carrier with **expired insurance** is the `422` `carrier_insurance_expired`, which only a person can override in the TMS app |
| `carrierDriverIds`, `carrierTruckId` | Optional, with `carrierId`: that carrier's drivers (the first is the primary driver, at most 10) and truck. An id of another carrier is a `422` |
| `carrierCost` | Optional, with `carrierId`: what you pay the carrier, USD, 0 to 99,999,999.99, at most 2 decimals. Needs `loads.rates` (`422` otherwise). Left out: the stored cost stays. It is never shown in any answer |
| `driverIds`, `truckId`, `trailerId` | Your own fleet instead: `truckId` and at least one driver (the first is the primary driver, at most 10) are required, `trailerId` is optional |

- Sending both a carrier and own-fleet fields, or neither, is a `422`.
- An `Open` load becomes `Covered`. A load that is `Completed`, `Invoiced`, `Cancelled` or `TONU` keeps its assignment (`422`).
- The change runs through the TMS app's own load edit, so its rules apply and the timeline and History show "API key:
  &lt;key name&gt;". Re-sending the carrier a load already has does not check it again (so a carrier blacklisted later never
  blocks changing its drivers). The answer is the load as `GET` returns it.

## Remove the assignment: `DELETE /api/public/v1/loads/{id}/assignment?rowVersion=825` (scope `loads.write`)

No carrier, driver, truck or trailer afterwards; a `Covered` load goes back to `Open`. `rowVersion` is required in the
query (`422` without it, `409` when not current). The stored carrier cost stays (send `carrierCost` on the next assign).
A load carried by no one is answered as it is, with nothing changed. A load already in transit (`AtPickup`, `EnRoute`,
`AtDelivery`, `Delivered`) or `Completed`, `Invoiced`, `Cancelled` or `TONU` keeps its assignment: `422` on `status`
("A person must change the carrier on a load already in transit; use TMS."). The TMS app can still change it.

## Add a note: `POST /api/public/v1/loads/{id}/notes` (scope `loads.write`)

```
curl -X POST -H "Authorization: Bearer $TMS_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: 5d0c2b41-1b7e-4f1a-9a77-0c2c1e5f9b10" \
  -d '{"text":"Driver called: 30 min late"}' \
  https://tms-api.techvia.software/api/public/v1/loads/01a20943-75ec-7d91-9309-8c400cddd516/notes
```

`201` with `{ "id", "createdAt", "by", "text" }`. `text` is required, at most 990 characters. Notes are never changed
or removed: each one is added to the load's timeline (shown in the TMS app with its time and "API key: &lt;key name&gt;")
and listed in `notes` when you read the load. Adding a note does not change the load's `rowVersion`. Send an
`Idempotency-Key` so a retry does not add it twice.

## Record arrival and departure: `PUT /api/public/v1/loads/{id}/stops/{stopId}/arrival` and `.../departure` (scope `loads.write`)

```
curl -X PUT -H "Authorization: Bearer $TMS_KEY" -H "Content-Type: application/json" \
  -d '{"at":"2026-12-01T09:05:00"}' \
  https://tms-api.techvia.software/api/public/v1/loads/01a20943-75ec-7d91-9309-8c400cddd516/stops/01a20943-7611-7d01-9309-8c400cddd601/arrival
```

- `at` is optional: left out (or an empty body) is now. With an offset it is that instant; without one, the local time
  at the stop's facility. More than a day ahead is a `422`.
- The same rules as the TMS app's arrival and departure buttons: the earliest arrival wins (a later one changes
  nothing), a stop has one departure (a second changes nothing), and detention is worked out from the two times by your
  workspace's detention settings (shown in `autoCharges`). A departure before any arrival, or before the arrival, is a
  `422`, so nothing is silently skipped.
- The load's timeline shows "Arrived @ &lt;facility&gt; (API key: &lt;key name&gt;)". The answer is the load as `GET` returns it.
  An unknown stop or load is `404`. A call that collides with another change of the same load at that moment is a `409`
  ("Retry the call"); these calls take no `rowVersion`.
