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

APIHostCredentialUse it toReference
TOVR REST APItovr.eu/api/v1OAuth 2.0 client-credentials bearer tokenWrite and read shipments, read chains, vehicles, matches, quotes, outreach and invoices, follow changes, price lanesTOVR › Reference
fOS MCP servermcp.tovr.eufOS API key (tovr_…) or an OAuth 2.1 access token, as a bearer tokenDrive fOS tools from an MCP clientfOS › Reference
APEXapex.tovr.euX-API-KeyInternal. 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

EnvironmentTOVR REST APIfOS MCP serverAPEX
Productionhttps://tovr.eu/api/v1https://mcp.tovr.euhttps://apex.tovr.eu
Staginghttps://staging.tovr.eu/api/v1https://mcp-staging.tovr.euhttps://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

APIHeaderCredential
TOVR REST APIAuthorization: Bearer <token>A one-hour JWT from POST /api/v1/oauth2/token. See Authentication.
fOS MCP serverAuthorization: Bearer <key or token>A value starting tovr_ is read as an fOS API key; anything else as an OAuth access token.
APEXX-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.

APIBodyCodes
TOVR REST API{"error":{"type","code","message","param?","details?","request_id","doc_url"}}Errors
TOVR REST token endpoint{"error":"<message>"}, plus error_description on 429Authentication
APEX{"error","code","endpoint","detail?"}, for example KEY_MISSING (401), KEY_INVALID (403)APEX › Reference

Statuses the TOVR REST API uses:

StatusMeaning
400An Idempotency-Key header longer than 255 characters.
401Missing, invalid or expired token.
402Monthly request quota, or monthly streaming minutes, used up. Waiting does not clear it.
403The token lacks a scope, including the read scope of an event type a webhook endpoint subscribes to.
404Not found, or not visible to this organization, including another organization's object.
409Conflict: the external_id is taken, or an Idempotency-Key was reused.
410A change-feed cursor older than the 30-day retention window.
422The request is well-formed but not valid: schema, unknown parameter, cursor, status transition.
429Rate limit. Retry after Retry-After.
500internal_error. Retrying does not help. Report the request_id.
503service_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.

CeilingWindowOver itClears
Rate limitCalendar minute429, rate_limited, Retry-AfterAt the next minute
QuotaCalendar month402, quota_exceeded, no Retry-AfterAt the next month, or on a plan upgrade
PlanRequests per minuteRequests per monthStreaming connection-minutes per month
Hobby6010,00045,000
Pro300200,000450,000
Scale1,2002,000,0002,000,000
Enterpriseunmeteredunmeteredunmetered

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 401 and a 403 insufficient_scope do 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.
HeaderValue
X-RateLimit-LimitRequests allowed per minute
X-RateLimit-RemainingRequests left in this minute
X-RateLimit-ResetWhen the minute ends, in Unix seconds
RateLimit-Limit, RateLimit-RemainingThe same values, unprefixed
RateLimit-ResetSeconds until the minute ends
Retry-AfterSeconds 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.

RuleValue
Key length1–255 characters. A longer key is 400 validation_failed, param: "Idempotency-Key". An empty header is ignored.
Key namespacePer client application
Window24 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 requestThe stored response is replayed with Idempotent-Replayed: true. The work does not run again.
Same key, different request409 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 keyPOST /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

APIScope model
TOVR REST APIOne scope per resource and access, such as shipments:read, shipments:write, invoices:read, events:stream. The full list is in Authentication › Scopes.
fOS MCP serverread and write, a separate vocabulary from the REST API's. See fOS › Reference.

On this page