# Errors

> Every HTTP status the Techvia TMS public API returns, with the RFC 7807 error body and the duplicate fields.

Source: https://techvia.software/docs/tms/concepts/errors/

| Status | When |
|---|---|
| `400` | The request cannot be read: a body that is not a JSON object, a `rowVersion` that is not a whole number, a malformed id, date or number in the query. `errors` names the query parameter, the body field (`status`, `rowVersion`) or `body`, with "This value could not be read." |
| `401` | No key, or the key is malformed, unknown, revoked, expired or not active. One body for every reason |
| `403` | The key lacks the scope this call needs (`scope` names it), the call is not open to API keys, or your plan does not include the feature (`code` `capability_required`, `capability` names it; the same rule as in the app) |
| `404` | No such load in your workspace, or no such route (a bad id in the URL is a plain 404) |
| `405` | The route exists but not with this HTTP method (the `Allow` header lists the right one) |
| `415` | A body sent without `Content-Type: application/json` |
| `409` | `rowVersion` is not current: the record changed since you read it (read it again); or a duplicate (below) |
| `422` | Validation failed: a missing, unknown or not-allowed `status` (body or list filter), a missing `rowVersion`, `pageSize` outside 1 to 50, `page` outside 1 to 42949672, a date outside 1900-01-01 to 9999-12-31 or a "from" after its "to", a `search` that is too long or has control characters, or one of the app's own rules (for example `Covered` needs a carrier, truck or driver; reported under `status`) |
| `400`, `409`, `422` with an `idempotency-key-*` code | See "Retrying a create safely" in [Idempotency](/docs/tms/concepts/idempotency/) |
| `409` with `type` `https://api.techvia.com/errors/duplicate` | The record probably exists already. Extra fields, camelCase: `code` (for example `duplicate_load`), `canOverride` (`true`: send again with `allowDuplicate: true` (customers, carriers and facilities: `confirmNew: true`) and a new `Idempotency-Key`; `false`: it can never be created twice), `existingId` (the matching record, when there is one) and `candidates` (`id`, `name`, `detail` of up to 5 of your records; `detail` is one key field such as a city, a reference, or a USDOT/MC number written as its digits without leading zeros) |
| `429` | A rate limit or the monthly quota is used up (`code` `rate-limited` or `quota-exceeded`). Wait the number of seconds in the `Retry-After` header ([Rate limits and quota](/docs/tms/concepts/rate-limits/)) |

```json
{
  "type": "https://api.techvia.com/errors/validation",
  "title": "Validation failed",
  "status": 422,
  "detail": "One or more fields are invalid.",
  "instance": "/api/public/v1/loads/{id:guid}/status",
  "errors": { "status": ["An API key can set only these statuses: Open, Covered, AtPickup, EnRoute, AtDelivery, Delivered."] },
  "traceId": "00-201617448d0826ae478563b5b2154d17-a2178041e7b5b3b9-00"
}
```
