- Docs
- Techvia TMS overview
- Guides
- Create and update customers, carriers and facilities
Create and update customers, carriers and facilities
| Call | Does |
|---|---|
POST /api/public/v1/customers |
Create a customer |
PATCH /api/public/v1/customers/{id} |
Change a customer |
POST /api/public/v1/carriers |
Create a carrier |
PATCH /api/public/v1/carriers/{id} |
Change a carrier |
POST /api/public/v1/facilities |
Create a facility from an address |
PATCH /api/public/v1/facilities/{id} |
Rename a facility or change its code |
A create is 201 with the new record (as the read endpoints show it, plus its rowVersion) and takes an
Idempotency-Key (Idempotency). A change sends only the fields that change: a field left out stays, an empty text
clears it, and rowVersion (from your last read, list or create answer) is required. A rowVersion that is no longer
current is 409 “changed since you read it”: read again and retry. An unknown id, or another workspace’s, is 404.
Names and numbers are checked the way the TMS app checks them, so a record you create from the API and one a person
creates by hand follow the same duplicate rules.
A change cannot leave a carrier with neither a USDOT nor an MC number (422 on dotNumber). A record whose stored values the app
no longer accepts (a retired payment-terms choice, an invalid billing e-mail) cannot be changed with a key: the answer is 422 on body,
“This record has values the app must fix first; edit it in TMS.” A person fixes it in the TMS app.
Bodies (every field is optional on the wire; the ones marked required are refused with 422 when missing):
| Resource | Fields you can send |
|---|---|
| Customer | name (required on create, at most 200, with a letter or digit), mcType, mcNumber, street, city, state, zip, country, contactName, phone, email, confirmNew |
| Carrier | name (required on create), dotNumber and mcNumber (digits; one of the two required on create), scac, contactName, phone, email, liabilityExpiry, autoExpiry, cargoExpiry (dates, YYYY-MM-DD, 2000 to 2100) |
| Facility, create | name, street, city, state (all required), zip, country, code, confirmNew |
| Facility, change | name, code, confirmNew. The address cannot be changed with a key: create the new site instead |
Never settable with a key, and ignored if sent: credit limit, payment terms, billing e-mail and address, currency, the blacklist flag, status, notes, a carrier’s tax id, WSIB, payment terms, auto-accept flag, insurance company, policy number and amount, a facility’s contact, coordinates, time zone and detention time. Their values on an existing record are kept when you change it.
Duplicates (the same rules as the app; the fields are in Errors):
| Resource | Refused with 409 and existingId, no override |
409 with candidates, send confirmNew: true (and a new Idempotency-Key) to add it anyway |
|---|---|---|
| Customer | the same name (case, spaces, punctuation and endings such as Inc or LLC ignored): duplicate_customer |
a similar name: possible_duplicate_customer |
| Carrier | the same USDOT number or the same MC number (digits only, leading zeros and prefixes such as MC- ignored): duplicate_carrier. The sentence shows the number once, as its digits |
none |
| Facility | the same name (inner spaces ignored) in the same city and state: duplicate_facility. Two creates of it at the same moment with different Idempotency-Keys can both succeed; there is no database index behind this rule |
the same address under another name, or a similar name within 100 m: possible_duplicate_facility |
Creating a facility looks the address up (as create_load does for a stop given by address): it needs the
street, takes one unit of your workspace’s address-lookup allowance (the plan’s monthly limit, the same allowance the app’s
address search uses), and sets the coordinates and the time zone. The checks that need no lookup (same name, same
address) run first, so a duplicate costs nothing; “a similar name within 100 m” is known only after the lookup, which is
then used. A lookup that fails on our side gives its unit back, uses no request quota and leaves the Idempotency-Key
free: try again with the same key. An address that is not found is 422 (the lookup is used). When the allowance is
used up the answer is 422 with your workspace’s own numbers (used, limit, reset date), or “not included in your
plan” when your plan has none.