# Customers, carriers, drivers, trucks, trailers, dispatchers and facilities

> Read your customers, carriers, drivers, trucks, trailers, dispatchers and facilities with the Techvia TMS public API (scope directory.read).

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

Read only. Five resources, each with a list and a read-one:

| Resource | List | One |
|---|---|---|
| Customers | `GET /api/public/v1/customers` | `GET /api/public/v1/customers/{id}` |
| Carriers | `GET /api/public/v1/carriers` | `GET /api/public/v1/carriers/{id}` |
| Drivers | `GET /api/public/v1/drivers` | `GET /api/public/v1/drivers/{id}` |
| Trucks | `GET /api/public/v1/trucks` | `GET /api/public/v1/trucks/{id}` |
| Trailers | `GET /api/public/v1/trailers` | `GET /api/public/v1/trailers/{id}` |

Every list is sorted by name (last, then first name for drivers; unit number for trucks and trailers) and takes:

| Query | Meaning |
|---|---|
| `search` | Text, at most 100 characters, no control characters. Case-insensitive "contains" on the name (customers and carriers also on their MC number, carriers also on their DOT; trucks and trailers on the unit number). Only fields the API returns are searched. Otherwise `422` |
| `page` | 1 or more. Default 1 |
| `pageSize` | 1 to 50. Default 50. More is a `422` |

The list body is `{ "items": [...], "page", "pageSize", "total", "hasMore", "sort" }`. An id that does not exist and an
id from another workspace give the same `404`. Fields that are not stored are `null`.

| Resource | Fields (and nothing else) |
|---|---|
| Customer | `id`, `name`, `mcType`, `mcNumber`, `city`, `state`, `status`, `contactName`, `phone`, `email` (the primary contact; city and state of the physical address), `rowVersion` |
| Carrier | `id`, `name`, `mcNumber`, `dotNumber`, `status`, `insuranceExpiry` (the earliest expiry among the liability, auto and cargo certificates), `phone`, `email` (the primary contact), `scac`, `rowVersion` |
| Driver | `id`, `name`, `status`, `phone`, `currentTruck`, `currentLoadNumber` |
| Truck | `id`, `unitNumber`, `type`, `status`, `currentDriverName` |
| Trailer | `id`, `unitNumber`, `type`, `status` |

Two more lists, with the same `search`, `page` and `pageSize` and no read-one, so you can fill in a load:

| Resource | List | Fields | `search` matches |
|---|---|---|---|
| Dispatchers | `GET /api/public/v1/dispatchers` | `id`, `name`, `status` | the name |
| Facilities | `GET /api/public/v1/facilities` | `id`, `name`, `code`, `street`, `city`, `state`, `zip`, `timeZoneId`, `status`, `rowVersion` | the name, the facility code or the city |

`currentTruck` and `currentLoadNumber` (drivers) and `currentDriverName` (trucks) come from the load the driver or truck
is on now: a load that is `Covered`, `AtPickup`, `EnRoute` or `AtDelivery`. They are `null` when there is none. With more
than one, the most recently changed of those loads is used (on a tie, the newest load). `currentDriverName` is that
load's primary driver, or one of its drivers when none is marked primary. Licence, date of birth, address, SSN, pay,
advances and documents are never returned.
