Developer API

TPVStream API: keys, rights, limits and errors

Authentication, rights, pagination, idempotency, versions and error codes.

On this page

These rules apply to every route of the API. To turn on the API and create a key, see Getting started.

Authentication

Every call carries the key in the header:

Authorization: Bearer tpv_live_…

Any other form answers 401 INVALID_KEY. The answer is the same for an unknown, expired or revoked key.

  • Validity: 90 days by default, 1 year at most. After that, 401.
  • Renew: creates a new key; the old one keeps working for 7 days at most. You have time to change it in your application.
  • Allowed IPs: if the owner fills them in, a call from another IP answers 403 IP_NOT_ALLOWED.

Rights

Each key only has the rights ticked when it was created. Without the right of a route: 403 SCOPE_MISSING.

Right on the POS Scope Gives access to
Read catalogue catalog:read products, categories, VAT, modifiers, pictures of the online sheet
Edit catalogue catalog:write create, change and deactivate products and categories
Read stock stock:read stock levels, movements, cost price
Edit stock stock:write stock adjustments
Read sales sales:read tickets, Z closures, statistics
Read clients clients:read client records (personal data)
Edit clients clients:write create, change and deactivate clients
Read orders orders:read remote orders
Create orders orders:write create and cancel remote orders
Manage webhooks webhooks:manage real-time notices

No key gives access to users and PINs, the licence, certificates, tax settings, backups or terminals.

Rate limits

  • 60 reads per minute and 20 writes per minute per key, short bursts allowed.
  • Above the limit: 429 RATE_LIMITED with a Retry-After header (seconds to wait).
  • Request body: 256 KB at most (413 PAYLOAD_TOO_LARGE).
  • 10 401 or 403 errors in one minute from an IP: that IP is blocked for 15 minutes.

Data format

  • JSON in UTF-8, in requests and answers.
  • Amounts in whole cents, VAT included: 1250 = €12.50.
  • Dates in ISO 8601, UTC: 2026-11-27T08:00:00.000Z.
  • Unknown fields in a request are refused (400 VALIDATION).

Pagination

Lists return {"data": [...], "nextCursor": "…"}.

  • ?limit= from 1 to 200 (50 by default).
  • For the next page, call again with ?cursor=<nextCursor>. When nextCursor is null, you are done.
  • Periods (?from=&to=): 7 days by default, 93 days at most per call. A date alone in to (2026-11-27) covers the whole UTC day.

Writes: Idempotency-Key

Every POST, PATCH and DELETE needs an Idempotency-Key header with a new UUID per operation:

curl -X POST https://api.tpvstream.com/<id>/v1/stock/adjustments \
  -H "Authorization: Bearer tpv_live_…" \
  -H "Idempotency-Key: 6f1d3c1e-8a2b-4c55-9d1e-0a7b2c3d4e5f" \
  -H "Content-Type: application/json" \
  -d '{"productId":"8f1c…","delta":-2,"reason":"Breakage"}'
  • If the connection drops, send the same request with the same key again: the operation is not done twice and you get the same answer (header Idempotent-Replayed: true).
  • Same key with another body: 409 IDEMPOTENCY_CONFLICT. No header: 400 IDEMPOTENCY_KEY_REQUIRED.
  • Keys are kept for 30 days.

Changes: If-Match and ETag

A GET of one item returns an ETag header. To change it with PATCH, send that value in If-Match:

curl -X PATCH https://api.tpvstream.com/<id>/v1/products/8f1c… \
  -H "Authorization: Bearer tpv_live_…" \
  -H "Idempotency-Key: 0b8e…" \
  -H 'If-Match: "1764230400000"' \
  -H "Content-Type: application/json" \
  -d '{"priceCents":160}'
  • Without If-Match: 428 PRECONDITION_REQUIRED.
  • If someone changed the item between your GET and your PATCH (on the POS or with another key): 412 VERSION_MISMATCH. Read it again and decide.

DELETE never deletes: it deactivates (isActive: false). History is kept.

Errors

Every error answer has the same shape:

{ "error": { "code": "SCOPE_MISSING", "message": "…", "requestId": "…" } }
Status Code What to do
400 VALIDATION Fix the request: the message says which field is wrong.
400 IDEMPOTENCY_KEY_REQUIRED Add the Idempotency-Key header.
401 INVALID_KEY Key badly copied, expired or revoked.
403 SCOPE_MISSING Ask the owner to add the right to the key.
403 IP_NOT_ALLOWED You call from an IP that is not on the list.
403 CLOUD_REQUIRED The POS has no cloud access.
404 NOT_FOUND The item does not exist.
409 IDEMPOTENCY_CONFLICT You reused an Idempotency-Key with another body.
409 IDEMPOTENCY_IN_PROGRESS The same request is still running: wait and retry.
409 DUPLICATE_REF An order with that externalRef already exists.
412 VERSION_MISMATCH The item changed: read it again.
413 PAYLOAD_TOO_LARGE Body larger than 256 KB.
428 PRECONDITION_REQUIRED If-Match missing on a PATCH.
429 RATE_LIMITED Wait the seconds of Retry-After.
503 POS_OFFLINE The main register is off, offline or has the API turned off. Retry later.
504 POS_TIMEOUT The POS took too long. Retry with the same Idempotency-Key.

Keep the requestId: the owner finds it in the Last calls on the POS.

WhatsApp