API conventions
The conventions of TOVR's APIs. Which API serves what, hosts per environment, credential formats, versioning, the error shapes, rate limits and monthly quota, idempotency, and scopes.
TOVR has three HTTP surfaces. Only the TOVR REST API and the fOS MCP server take customer credentials. This page holds what the pillar references share and the REST API's rate-limit, quota and idempotency rules, which other pages link to.
The three APIs
| API | Host | Credential | Use it to | Reference |
|---|---|---|---|---|
| TOVR REST API | tovr.eu/api/v1 | OAuth 2.0 client-credentials bearer token | Write and read shipments, read chains, vehicles, matches, quotes, outreach and invoices, follow changes, price lanes | TOVR › Reference |
| fOS MCP server | mcp.tovr.eu | fOS API key (tovr_…) or an OAuth 2.1 access token, as a bearer token | Drive fOS tools from an MCP client | fOS › Reference |
| APEX | apex.tovr.eu | X-API-Key | Internal. TOVR's own services call it with one service key, and no keys are issued to customers. Customers price lanes through the REST API's /estimate and /market/overview. | APEX › Reference |
Environments
| Environment | TOVR REST API | fOS MCP server | APEX |
|---|---|---|---|
| Production | https://tovr.eu/api/v1 | https://mcp.tovr.eu | https://apex.tovr.eu |
| Staging | https://staging.tovr.eu/api/v1 | https://mcp-staging.tovr.eu | https://apex-staging.tovr.eu |
Staging has its own database and its own credentials. A client application created on production does not work on staging.
Authentication
| API | Header | Credential |
|---|---|---|
| TOVR REST API | Authorization: Bearer <token> | A one-hour JWT from POST /api/v1/oauth2/token. See Authentication. |
| fOS MCP server | Authorization: Bearer <key or token> | A value starting tovr_ is read as an fOS API key; anything else as an OAuth access token. |
| APEX | X-API-Key: <key> | A service key. |
The credentials do not cross over: an fOS API key is refused by /api/v1, and a REST API token
is not an fOS API key. Keep client secrets and keys on a server, never in browser code.
Versioning
The TOVR REST API is versioned in the path, /api/v1. Within v1, new optional response fields,
new endpoints and new members of open lists (event type, object_type) can appear without
notice to the version. Each change is recorded with what to do about it in
apps/web/lib/api/versions/.
The OpenAPI document is generated from the schemas the routes validate against. List query
parameters are strict, so a client that sends a parameter v1 does not know yet gets a 422.
Errors
Each API has its own error body.
| API | Body | Codes |
|---|---|---|
| TOVR REST API | {"error":{"type","code","message","param?","details?","request_id","doc_url"}} | Errors |
| TOVR REST token endpoint | {"error":"<message>"}, plus error_description on 429 | Authentication |
| APEX | {"error","code","endpoint","detail?"}, for example KEY_MISSING (401), KEY_INVALID (403) | APEX › Reference |
Statuses the TOVR REST API uses:
| Status | Meaning |
|---|---|
400 | An Idempotency-Key header longer than 255 characters. |
401 | Missing, invalid or expired token. |
402 | Monthly request quota, or monthly streaming minutes, used up. Waiting does not clear it. |
403 | The token lacks a scope, including the read scope of an event type a webhook endpoint subscribes to. |
404 | Not found, or not visible to this organization, including another organization's object. |
409 | Conflict: the external_id is taken, or an Idempotency-Key was reused. |
410 | A change-feed cursor older than the 30-day retention window. |
422 | The request is well-formed but not valid: schema, unknown parameter, cursor, status transition. |
429 | Rate limit. Retry after Retry-After. |
500 | internal_error. Retrying does not help. Report the request_id. |
503 | service_unavailable. A dependency is down. Retry with backoff. |
fOS tools also return in-band result codes in agent flows, for example
CONFIRMATION_REQUIRED when a write needs approval. See fOS › Approvals and safeguards.
Rate limiting and quota
The TOVR REST API meters each client application against two ceilings from its organization's plan.
| Ceiling | Window | Over it | Clears |
|---|---|---|---|
| Rate limit | Calendar minute | 429, rate_limited, Retry-After | At the next minute |
| Quota | Calendar month | 402, quota_exceeded, no Retry-After | At the next month, or on a plan upgrade |
| Plan | Requests per minute | Requests per month | Streaming connection-minutes per month |
|---|---|---|---|
| Hobby | 60 | 10,000 | 45,000 |
| Pro | 300 | 200,000 | 450,000 |
| Scale | 1,200 | 2,000,000 | 2,000,000 |
| Enterprise | unmetered | unmetered | unmetered |
Windows start at the full minute and the first day of the month. A request counts as soon as it reaches the limiter, which runs after authentication and the scope check. So:
- A
401and a403 insufficient_scopedo not count and carry no rate-limit headers. - Every other response that reached the limiter counts, including validation errors and
429s, and carries the headers below. - An unmetered plan carries no rate-limit headers.
| Header | Value |
|---|---|
X-RateLimit-Limit | Requests allowed per minute |
X-RateLimit-Remaining | Requests left in this minute |
X-RateLimit-Reset | When the minute ends, in Unix seconds |
RateLimit-Limit, RateLimit-Remaining | The same values, unprefixed |
RateLimit-Reset | Seconds until the minute ends |
Retry-After | Seconds to wait, on 429 only |
The token endpoint has separate limits (30 per minute per address, 10 per minute per
client_id); see Authentication. Webhook
deliveries TOVR sends to you do not count. For high-volume pricing, POST /estimate/batch prices
up to 500 lanes in one request.
Idempotency
Send Idempotency-Key: <unique string> on a POST, PATCH or DELETE of the TOVR REST API.
| Rule | Value |
|---|---|
| Key length | 1–255 characters. A longer key is 400 validation_failed, param: "Idempotency-Key". An empty header is ignored. |
| Key namespace | Per client application |
| Window | 24 hours from the first use. Do not reuse a key after that: until the expired key is cleaned up, a reuse runs the work again on every retry and is never replayed. |
| Same key, same request | The stored response is replayed with Idempotent-Replayed: true. The work does not run again. |
| Same key, different request | 409 idempotency_key_reuse |
| What makes a request "the same" | Method, path and the body as validated. Key order, whitespace and fields the endpoint drops do not matter. |
| Endpoints that ignore the key | POST /estimate and POST /estimate/batch, which write nothing |
The claim on the key, the work and the stored response commit in one transaction. A replay of
POST /webhook_endpoints returns secret: null: the signing secret is shown only on the first
response.
Scopes
| API | Scope model |
|---|---|
| TOVR REST API | One scope per resource and access, such as shipments:read, shipments:write, invoices:read, events:stream. The full list is in Authentication › Scopes. |
| fOS MCP server | read and write, a separate vocabulary from the REST API's. See fOS › Reference. |