# BackResto Partner API: full documentation

> Every page of https://developers.backresto.com, in reading order, in one file for language models. The per-page index is https://developers.backresto.com/llms.txt.

## Introduction

> What the BackResto Partner API exposes today, what it deliberately does not, and who decides.

Source: https://developers.backresto.com/en/docs/introduction

BackResto is the HACCP compliance app food-service teams fill in during service:
goods-in checks, cooking and cooling temperatures, cleaning plans, labels. The
**Partner API** hands that record to the software your customers already run:
an ERP, a supplier portal, a quality dashboard, an AI assistant.

It is a read-only HTTP API with one authentication scheme and one error shape,
described end to end by an
[OpenAPI document](https://api.backresto.com/openapi.json) you can load straight
into a client generator or an LLM tool definition. The same data is reachable
over [MCP](https://developers.backresto.com/en/docs/mcp) at `https://api.backresto.com/mcp`, with the same key and
the same permissions, if what you want is to ask questions rather than write a
client.

## The restaurant decides what you see

This is the part worth reading twice, because it is different from most APIs
you will integrate with.

There is no sign-up. A key is issued by hand, scoped to named restaurants and
named scopes, and only once the restaurants in question have agreed to it. Ask
for one by email ([Getting a key](https://developers.backresto.com/en/docs/access) is the checklist), and it
arrives at the technical contact you name.

The consequence is a firm one: a key reaches the restaurants it was granted and
nothing else. `restaurant-3` does not appear because `restaurant-1` and
`restaurant-2` are on the same key, and no request you can make widens that.
Adding a site is another conversation, with the people whose data it is.

The upside of a small manual step is that revocation is just as direct: one
email and the key is dead on the next request.

## What is in the data

| Resource | What it is |
| --- | --- |
| [Deliveries](https://developers.backresto.com/en/docs/deliveries) | Two collections: one record per goods-in check (supplier, compliance verdict, non-compliance reasons, corrective actions, free-text commentary, a temperature reading per product, always in Celsius), and the photographs taken at reception. |
| [Collections & records](https://developers.backresto.com/en/docs/collections) | Twenty-four further record types, sharing one envelope and documented by domain: [temperatures](https://developers.backresto.com/en/docs/temperatures), [cooling and food processes](https://developers.backresto.com/en/docs/food-processes), [cleaning](https://developers.backresto.com/en/docs/cleaning), [fryers](https://developers.backresto.com/en/docs/fryers), [surface analyses](https://developers.backresto.com/en/docs/surface-analyses), [traceability labels](https://developers.backresto.com/en/docs/traceability-labels), [documents](https://developers.backresto.com/en/docs/drive-files), [catalogue](https://developers.backresto.com/en/docs/catalogue) and the [facilities and people](https://developers.backresto.com/en/docs/facilities) behind them. |

All of it is read-only. Nothing a partner key can call writes to a restaurant's
records: the app is where compliance data is created, by the person who is
accountable for it.

## What is not here yet

Being explicit about the edges saves you an afternoon:

- **No historical backfill.** A restaurant's records become visible to this API
  from the moment capture is switched on for that restaurant. What came before
  is in the app, not here, except for deliveries, which carry the history the
  app still held. Do not treat an empty walk as proof that nothing happened.
  See [Support](https://developers.backresto.com/en/docs/support).
- **No writes, no webhooks.** You poll. If you need to be pushed to, tell us;
  it is a question of demand, not of principle.
- **No incremental cursor on collections.** Refreshing a collection means
  walking it again and reconciling on `id`.
- **No BackResto account sign-in.** The partner key remains the credential.
  URL-only [MCP](https://developers.backresto.com/en/docs/mcp) clients, including Claude and ChatGPT, can connect
  through OAuth: a BackResto page opens for you to paste the key. Permissions
  remain those of that key.

## Base URLs

| Environment | Origin |
| --- | --- |
| Production | `https://api.backresto.com` |
| Pre-production | `https://api-preprod.backresto.com` |
| Development | `https://api-dev.backresto.com` |

A key is provisioned in one environment and means nothing in the others: keys,
grants and data are per-environment. Everything below uses the production
origin.

Ready? [Make your first call](https://developers.backresto.com/en/docs/quickstart).

---

## Getting a key

> How to ask for a Partner API key, what to put in the request, and what comes back.

Source: https://developers.backresto.com/en/docs/access

Partner keys are issued by hand. Fill in the form below (or email us, which
reaches the same people), and we provision the credential and send it to the
contact you name.

A person reads every request, because a key carries access to a restaurant's
compliance records and the restaurant has to have agreed to it. What that costs
you is a reply rather than a redirect; what it buys is that nobody can mint
themselves access to someone else's data. The form asks for everything we need
to act on it in one go.

## Who can ask

Either side, but the restaurant has to agree either way.

- **You, the integrator.** Say which restaurants you need and name your contact
  there; we confirm with them before issuing anything.
- **The restaurant.** They ask on your behalf and name you. This is the faster
  path, because the confirmation has already happened.

We will not issue a key for a restaurant that has not agreed to it, and we will
not widen an existing key without asking them again.

## Request a key

To request a key, write to contact@backresto.com or fill in the form at https://developers.backresto.com/en/docs/access. Name the company, the product that will call the API, a technical contact, the restaurants and the scopes you need.

If you are integrating for several restaurants that belong to different
customers, send one request per customer. One key per customer keeps a
revocation from taking down every other integration you run.

Two of the fields are worth a note. **Environment** matters because keys and
data are per-environment: a production key means nothing on pre-production, so
say if you want to build against pre-production first. And **scopes** should be
what you use rather than everything: there are twenty-six of them, one per
[collection](https://developers.backresto.com/en/docs/collections), deliveries and their photographs included, and
the restaurant reads the list before agreeing to it. Naming the four you need gets a
faster yes than asking for all of them; see
[Authentication](https://developers.backresto.com/en/docs/authentication) for what each one opens.

Already hold a key and want a collection it does not reach? That is the same
email, and an extension rather than a new key: your secret does not change and
nothing needs redeploying.

Prefer to write it yourself? [contact@backresto.com](mailto:contact@backresto.com?subject=Partner%20API%20key%20request)
with the same details reaches the same inbox.

## What comes back

A single value, of the form `brp_<prefix>.<secret>`, sent to the technical
contact you named.

**Store it on arrival and delete the email.** We keep only the public prefix and
a digest of the secret, so we cannot resend it. If it is lost we revoke that
key and issue a new one, which means another round trip.

Keys do not expire on their own. They stay valid until revoked, which is why
the answer to "someone left the team" is a rotation, not a shrug.

## Changing a key later

All of these are an email, and all of them need the restaurant's agreement
where they widen access:

| Ask | What happens |
| --- | --- |
| **Add a restaurant or a scope** | We extend the existing key. Your secret does not change and nothing needs redeploying. |
| **Rotate** | We issue a second key first, you deploy it, then we revoke the old one. No window where neither works. |
| **Revoke** | Immediate. The next request with that key answers `401`. |
| **A time-limited key** | Say so in the request. For a one-off audit or a proof of concept, a key that dies on its own is safer than one you have to remember to kill. |

For anything urgent (a leaked secret above all), write to
[contact@backresto.com](mailto:contact@backresto.com?subject=Urgent%3A%20revoke%20Partner%20API%20key)
with the key's **public prefix** (the `brp_…` half before the dot) and say it is
urgent. Never send us the secret itself, not even to prove which key you mean.

## While you wait

Nothing in [the documentation](https://developers.backresto.com/en/docs) needs a key to read, and the shapes are
all on these pages: [deliveries and their photographs](https://developers.backresto.com/en/docs/deliveries),
[collections and records](https://developers.backresto.com/en/docs/collections), [the error model](https://developers.backresto.com/en/docs/errors)
and [pagination](https://developers.backresto.com/en/docs/pagination). The
[OpenAPI document](https://api.backresto.com/openapi.json) is public too, so you
can generate a client and write against it before the key arrives.

---

## Quickstart

> From a key to your first records and a delivery photograph in five minutes, with curl.

Source: https://developers.backresto.com/en/docs/quickstart

You need one thing: a partner key. It already knows which restaurants it
was granted, and the API will tell you.

## 1. Get a key

Email [contact@backresto.com](mailto:contact@backresto.com?subject=Partner%20API%20key%20request)
with your company, the restaurants you need and the scopes you want. We confirm
with the restaurant, then send the key to the technical contact you named.
[Getting a key](https://developers.backresto.com/en/docs/access) is the full checklist. Sending it complete is
what makes the round trip one email rather than four.

A key looks like this:

```
brp_hV8kZ2pQ.tW3nR7yL9cF1sB4xJ6mA8dK0gN5vE2uP7hQ3rT1zY6i
```

The half before the dot is a public prefix: it identifies the key in the list
on that page and in support conversations, and it is safe to write down. The
half after it is the secret, and it appears nowhere but that one screen.

## 2. Store it

Put the whole value in your secret manager, as one string, and delete the email
it arrived in. Never a repository, never a URL, never a log line. We keep only
a digest of the secret, so a lost key means a revocation and a new one. Write
to us and both happen the same day.

```bash
export BACKRESTO_PARTNER_API_KEY='brp_…'
```

## 3. Find your restaurant

Ask the key which restaurants it reaches, and with which scopes:

```bash
curl "https://api.backresto.com/v1/restaurants" \
  -H "Authorization: Bearer $BACKRESTO_PARTNER_API_KEY"
```

```json
{
  "data": [
    {
      "restaurantId": "restaurant-1",
      "scopes": ["deliveries:read", "delivery-pictures:read", "temperature-records:read"]
    }
  ]
}
```

Most keys reach one restaurant. Keep its identifier for the calls below:

```bash
export RESTAURANT_ID='restaurant-1'
```

## 4. See which collections the key opens

Every record type, deliveries included, is a [collection](https://developers.backresto.com/en/docs/collections).
Ask the key which ones it reaches:

```bash
curl "https://api.backresto.com/v1/restaurants/$RESTAURANT_ID/collections" \
  -H "Authorization: Bearer $BACKRESTO_PARTNER_API_KEY"
```

```json
{
  "data": [
    {
      "collection": "deliveries",
      "readScope": "deliveries:read",
      "description": "Received shadow snapshots for deliveries; not complete primary-store history.",
      "stateKind": "received-shadow-snapshot",
      "payloadVersion": 1
    }
  ]
}
```

An empty `data` means the key has no collection grants yet.
[Ask for the ones you need](https://developers.backresto.com/en/docs/access).

## 5. Walk the deliveries

A collection is walked page by page with an opaque cursor. Timestamps are **epoch
milliseconds, as strings**: that is the convention across the whole API, never
seconds, never ISO 8601.

```bash
curl "https://api.backresto.com/v1/restaurants/$RESTAURANT_ID/collections/deliveries/records" \
  -H "Authorization: Bearer $BACKRESTO_PARTNER_API_KEY" \
  --get --data-urlencode "limit=100"
```

```json
{
  "data": [
    {
      "id": "8f2c1b04-0d5a-4b7e-9f31-6ad2c0e77a51",
      "restaurantId": "restaurant-1",
      "collection": "deliveries",
      "deleted": false,
      "capturedAt": "1787932805120",
      "receivedAt": "1787932911004",
      "sequence": "88",
      "data": {
        "timestamp": "1787932800000",
        "isCompliant": false,
        "supplierDeliveriesId": "supplier-7",
        "temperatureRecords": [
          { "product": "Poulet fermier", "lotNumber": "L2291", "value": 6.4, "unit": "C" }
        ],
        "nonComplianceReasons": ["Température trop élevée"],
        "correctiveActions": ["Produit refusé"],
        "commentary": null
      }
    }
  ],
  "nextCursor": null
}
```

Temperatures are always Celsius. No time range here: you walk the collection,
filter on `data.timestamp` if you want a week, and keep `id` to reconcile on the
next walk. The other collections (temperatures, cooling, cleaning, labels) are
walked exactly the same way.

## 6. Fetch a delivery's photographs

Photographs are the `delivery-pictures` collection. Each record names its
delivery in `data.deliveryId`, and the bytes come from its assets:

```bash
curl "https://api.backresto.com/v1/restaurants/$RESTAURANT_ID/collections/delivery-pictures/records" \
  -H "Authorization: Bearer $BACKRESTO_PARTNER_API_KEY" \
  --get --data-urlencode "limit=100"

curl "https://api.backresto.com/v1/restaurants/$RESTAURANT_ID/collections/delivery-pictures/records/$PICTURE_ID/assets" \
  -H "Authorization: Bearer $BACKRESTO_PARTNER_API_KEY"
```

The second call answers signed URLs valid for fifteen minutes; download the
bytes with no `Authorization` header. It needs the `delivery-pictures:read`
scope. If your key has only `deliveries:read`, the deliveries answer and the
photographs answer `403`. That is the grant doing its job, and the fix is for
the customer to issue a key with both.

## 7. Handle the two failures you will actually meet

**`404`**: the restaurant is not on your key, or the record does not exist.
The two are deliberately indistinguishable: the API does not confirm that a
restaurant exists to a caller who cannot see it.

**`403`**: the restaurant is on your key, but the scope this endpoint needs is
not.

Every error is [a problem document](https://developers.backresto.com/en/docs/errors), never an HTML page, and
carries a `requestId` worth quoting if you write to us.

## Where next

- [Getting a key](https://developers.backresto.com/en/docs/access): the request checklist, and how to change a key later.
- [Authentication](https://developers.backresto.com/en/docs/authentication): scopes, rotation, what a key can and cannot do.
- [Pagination](https://developers.backresto.com/en/docs/pagination): the cursor, and how to keep a copy up to date.
- [Deliveries](https://developers.backresto.com/en/docs/deliveries): every field of a goods-in check and its photographs.
- [Collections & records](https://developers.backresto.com/en/docs/collections): all twenty-six record types, and the envelope they share.
- [MCP](https://developers.backresto.com/en/docs/mcp): the same data inside an AI client, in about three minutes.

---

## Authentication

> Partner keys, the twenty-six scopes, what a grant means, and how to rotate without downtime.

Source: https://developers.backresto.com/en/docs/authentication

Every Partner API request carries one credential, in the standard place:

```http
Authorization: Bearer brp_<prefix>.<secret>
```

There is no other scheme. No query-string key, no basic auth, no cookie. A
request without that header, or with a malformed value, answers `401` before
anything else is evaluated.

## What a key is

A key has two halves separated by a dot.

| Half | What it is | Where it may appear |
| --- | --- | --- |
| `brp_<prefix>` | A public identifier for the credential. | Your logs, a support email, the key list on this site. |
| `<secret>` | 256 bits of randomness. | Your secret manager, and the `Authorization` header. |

BackResto stores the prefix and a keyed digest of the secret. **The secret
itself is not stored and cannot be recovered**: not by you, not by support,
not from the database. If it is lost, revoke the key and create another.

## Grants: restaurant × scope

A key is not "an account with permissions". It is a list of explicit grants,
each one a pair:

There are **twenty-six scopes**, and the grammar is worth learning once:

| Scope | Grants access to |
| --- | --- |
| `<collection>:read` | One of the [twenty-six collections](https://developers.backresto.com/en/docs/collections): `deliveries:read`, `delivery-pictures:read`, `cooling:read`, `temperature-records:read` and so on, one scope per collection. |

Every scope ends in `:read`. There is no partner scope that writes, and none can
be created: the write side of this API belongs to the BackResto app, and a
partner key is structurally incapable of holding one.

A key granted `deliveries:read` on `restaurant-1` and `restaurant-2`, and
`delivery-pictures:read` on `restaurant-1` only, reads delivery photographs for
the first restaurant and gets `403` for the second. That is a supported configuration,
not a mistake. Some integrations want the records without the pictures.

Ask for what you use. Twenty-six scopes is not a menu to tick through: the
restaurant reads the list before agreeing to it, and a request for everything
takes longer to get through than a request for the four collections your product
actually reads.

Three failure modes, deliberately distinct:

- **`404`**: the key holds no grant at all for that restaurant. The API does
  not tell an unauthorised caller whether a restaurant exists.
- **`403`**: the key holds a grant for that restaurant, but not the scope this
  endpoint needs.
- **`401`**: among other things, a key with no grants left at all. A key
  stripped of its last grant stops authenticating rather than answering empty.

To see what a key actually holds, ask it: `GET /v1/restaurants` lists the
restaurants with their scopes, and
[`GET /v1/restaurants/{id}/collections`](https://developers.backresto.com/en/docs/collections) lists the
collections it opens.

## Who can issue one

We do, on request, and only for restaurants that have agreed to it. See
[Getting a key](https://developers.backresto.com/en/docs/access) for what to send and what comes back.

Grants are set when the key is provisioned and changed only by another request.
There is no path (for you or for us) that widens a key without the restaurant
agreeing to it again.

## Expiry and revocation

A key does not expire on its own unless you asked for one that does. It stays
valid until it is revoked.

Revocation is immediate: the next request with that key answers `401`, the same
answer an unknown or expired key gets. It cannot be undone, and it does not
need to be: a replacement is a new key, not a restored one.

## Rotating without downtime

An integration can hold two live keys at once, so rotation needs no maintenance
window. Ask us to rotate and this is the order it happens in:

1. We issue a second key with the same restaurants and scopes.
2. You deploy the new secret, and tell us when it is live everywhere.
3. We check that the old key has stopped being used. We can see when each key
   last authenticated, which is the signal that makes step 4 safe.
4. We revoke the old one.

Rotate on a schedule you choose, and start the request a few days before you
want the old key gone: steps 2 and 3 are yours and ours to co-ordinate, and the
whole point of the order above is that nothing is ever briefly dead.

## Hygiene

- **Store it on arrival and delete the email.** The secret exists in exactly two
  places once that is done: your secret manager, and the `Authorization` header.
- **One key per deployment**, not one per company. A leaked staging key should
  never be a production incident, and a revocation should never take down more
  than the thing that leaked.
- **Never send us the secret**: not in a ticket, not to identify a key. The
  public prefix names it unambiguously and is safe to write anywhere.
- **Watch for `401` in your own monitoring.** A key that starts failing has been
  revoked, and the answer is a conversation, not a retry loop.

---

## Errors

> One machine-readable problem document for every failure, and what each type means for your retry logic.

Source: https://developers.backresto.com/en/docs/errors

Every failure (including a route that does not exist) answers with
`application/problem+json`, the shape defined by RFC 9457. There is no path
through this API that returns an HTML error page, so a parser that assumes JSON
on a non-2xx response is safe.

```json
{
  "type": "https://api.backresto.com/problems/forbidden",
  "title": "Forbidden",
  "status": 403,
  "detail": "The authenticated client lacks the required scope.",
  "instance": "/v1/restaurants/restaurant-1/collections/delivery-pictures/records/8f2c/assets",
  "requestId": "b1c8b0a4-6c1e-4f6b-9e1c-3b2a5d7f0e91"
}
```

`type` is the stable identifier: branch on it, not on `detail`, which is prose
and may be reworded. `requestId` is the value to quote in a support message.
It is also returned in the `X-Request-ID` response header, and you can set that
header yourself to correlate with your own traces.

## The catalogue

| `type` suffix | Status | What happened | Retry? |
| --- | --- | --- | --- |
| `invalid-request` | 400 | A parameter is missing or malformed: a `limit` out of range, an unknown collection, or a cursor that does not match the restaurant, collection and `limit` you are paging with. | No. Fix the request. |
| `unauthorized` | 401 | No `Authorization` header, or a key that is malformed, unknown, revoked, expired, or left with no grants at all. | No. The key needs attention. |
| `forbidden` | 403 | The key holds a grant for this restaurant but not the scope this endpoint needs. | No. A key carrying that scope has to be requested. |
| `not-found` | 404 | No grant for this restaurant, or no such record. The cases are deliberately indistinguishable. | No. |
| `conflict` | 409 | The request conflicts with an existing resource. | No. |
| `payload-too-large` | 413 | The request body exceeds the limit. | No. |
| `rate-limit-exceeded` | 429 | Your client passed its request budget. | Yes, after `Retry-After`. |
| `dependency-unavailable` | 503 | A component the API needs is briefly unavailable. | Yes, with backoff. |
| `internal-error` | 500 | An unexpected failure, already recorded on our side. | Once, with backoff; then tell us the `requestId`. |

## What a client should do

Three buckets, and nothing else is worth the code:

**Do not retry**: 400, 401, 403, 404, 409, 413. The request will fail again
identically. Log the `type` and the `requestId`, and surface it: a `401` in
particular means a human at your customer's end has revoked something, and a
retry loop will only hide that for a week.

**Retry with backoff**: 429, 503. Honour `Retry-After` on a 429; it is the
number of seconds until your budget refills, and it is not a suggestion. For
503, exponential backoff with jitter, and give up rather than hammering.

**Retry once, then escalate**: 500. If it recurs on the same request, it is
not transient.

Every endpoint in this API is a `GET`, so retrying is always safe from the
API's point of view; the reason not to retry a 4xx is that it wastes your
budget, not that it risks a double write.

## Correlating with your own logs

Send your own identifier and it comes back:

```bash
curl "https://api.backresto.com/v1/restaurants/$RESTAURANT_ID/collections/deliveries/records?limit=100" \
  -H "Authorization: Bearer $BACKRESTO_PARTNER_API_KEY" \
  -H "X-Request-ID: 3f7a1c9e-2b4d-4a86-9f0c-5e1d8b6a2c40" \
  --include
```

The value is echoed in the response header and in the `requestId` of a problem
document, which makes a single grep answer "what did BackResto see when my job
failed at 04:12?".

---

## Pagination

> How to walk any collection with an opaque cursor, and how to keep a copy of it up to date.

Source: https://developers.backresto.com/en/docs/pagination

Every list in this API is read the same way: you walk a
[collection](https://developers.backresto.com/en/docs/collections) page by page, deliveries included.

```http
GET /v1/restaurants/{restaurantId}/collections/{collection}/records
  ?limit=100
  &cursor=eyJpZCI6…
```

| Parameter | Required | Rules |
| --- | --- | --- |
| `limit` | no | 1 to 100. Defaults to 50. |
| `cursor` | no | The `nextCursor` of the previous page, verbatim. |

The answer is `{ "data": [...], "nextCursor": string | null }`.

## No time range

There is no `from` and no `to`. A record changes in place (a correction, a
tombstone), so you walk the collection and reconcile rather than asking for a
window of it. To read one week of deliveries, walk `deliveries` and keep the
records whose `data.timestamp` falls inside the week.

## Ordering

Oldest change first: ascending by `sequence`, the position of each record's
latest change in the stream. Compare two `sequence` values; do not do
arithmetic on one.

## Walking the pages

`nextCursor` is `null` on the last page and a string otherwise. Pass it back
untouched: it is an opaque position, not a document to parse, and its
internals will change without notice.

```js
async function* records({ apiKey, restaurantId, collection }) {
  const base = `https://api.backresto.com/v1/restaurants/${restaurantId}/collections/${collection}/records`;
  let cursor = null;

  do {
    const url = new URL(base);
    url.searchParams.set('limit', '100');
    if (cursor !== null) {
      url.searchParams.set('cursor', cursor);
    }

    const response = await fetch(url, {
      headers: { Authorization: `Bearer ${apiKey}` }
    });
    if (!response.ok) {
      throw new Error(`BackResto ${response.status}`);
    }

    const page = await response.json();
    yield* page.data;
    cursor = page.nextCursor;
  } while (cursor !== null);
}
```

**A walk is a consistent snapshot.** The first page pins the position of the
stream, and every later page is answered as of that same position. Records
written while you are paging do not shift the pages under you. You see them on
your next walk.

The cursor is bound to the restaurant, the collection **and the limit**. Change
the page size mid-walk and it answers `400`: pick a limit, keep it for the
whole walk.

## Keeping a copy up to date

There is no `since` parameter today. A refresh is another walk, and you
reconcile with what you already hold:

- **Key on `id`** within a collection, and overwrite when the `sequence` you
  receive is higher than the one you stored.
- **Honour tombstones.** `deleted: true` is the delete instruction; applying it
  is the only way your copy stops diverging.
- **Expect late arrivals.** A device that was offline during service uploads
  when it reconnects, so a record can appear after a walk that would have
  covered its `data.timestamp`. Report on `capturedAt`, sync on `receivedAt`.

An empty page is not proof that nothing happened. See
[the note on completeness](https://developers.backresto.com/en/docs/support).

---

## Rate limits

> The per-key budget, the one header that describes it, and how to stay under it.

Source: https://developers.backresto.com/en/docs/rate-limits

The Partner API allows **300 requests per minute per key**. The window is a
rolling minute, and the budget belongs to the key rather than to the restaurant
or to your company, so two deployments with two keys have two budgets. The
[MCP endpoint](https://developers.backresto.com/en/docs/mcp) draws on the same budget: one tool call is one
request.

Going over answers `429` with a problem document of type
`rate-limit-exceeded` and a `Retry-After` header giving the number of seconds
until the budget refills. Wait it out; do not retry sooner, because a request
that arrives early consumes budget without succeeding.

`Retry-After` is the only budget header. There is no `X-RateLimit-Remaining` to
watch, so pace your client by design rather than by reading a counter. The
habits below are that design.

## Staying under it comfortably

Three habits cover almost every integration:

**Ask for full pages.** `limit=100` walks the same collection in a quarter of
the requests that `limit=25` needs. The cost of a request is the
request, not the row count.

**Fetch files only when you need them.** A picture's record already says what
the file is, in `data.asset`: type, size and digest. Call the assets endpoint
for the pictures you are about to show or store, not for every record in a
walk, and skip the ones whose `sha256` you already hold.

**Serialise a backfill.** Walking a year of history with ten workers in
parallel is the one shape that reliably hits the limit. One worker at
`limit=100` moves through a busy restaurant's year in a couple of minutes.

## If you genuinely need more

Tell us what the workload is. The limit exists to keep one misbehaving client
from degrading the service for the restaurant whose data it is, not to ration
access; a described, legitimate workload is a conversation, not a refusal.

## The other limits worth knowing

| Limit | Value |
| --- | --- |
| Requests per key | 300 per minute |
| Page size | 100 records |
| Signed URL lifetime, photographs and files | 15 minutes |
| Live keys per account | 10 |

These are enforced by the API rather than described by it: exceeding either of
the first two answers `429` or `400` rather than quietly truncating.

---

## Collections & records

> The twenty-six record collections, the snapshot envelope they share, and how to walk one.

Source: https://developers.backresto.com/en/docs/collections

A **collection** is one record type: `temperature-records`, `cooling`,
`deliveries`, and twenty-three others. Every one is read the same way,
through the same four endpoints, and every record comes back in the same
envelope: the fields around `data` that say when it was captured and whether
it still exists.

Each collection is a separate grant. A key reads `temperature-records` because
someone granted `temperature-records:read`, and nothing else comes with it.

## What you can read

```http
GET /v1/restaurants/{restaurantId}/collections
GET /v1/restaurants/{restaurantId}/collections/{collection}/records?limit=…&cursor=…
GET /v1/restaurants/{restaurantId}/collections/{collection}/records/{recordId}
GET /v1/restaurants/{restaurantId}/collections/{collection}/records/{recordId}/assets
```

Start with the first one. It lists **only the collections your key was granted**,
each with the scope that opened it, so you never have to guess:

```json
{
  "data": [
    {
      "collection": "temperature-records",
      "readScope": "temperature-records:read",
      "description": "Received shadow snapshots for temperature-records; not complete primary-store history.",
      "stateKind": "received-shadow-snapshot",
      "payloadVersion": 1
    }
  ]
}
```

An empty `data` is not an error and not an outage: it is a key with no
collection grants. Most keys issued before this surface existed have exactly
that, and widening one is [an email](https://developers.backresto.com/en/docs/access).

## The envelope

Every record in every collection carries the same outer fields. Only `data`
changes shape.

| Field | Type | Meaning |
| --- | --- | --- |
| `id` | string | The record's identifier, stable and unique within the collection. |
| `restaurantId` | string | The restaurant it belongs to. Echoes the path. |
| `collection` | string | Which collection it came from. Echoes the path. |
| `data` | object \| absent | The record itself. A tombstone is the only case where it can be missing, so treat it as present everywhere else. |
| `deleted` | boolean | `true` means a tombstone: the record was deleted in the app. |
| `capturedAt` | string | When the device recorded the change, epoch milliseconds as a string. |
| `receivedAt` | string | When this API received it. Later than `capturedAt`, sometimes by hours. |
| `sequence` | string | A monotonically increasing position in the stream of changes. Compare two of them; do not do arithmetic on one. |
| `mutationId` | string | The identifier of the change that produced this state. Idempotency key on our side; a deduplication key on yours. |
| `sourceVersion` | string \| null | The version stamp of the originating record, when it has one. |
| `payloadVersion` | number | Currently always `1`. It bumps if the meaning of `data` ever changes. |
| `stateKind` | string | Always `received-shadow-snapshot`. Read the next section. |

`capturedAt` and `receivedAt` both matter. A tablet in a cold room with no
signal records at 09:00 and uploads at 14:00; ordering your own pipeline on
`receivedAt` keeps it correct, and reporting on `capturedAt` keeps it true.

## What a snapshot is, and is not

`stateKind` says `received-shadow-snapshot`, and the wording is careful.

- **It is the current state of a record**, not a log of every edit. Read a
  record twice and you get what it looks like now, both times.
- **It is what we received**, not what the restaurant holds. A device that never
  uploaded a change means a record this API has never seen.
- **It is not a backfill.** A collection begins for a restaurant the day capture
  is switched on for it. Records created before that are in the app and not
  here. [Deliveries](https://developers.backresto.com/en/docs/deliveries) are the one exception: those two
  collections carry the history the app still held when they opened.

So an absent record is genuinely ambiguous: never recorded, or recorded and not
yet arrived. Do not build a figure that reads as an audit on top of it, and see
[the completeness note](https://developers.backresto.com/en/docs/support) before you report a count to anyone.

Tombstones are the one case where absence is unambiguous. `deleted: true` with
no `data` means the record existed and was deleted, and it is the only way you
learn that something went away.

## How long records stay

Operational records stay here for **90 days**, counted from when they happened
in the kitchen (`data.timestamp`), not from when we received them. After that, a
nightly job moves them to a locked cold archive, kept for five years, and they
stop appearing in every read: lists, single records and their assets.

| Kept 90 days | Kept for the life of the account |
| --- | --- |
| `temperature-readings`, `temperature-records`, `cooking-temperature-records`, `cleaning-task-records`, `cleaning-task-pictures`, `cooling`, `freezing`, `reheating`, `transport`, `fryer-checks`, `surface-analyses`, `traceability-labels`, `deliveries`, `delivery-pictures` | `restaurants`, `users`, `areas`, `equipment`, `sensors`, `cooking-equipment`, `suppliers`, `products`, `preparations`, `cleaning-tasks`, `fryer-equipment`, `drive-files` |

**An archived record is not a tombstone**, and it is the one exception to the tombstone rule above. It leaves without a `deleted: true`,
because nobody deleted it: it moved. If you keep a copy, keep what you already
hold, and never treat a record missing from a walk as a delete. For anything
older than 90 days, your copy is the source; an inspection that needs our
archive goes through [support](https://developers.backresto.com/en/docs/support).

## The twenty-six collections

Every one takes `<collection>:read` as its scope, so `cooling` needs
`cooling:read`, and so on. They are documented by domain, field by field, on
the pages below.

| Page | Collections |
| --- | --- |
| [Temperatures](https://developers.backresto.com/en/docs/temperatures) | `temperature-records`, `temperature-readings`, `cooking-temperature-records` |
| [Deliveries](https://developers.backresto.com/en/docs/deliveries) | `deliveries`, `delivery-pictures` |
| [Traceability labels](https://developers.backresto.com/en/docs/traceability-labels) | `traceability-labels` |
| [Cleaning](https://developers.backresto.com/en/docs/cleaning) | `cleaning-tasks`, `cleaning-task-records`, `cleaning-task-pictures` |
| [Fryers](https://developers.backresto.com/en/docs/fryers) | `fryer-equipment`, `fryer-checks` |
| [Cooling & food processes](https://developers.backresto.com/en/docs/food-processes) | `cooling`, `freezing`, `reheating`, `transport` |
| [Surface analyses](https://developers.backresto.com/en/docs/surface-analyses) | `surface-analyses` |
| [Documents](https://developers.backresto.com/en/docs/drive-files) | `drive-files` |
| [Catalogue](https://developers.backresto.com/en/docs/catalogue) | `suppliers`, `products`, `preparations` |
| [Facilities & people](https://developers.backresto.com/en/docs/facilities) | `restaurants`, `users`, `areas`, `equipment`, `sensors`, `cooking-equipment` |

Temperatures inside a delivery are always Celsius: a reading taken in
Fahrenheit is converted when it arrives, and every `temperatureRecords[].unit`
says `"C"`.

Start with **Facilities & people** if you are reading any of the others:
equipment thresholds and areas are what turn a bare measurement into something
you can judge.

The [OpenAPI document](https://api.backresto.com/openapi.json) carries the same
shapes, generated from the running service. When a page here and that document
disagree, the document is right and we have a page to fix.

## Walking a collection

```http
GET /v1/restaurants/{restaurantId}/collections/{collection}/records?limit=100
```

| Parameter | Required | Rules |
| --- | --- | --- |
| `limit` | no | 1 to 100. Defaults to 50. |
| `cursor` | no | The `nextCursor` of the previous page, verbatim. |

There is no time range: you walk a collection, not a window of it. To read a
week of deliveries, walk `deliveries` and keep the records whose
`data.timestamp` falls in that week.

**A walk is a consistent snapshot.** The first page pins the position of the
stream, and every later page is answered as of that same position. Records
written while you are paging do not shift the pages under you and do not appear
mid-walk. You see them on your next walk. Ordering is by `sequence`, ascending.

The cursor is bound to the restaurant, the collection **and the limit**. Change
the page size mid-walk and it is rejected: pick a limit, keep it for the whole
walk.

```js
async function* records({ apiKey, restaurantId, collection }) {
  const base = `https://api.backresto.com/v1/restaurants/${restaurantId}/collections/${collection}/records`;
  let cursor = null;

  do {
    const url = new URL(base);
    url.searchParams.set('limit', '100');
    if (cursor !== null) {
      url.searchParams.set('cursor', cursor);
    }

    const response = await fetch(url, {
      headers: { Authorization: `Bearer ${apiKey}` }
    });
    if (!response.ok) {
      throw new Error(`BackResto ${response.status}`);
    }

    const page = await response.json();
    yield* page.data;
    cursor = page.nextCursor;
  } while (cursor !== null);
}
```

### Keeping a copy up to date

There is no `since` parameter today. A refresh is another walk, and you
reconcile with what you already hold:

- **Key on `id`** within a collection, and overwrite when the `sequence` you
  receive is higher than the one you stored.
- **Honour tombstones.** `deleted: true` is the delete instruction; applying it
  is the only way your copy stops diverging.
- **Walk at a sane hour.** A full collection at `limit=100` is a handful of
  requests for a single restaurant, and the [budget](https://developers.backresto.com/en/docs/rate-limits) is 300 a
  minute, but several hundred restaurants on the same cron minute is a spike
  you own.

If an incremental cursor would change what you can build, say so. It is a small
change to a stream that is already ordered. The reason it does not exist is
that nobody has needed it yet.

## Assets

Four collections carry a file: `cleaning-task-pictures`,
`delivery-pictures`, `traceability-labels` and `drive-files`. The record names it in `data.asset`;
the bytes come from the assets endpoint.

```http
GET /v1/restaurants/{restaurantId}/collections/{collection}/records/{recordId}/assets
```

```json
{
  "data": [
    {
      "id": "a17c93be4f02",
      "contentType": "application/pdf",
      "byteLength": 184320,
      "sha256": "9f2a…",
      "uploadedAt": "1789000000000",
      "url": "https://…?X-Amz-Signature=…",
      "urlExpiresAt": "1789000900000"
    }
  ]
}
```

It answers with a list of signed URLs, each valid for **fifteen minutes**, and
every URL in one response shares the same expiry. Each one carries its own
authorisation, so the download needs no `Authorization` header, which also
means the link is a bearer credential in itself: for fifteen minutes anybody
holding it can read that file. Two things are worth knowing.

**These are files, not only pictures.** A cleaning proof or a delivery
photograph is a picture, but a
traceability label or a drive file can be a PDF, a CSV, a spreadsheet or a Word
document. Read `contentType` rather than assuming an image, and do not rename
everything `.jpg` on the way in.

**`sha256` is there so you can skip work.** It is the digest of the bytes: if it
matches something you already stored, you do not need to download it again.

Only assets whose upload completed and was verified appear. One still in flight
is absent rather than broken, and the same is true once the parent record is
deleted.

The rest of the advice is worth repeating because the failure is quiet: fetch
the bytes now, store the bytes rather than the link, never put the URL
somewhere it outlives its purpose (an email, a ticket, a long-lived cache), and
call the endpoint again when you need a fresh URL. It is cheap, and it re-checks
the grant.

## The failures you will meet

**`403`**: your key reaches the restaurant but not with that collection's
scope. The collections endpoint is the cheap way to find out which ones it does
have.

**`404`**: no grant for that restaurant at all, or no such record. The two are
indistinguishable on purpose.

**`400`**: a collection outside the twenty-six above, or a cursor that does
not belong to this restaurant, collection and limit.

All three are [problem documents](https://developers.backresto.com/en/docs/errors) with a `requestId`.

---

## Temperatures

> Fridge and cooking temperatures, taken by a person or reported by a sensor. Three collections, and what tells them apart.

Source: https://developers.backresto.com/en/docs/temperatures

Temperature is the measurement a food-safety inspection turns on, and the app
records it three ways. They look alike and mean different things, so the
distinction is worth getting right before you build on any of them.

| Collection | Scope | Who took the measurement |
| --- | --- | --- |
| `temperature-records` | `temperature-records:read` | A person, on a fridge or freezer, during a named shift. |
| `temperature-readings` | `temperature-readings:read` | A [sensor](https://developers.backresto.com/en/docs/facilities), on its own, unattended. |
| `cooking-temperature-records` | `cooking-temperature-records:read` | A person, on a cooking unit: an oven, a holding cabinet. |

All three share the [snapshot envelope](https://developers.backresto.com/en/docs/collections): `id`, `deleted`,
`capturedAt`, `receivedAt`, `sequence` and the rest sit beside the `data`
described below.

## `temperature-records`

A manual check on a piece of cold-chain equipment. One record per reading, per
piece of equipment, per shift.

| Field | Type | Meaning |
| --- | --- | --- |
| `timestamp` | string, **required** | When the reading was taken, epoch milliseconds as a string. |
| `value` | number, **required** | The temperature itself. |
| `unit` | string, **required** | `CELSIUS` in every record we have seen. Read it rather than assuming. |
| `shift` | string, **required** | The service it belongs to: `MORNING`, `EVENING`. Upper case. |
| `equipmentId` | string, **required** | The [equipment](https://developers.backresto.com/en/docs/facilities) measured. |
| `correctiveActions` | string[] | What was done when the reading was out of range. Empty when nothing was needed. |
| `userId` | string \| null | The staff member who took it, when the app recorded one. |

```json
{
  "id": "48a30f0b-ccc0-4d18-8404-525b16ecaaa6",
  "collection": "temperature-records",
  "deleted": false,
  "capturedAt": "1789772570338",
  "receivedAt": "1789772802108",
  "sequence": "1",
  "data": {
    "timestamp": "1789768800000",
    "value": -14.4,
    "unit": "CELSIUS",
    "shift": "MORNING",
    "equipmentId": "84ce5c13-3237-40d4-901a-cbba59a6406f",
    "userId": "2774953d-8d9b-4a68-8ec4-1209edd90777"
  }
}
```

**`value` is a reading, not a verdict.** Nothing in the record says whether it
was acceptable: that depends on the `min` and `max` on the
[equipment](https://developers.backresto.com/en/docs/facilities), which you have to read separately and which the
restaurant can change. A record taken at -14.4 °C is a problem in a fridge and
normal in a freezer.

**`correctiveActions` is free text**, typed during service in the language of
the restaurant. Count it if you like; do not build an enum from it.

## `temperature-readings`

The same measurement, reported by a wireless probe rather than a person. Same
shape minus the two fields that only make sense when a human was involved:
there is no `shift` and no `userId`.

| Field | Type | Meaning |
| --- | --- | --- |
| `timestamp` | string, **required** | When the sensor reported, epoch milliseconds as a string. |
| `value` | number, **required** | The temperature. |
| `unit` | string, **required** | As above. |
| `equipmentId` | string, **required** | The equipment the sensor watches. |
| `correctiveActions` | string[] | Filled in afterwards, by a person, when an alert was acted on. |

These arrive on the sensor's own schedule, so a busy restaurant produces far
more of these than of manual records. Plan your polling for the volume rather
than for the headcount.

Which sensor reported is not on the reading. The link lives on the
[`sensors`](https://developers.backresto.com/en/docs/facilities) collection, whose `sensorEquipmentId` points back
at the equipment. Mind the name: it is not `equipmentId`.

## `cooking-temperature-records`

A person measuring a cooking unit rather than a cold one. Identical to
`temperature-records` except that it points at
[cooking equipment](https://developers.backresto.com/en/docs/facilities).

| Field | Type | Meaning |
| --- | --- | --- |
| `timestamp` | string, **required** | When the reading was taken. |
| `value` | number, **required** | The temperature. |
| `unit` | string, **required** | As above. |
| `shift` | string, **required** | The service it belongs to. |
| `cookingEquipmentId` | string, **required** | The cooking unit measured, **not** `equipmentId`. |
| `correctiveActions` | string[] | What was done about an out-of-range reading. |
| `userId` | string \| null | Who took it. |

The field name is the one difference that bites: a client that reads
`equipmentId` here gets `undefined`, silently, and a chart with no equipment on
it.

## Reading all three together

A dashboard that answers "was this fridge in range today" wants
`temperature-records` and `temperature-readings` merged on `equipmentId`, with
the thresholds from `equipment`. Three walks, joined on your side. There is no
endpoint that does it for you.

Two things to build in from the start:

- **Report on `capturedAt`, sync on `receivedAt`.** A tablet in a cold room uploads
  when it finds signal, so the record of a 09:00 reading can arrive at 14:00.
  [The envelope page](https://developers.backresto.com/en/docs/collections) has the full story.
- **Absence proves nothing.** A missing reading may mean the check was skipped,
  or that the device has not uploaded it yet. Do not print a completion rate
  from this API and call it compliance. See [the caveat](https://developers.backresto.com/en/docs/support).

---

## Traceability labels

> The secondary labels staff print and stick on a container, with the printed file attached and a group id per print run.

Source: https://developers.backresto.com/en/docs/traceability-labels

When a container is opened or a preparation is made, staff print a label and
stick it on: what it is, where it came from, when it was opened, when it has to
go. These are the secondary shelf-life labels, the ones an inspector turns over
in their hand, and this collection is the record of each one that was printed,
with the printed file itself attached.

| Collection | Scope | What a record is |
| --- | --- | --- |
| `traceability-labels` | `traceability-labels:read` | One label that was printed, and the file that was printed. |

It shares the [snapshot envelope](https://developers.backresto.com/en/docs/collections): `id`, `deleted`,
`capturedAt`, `receivedAt`, `sequence` and the rest sit around the `data`
below.

## `traceability-labels`

| Field | Type | Meaning |
| --- | --- | --- |
| `timestamp` | string, **required** | When the label was printed, epoch milliseconds as a string. |
| `supplier` | string \| null | Who supplied what the label is stuck on. Free text. |
| `part` | number \| null | Undocumented. A decimal number, not an integer. Read the note below before using it. |
| `commentary` | string \| null | A note typed at print time. Free text. |
| `groupId` | string \| null | The print run this label belongs to. |
| `userId` | string \| null | The [staff member](https://developers.backresto.com/en/docs/facilities) who printed it, when the app kept one. |
| `asset` | object, **required** | The file that was printed. Read the next section. |

```json
{
  "id": "0c6a4f2b-9e17-4d50-8b3c-1f7d5a2e9046",
  "collection": "traceability-labels",
  "deleted": false,
  "capturedAt": "1789786412903",
  "receivedAt": "1789786500117",
  "sequence": "2048",
  "data": {
    "timestamp": "1789786380000",
    "supplier": "Metro",
    "part": 1.5,
    "commentary": "Bac 3, ouvert ce matin",
    "groupId": "5e8b1c47-2a90-4f63-b1d8-6c04e7a3f215",
    "userId": "b3f7c1a0-5d42-4e88-9a16-7c0e2d4b9f31",
    "asset": {
      "objectKey": "restaurants/36eaa3fa/labels/c58d10b7e4a9",
      "status": "uploaded",
      "contentType": "image/jpeg",
      "byteLength": 48210,
      "sha256": "3c9e…"
    }
  }
}
```

**`supplier` is a name, not a reference.** It is text, not the id of a
[supplier](https://developers.backresto.com/en/docs/catalogue), and nothing keeps the two in step: a supplier
renamed in the catalogue does not rewrite labels printed last month. Match on
it if you must, but treat a match as a guess and a miss as normal.

## The file

Every label carries one: `data.asset` says a file exists, and the bytes come
from the assets endpoint.

```http
GET /v1/restaurants/{restaurantId}/collections/traceability-labels/records/{recordId}/assets
```

It answers with signed URLs valid for **fifteen minutes**, each carrying its own
authorisation so the download needs no header. The full rules (what the
response looks like, why `sha256` lets you skip a download, why you store the
bytes and not the link) are on
[the collections page](https://developers.backresto.com/en/docs/collections). Two things are worth saying
here anyway.

**`asset` describes the file; only the endpoint hands it over.** It carries
`objectKey`, `status`, `contentType`, `byteLength` and `sha256`, but no URL:
a link that never expired would be a permanent unauthenticated way into a
restaurant's records. Branch on `status`: `uploaded` means the bytes landed and
were verified, `pending` means a device is still sending them, and a `pending`
asset is deliberately absent from the assets endpoint rather than broken.

**A printed label is not necessarily an image.** Read the `contentType` the
assets endpoint gives you rather than assuming a photograph, and do not name
everything `.jpg` on the way into your own store.

## Labels printed together

`groupId` is the field that turns a stream of labels back into something a
person would recognise. When staff print a batch (several labels for several
containers of the same preparation, in one go), every label of that run carries
the same `groupId`. Group on it before you display anything: one run is one
event in a timeline, not eight.

`part` is the field we cannot yet tell you the meaning of, and we would rather
say so than have you guess wrong. It is a **decimal** number, not a counter,
which rules out the obvious reading of "label 3 of 8" and suggests a portion or
a quantity, but nothing in the schema states it, so we are not going to
pretend. Carry it through untouched, show it raw if you must, and
[ask us](https://developers.backresto.com/en/docs/support) if your integration depends on it: the answer is one
conversation with the people who built the label screen.

Both are nullable. A label printed on its own can arrive with neither, and that
is a single-label run rather than a broken record: fall back to the envelope
`id` and show it alone.

---

## Deliveries

> Goods-in checks and the photographs taken at reception: two collections, every field, and what they mean on the shop floor.

Source: https://developers.backresto.com/en/docs/deliveries

A delivery is one goods-in check: a member of staff receiving an order,
recording temperatures, and deciding whether to accept it. It is the record a
food-safety inspector asks for. The pictures taken at reception are a second
collection beside it.

| Collection | Scope | What a record is |
| --- | --- | --- |
| `deliveries` | `deliveries:read` | One goods-in check, with a temperature reading per product. |
| `delivery-pictures` | `delivery-pictures:read` | One photograph taken during a delivery, pointing back at it. |

Both are ordinary [collections](https://developers.backresto.com/en/docs/collections): the same snapshot envelope
around `data`, the same endpoints, the same cursor, the same 90-day rule. They
carry the delivery history the app still held when they opened, not only what
was recorded since.

## `deliveries`

| Field | Type | Meaning |
| --- | --- | --- |
| `timestamp` | string, **required** | When the check happened, epoch milliseconds as a string. |
| `isCompliant` | boolean, **required** | The staff member's verdict on the delivery as a whole. |
| `supplierDeliveriesId` | string \| null | The [supplier](https://developers.backresto.com/en/docs/catalogue) the goods came from: the `id` of a `suppliers` record. |
| `temperatureRecords` | array \| null | One entry per product measured. See below. |
| `nonComplianceReasons` | string[] \| null | Why the delivery was refused or accepted with reservation. Free text chosen by the staff member; empty when compliant. |
| `correctiveActions` | string[] \| null | What was done about it. Empty when nothing was needed. |
| `commentary` | string \| null | Free-text note. Often `null`. |
| `userId` | string \| null | The [staff member](https://developers.backresto.com/en/docs/facilities) who received it, when the app recorded one. |

### `temperatureRecords[]`

| Field | Type | Meaning |
| --- | --- | --- |
| `product` | string | What was measured, as the staff member named it. Never empty. |
| `lotNumber` | string \| null | The batch or lot, when it was captured. |
| `value` | number \| null | The reading. `null` when the product was logged without a measurement. |
| `unit` | `"C"` | Always Celsius. See below. |

**Temperatures are always Celsius.** A restaurant whose app records in
Fahrenheit still sends Fahrenheit readings, and they are converted when they
arrive, before they are stored. `unit` is `"C"` on every entry, so a consumer
never has to convert or guess.

```json
{
  "id": "8f2c1b04-0d5a-4b7e-9f31-6ad2c0e77a51",
  "collection": "deliveries",
  "deleted": false,
  "capturedAt": "1787932805120",
  "receivedAt": "1787932911004",
  "sequence": "88",
  "data": {
    "timestamp": "1787932800000",
    "isCompliant": false,
    "supplierDeliveriesId": "supplier-7",
    "temperatureRecords": [
      { "product": "Poulet fermier", "lotNumber": "L2291", "value": 6.4, "unit": "C" },
      { "product": "Farine T55", "lotNumber": null, "value": null, "unit": "C" }
    ],
    "nonComplianceReasons": ["Température trop élevée"],
    "correctiveActions": ["Produit refusé", "Fournisseur prévenu"],
    "commentary": "Camion en retard, rupture de chaîne du froid probable",
    "userId": "2774953d-8d9b-4a68-8ec4-1209edd90777"
  }
}
```

## `delivery-pictures`

A label, a damaged pallet, a probe against a display: the pictures are the
evidence behind `isCompliant`. Each one is a record that points at its
delivery, and it carries a file, so the bytes come from the assets endpoint.

| Field | Type | Meaning |
| --- | --- | --- |
| `timestamp` | string, **required** | When the picture was taken, epoch milliseconds as a string. |
| `deliveryId` | string \| null | The `deliveries` record it belongs to. |
| `part` | number \| null | Position of this record inside a picture the app stored in several parts. Carry it through rather than interpreting it. |
| `groupId` | string \| null | Ties those parts together. Records sharing a `groupId` are the same picture. |
| `asset` | object, **required** | Names the file: `objectKey` and `status` always, plus `contentType`, `byteLength` and `sha256` once it is uploaded. |

```json
{
  "id": "c61e0a7d-35b2-4f89-a1d4-7e90b2c45f18",
  "collection": "delivery-pictures",
  "deleted": false,
  "capturedAt": "1787932861240",
  "receivedAt": "1787932990517",
  "sequence": "143",
  "data": {
    "timestamp": "1787932860000",
    "deliveryId": "8f2c1b04-0d5a-4b7e-9f31-6ad2c0e77a51",
    "part": 4,
    "groupId": "b4d81f0a-c2e7-4a55-9d10-6f3e8a2b7c91",
    "asset": {
      "objectKey": "delivery-pictures/b4d81f0a/4.jpg",
      "status": "uploaded",
      "contentType": "image/jpeg",
      "byteLength": 902450,
      "sha256": "9f2a…"
    }
  }
}
```

The bytes are a second call, against the record's own id:

```http
GET /v1/restaurants/{restaurantId}/collections/delivery-pictures/records/{recordId}/assets
```

It answers with signed URLs valid for fifteen minutes, exactly as described on
[the collections page](https://developers.backresto.com/en/docs/collections). Ask on any part of a picture and you
get the same file: the API resolves the group for you, so there is no need to
work out which part holds it.

To show the photographs of one delivery, walk `delivery-pictures` and keep the
records whose `deliveryId` is that delivery's `id`, one per `groupId`.

## Reading it correctly

**`isCompliant` is the record, not a computation.** It is what the person
receiving the delivery decided, and it can disagree with what you would
conclude from the temperatures alone: a reading taken on a surface probe, a
product with its own threshold, a judgement call. Present it as their verdict.
If you want your own, compute it beside theirs and label it as yours.

**Free-text fields are free text.** `nonComplianceReasons`, `correctiveActions`
and `product` are typed by staff during service, in the language of the
restaurant, with the spelling of a busy Tuesday. Do not build an enum from
them, do not key a join on them, and do not assume French.

**`value` can be `null`.** A product logged without a reading is normal. It is
often a dry good. Treat `null` as "not measured", never as `0`.

**Timestamps are strings.** `timestamp` is a decimal string of epoch
milliseconds, because the whole BackResto platform stores timestamps that way.
`Number(timestamp)` is safe today and for the next few hundred thousand years,
but do not let a JSON parser coerce it silently and then write it back with
precision lost.

**A picture can arrive after its delivery.** A phone uploads photographs when
it can, sometimes minutes after the check itself. A delivery with no picture
yet may simply have one still on its way; walk again later before concluding
it has none.

---

## Cleaning

> The cleaning plan, the tasks actually done and the photographs proving it. Three collections, and what a missing record does not prove.

Source: https://developers.backresto.com/en/docs/cleaning

Cleaning in the app is a plan and its proof. The restaurant writes down what
has to be cleaned, where and how often; staff tick the tasks off as they do
them; some of those tasks demand a photograph. Three collections, one per
layer, and the join between them is where most of the work is.

| Collection | Scope | What a record is |
| --- | --- | --- |
| `cleaning-tasks` | `cleaning-tasks:read` | A line of the plan: what must be cleaned, where, how often, whether it needs a photograph. |
| `cleaning-task-records` | `cleaning-task-records:read` | A task actually done: when, and by whom. |
| `cleaning-task-pictures` | `cleaning-task-pictures:read` | The photograph proving it was. Carries a file. |

All three share the [snapshot envelope](https://developers.backresto.com/en/docs/collections): `id`, `deleted`,
`capturedAt`, `receivedAt`, `sequence` and the rest sit beside the `data`
described below.

## `cleaning-tasks`

The plan itself. These change rarely (a restaurant writes its plan once and
edits it when the kitchen changes), so this is the collection you walk least
often and cache longest.

| Field | Type | Meaning |
| --- | --- | --- |
| `index` | integer, **required** | The task's position in the plan, as the app orders it. |
| `name` | string, **required** | What has to be cleaned, in the restaurant's words. |
| `description` | string \| null | Longer instructions, when someone wrote them. |
| `areaId` | string \| null | The [area](https://developers.backresto.com/en/docs/facilities) it belongs to. `null` on a restaurant that does not split itself into areas. |
| `recurrence` | integer, **required** | How often the task comes round, as a plain integer. |
| `requirePhotoProof` | boolean \| null | `true` when the task demands a photograph. `null` means the app never set it. |
| `isDeleted` | boolean, **required** | The app's own soft delete. Read the note below. |

```json
{
  "id": "c9a4f7e2-1b83-4d05-a6f1-90e3b7c4d218",
  "collection": "cleaning-tasks",
  "deleted": false,
  "capturedAt": "1789601204773",
  "receivedAt": "1789601399042",
  "sequence": "1",
  "data": {
    "index": 3,
    "name": "Nettoyage de la trancheuse",
    "description": "Démonter la lame, dégraisser, désinfecter.",
    "areaId": "7d2c0b61-4e8a-49f3-9c27-5a1b8e60d3f4",
    "recurrence": 1,
    "requirePhotoProof": true,
    "isDeleted": false
  }
}
```

**`recurrence` carries no unit.** It is an integer and the record does not say
what it counts. Show it as the app shows it rather than rendering "every 1
days" from a guess.

**`isDeleted` is not the envelope's `deleted`.** A task the restaurant removed
from its plan comes back with `isDeleted: true` and `deleted: false`: it is
still a live record, describing a line that no longer applies. Filter on both,
and keep the deleted ones around. Old records still point at them.

## `cleaning-task-records`

A task done. Small on purpose: which task, when, who.

| Field | Type | Meaning |
| --- | --- | --- |
| `timestamp` | string, **required** | When the task was done, epoch milliseconds as a string. |
| `cleaningTaskId` | string, **required** | The `cleaning-tasks` record it satisfies. |
| `userId` | string \| null | The [staff member](https://developers.backresto.com/en/docs/facilities) who did it, when the app recorded one. |

```json
{
  "id": "5f8b3d16-2c90-4a77-b4e8-31d0a9c65f7b",
  "collection": "cleaning-task-records",
  "deleted": false,
  "capturedAt": "1789775012558",
  "receivedAt": "1789775204910",
  "sequence": "2",
  "data": {
    "timestamp": "1789774800000",
    "cleaningTaskId": "c9a4f7e2-1b83-4d05-a6f1-90e3b7c4d218",
    "userId": "2774953d-8d9b-4a68-8ec4-1209edd90777"
  }
}
```

`cleaningTaskId` is required, so every record has a task. The reverse does not
hold: a task can sit in the plan with no record against it for weeks, and that
is the normal state of a weekly task on a Tuesday.

## `cleaning-task-pictures`

The photograph. It carries a file, which makes it the one collection here you
cannot consume from the records endpoint alone.

| Field | Type | Meaning |
| --- | --- | --- |
| `timestamp` | string, **required** | When the picture was taken, epoch milliseconds as a string. |
| `cleaningTaskRecordId` | string \| null | The `cleaning-task-records` record it proves. Nullable. See below. |
| `part` | number \| null | Undocumented, and a decimal rather than a counter. Carry it through rather than interpreting it, the same caveat as on [traceability labels](https://developers.backresto.com/en/docs/traceability-labels). |
| `groupId` | string \| null | Ties those pictures together. Records sharing a `groupId` belong to the same proof. |
| `asset` | object, **required** | Names the file: `objectKey` and `status` always, plus `contentType`, `byteLength` and `sha256` once it is uploaded. |

```json
{
  "id": "2d71c8a9-6e34-4b0f-8517-ac93e25d0b46",
  "collection": "cleaning-task-pictures",
  "deleted": false,
  "capturedAt": "1789775118330",
  "receivedAt": "1789775301774",
  "sequence": "3",
  "data": {
    "timestamp": "1789774860000",
    "cleaningTaskRecordId": "5f8b3d16-2c90-4a77-b4e8-31d0a9c65f7b",
    "part": 1,
    "groupId": "a03e5c88-71bd-4f92-b6d4-2e8f10c73a5b",
    "asset": {
      "objectKey": "cleaning-task-pictures/2d71c8a9/1.jpg",
      "status": "uploaded",
      "contentType": "image/jpeg",
      "byteLength": 812043,
      "sha256": "9f2a…"
    }
  }
}
```

The bytes are a second call, against the record's own id:

```http
GET /v1/restaurants/{restaurantId}/collections/cleaning-task-pictures/records/{recordId}/assets
```

It answers with a list of signed URLs, each valid for **fifteen minutes**, each
carrying its own authorisation so the download needs no header. Fetch the bytes
now, store the bytes rather than the link, and call the endpoint again when you
need a fresh URL. The rules (what appears, what `sha256` is for, why
`contentType` is worth reading) are on
[the collections page](https://developers.backresto.com/en/docs/collections), and they are the same here.

**`asset.status` tells you whether there are bytes to fetch.** It is `pending`
or `uploaded`. A `pending` asset is a photograph the device has announced and
not yet finished sending: the record is real, the file is not, and the assets
endpoint answers without it. Read the status before you treat an empty asset
list as a photograph that was never taken.

**`cleaningTaskRecordId` is nullable.** A picture can exist without pointing at
a record, so a join that assumes it is always there drops photographs on the
floor. Count them separately rather than discarding them silently.

## Joining the three

The shape you almost certainly want is one row per task done, with its plan
entry and its photographs:

- `cleaning-task-records.cleaningTaskId` → `cleaning-tasks.id`
- `cleaning-task-pictures.cleaningTaskRecordId` → `cleaning-task-records.id`

Three walks, joined on your side. There is no endpoint that does it for you,
and there is no filter by task or by date. You walk each collection whole and
reconcile, as [the envelope page](https://developers.backresto.com/en/docs/collections) describes.

Report on `capturedAt` and sync on `receivedAt`: a tablet in a cold room
uploads when it finds signal, and a picture taken at 09:00 can arrive at
14:00, after the record it belongs to, or before it.

## What a missing record does not mean

**A plan entry with no matching record is not proof the task was skipped.** It
may have been done on a device that has not uploaded yet, or done before
capture was switched on for that restaurant. The same goes for a task marked
`requirePhotoProof: true` with no picture against it: the photograph may be
mid-upload, and an asset that has not finished uploading is absent rather than
broken.

So do not print a cleaning completion rate from this API and call it
compliance. What you can say honestly is what arrived, and when. See
[the completeness note](https://developers.backresto.com/en/docs/support) before you put a number in front of
anyone.

---

## Fryers

> The fryers and their oil quality checks. Two collections, and why the measured value can be missing while the decision never is.

Source: https://developers.backresto.com/en/docs/fryers

Frying oil degrades as it is used, and past a point it has to be filtered or
thrown away. The restaurant tests it, decides what to do, and records both.
Two collections: the fryers, and the checks made on them.

| Collection | Scope | What a record is |
| --- | --- | --- |
| `fryer-equipment` | `fryer-equipment:read` | A fryer. |
| `fryer-checks` | `fryer-checks:read` | An oil quality check on one of them, and what was decided. |

Both share the [snapshot envelope](https://developers.backresto.com/en/docs/collections): `id`, `deleted`,
`capturedAt`, `receivedAt`, `sequence` and the rest sit beside the `data`
described below.

## `fryer-equipment`

The fryers themselves, as the restaurant lists them. A short record: a
name, a position in the list, and where it stands.

| Field | Type | Meaning |
| --- | --- | --- |
| `index` | integer, **required** | The fryer's position in the list, as the app orders it. |
| `name` | string, **required** | What the restaurant calls it. |
| `areaId` | string \| null | The [area](https://developers.backresto.com/en/docs/facilities) it stands in. `null` on a restaurant that does not split itself into areas. |
| `isDeleted` | boolean, **required** | The app's own soft delete. Read the note below. |

```json
{
  "id": "6b1d0f54-8e27-4c93-a7b0-52fd3e1c9a86",
  "collection": "fryer-equipment",
  "deleted": false,
  "capturedAt": "1789598411206",
  "receivedAt": "1789598603471",
  "sequence": "1",
  "data": {
    "index": 1,
    "name": "Friteuse gauche",
    "areaId": "7d2c0b61-4e8a-49f3-9c27-5a1b8e60d3f4",
    "isDeleted": false
  }
}
```

**There are no thresholds here.** Unlike [equipment](https://developers.backresto.com/en/docs/facilities), a fryer
carries no `min` and no `max`: nothing on the record says what a good oil
reading is. Whether a check was acceptable is the restaurant's judgement, and
the only trace of it is the action they took.

**`isDeleted` is not the envelope's `deleted`.** A fryer the restaurant removed
comes back with `isDeleted: true` and `deleted: false`: still a live record,
describing a fryer that is no longer in service. Filter on both, and keep the
removed ones. Old checks still point at them.

## `fryer-checks`

One check on one fryer: what the test showed, and what was done about it.

| Field | Type | Meaning |
| --- | --- | --- |
| `timestamp` | string, **required** | When the check was made, epoch milliseconds as a string. |
| `testValue` | string \| null | What the test showed, as text. `null` when nothing was measured. |
| `action` | string, **required** | What was decided about the oil: filtering it, changing it, leaving it as it is. |
| `fryerEquipmentId` | string, **required** | The fryer that was checked. |
| `userId` | string \| null | The [staff member](https://developers.backresto.com/en/docs/facilities) who made the check, when the app recorded one. |

```json
{
  "id": "e07a5c92-4f61-48b8-9d3a-b18c60e5427f",
  "collection": "fryer-checks",
  "deleted": false,
  "capturedAt": "1789777348215",
  "receivedAt": "1789777510964",
  "sequence": "2",
  "data": {
    "timestamp": "1789777200000",
    "testValue": "18",
    "action": "Filtration de l'huile",
    "fryerEquipmentId": "6b1d0f54-8e27-4c93-a7b0-52fd3e1c9a86",
    "userId": "2774953d-8d9b-4a68-8ec4-1209edd90777"
  }
}
```

**`testValue` is a string, not a number.** It is what the strip or the probe
showed, recorded as text, and the record carries no unit and no scale. A
restaurant using test strips and one using a polar-compound meter both land
here. Keep it as text. Parsing it into a float across restaurants gives you a
column whose values do not compare.

**`action` is free text** in the language of the restaurant. The schema does
not constrain it, so read the value rather than matching it against a list of
your own, and do not build an enum from what you see in one restaurant's
data.

## What a check without a value means

`testValue` is nullable and `action` is required, and that asymmetry is the
thing to design around. A check can be recorded as an action taken with no
measured value behind it: someone changed the oil because it looked wrong,
because it was the end of the week, because the fryer was being cleaned
anyway.

So a check is not a measurement. It is a decision, sometimes with a
measurement attached. If you are building a table of oil readings over time,
expect a good share of rows with nothing in the value column, and count them
rather than dropping them. An action with no value is still a check that
happened.

## Working with these

**Join on `fryerEquipmentId`.** A check names its fryer and nothing else; the
fryer's name is on `fryer-equipment`, which you walk separately. Two walks,
joined on your side.

**Report on `capturedAt`, sync on `receivedAt`.** A tablet uploads when it finds
signal, so a check made at 09:00 can arrive at 14:00.
[The envelope page](https://developers.backresto.com/en/docs/collections) has the full story.

**Absence proves nothing.** A fryer with no check this week may not have been
checked, or may be sitting on a device that has not uploaded. Do not turn a
count of these into a compliance figure. See
[the caveat](https://developers.backresto.com/en/docs/support).

---

## Cooling & food processes

> Cooling, freezing, reheating and transport. Four collections recording a temperature transition, and what an unfinished one looks like.

Source: https://developers.backresto.com/en/docs/food-processes

A hot dish that cools slowly spends hours in the range where bacteria
multiply, so the rule is to bring it down fast and to be able to show you
did. Four collections record that kind of transition. Three of them are a
transition in time (down, down further, back up), and the fourth is the
same idea in space.

| Collection | Scope | What a record is |
| --- | --- | --- |
| `cooling` | `cooling:read` | A hot product brought down to cold-storage temperature. |
| `freezing` | `freezing:read` | A product taken down to frozen. |
| `reheating` | `reheating:read` | A cold product brought back up to service temperature. |
| `transport` | `transport:read` | A product moved from one place to another, with the temperature at each end. |

All four share the [snapshot envelope](https://developers.backresto.com/en/docs/collections): `id`, `deleted`,
`capturedAt`, `receivedAt`, `sequence` and the rest sit beside the `data`
described below.

## `cooling`

One cycle: a product, when it started and how hot it was, when it finished and
how cold it was.

| Field | Type | Meaning |
| --- | --- | --- |
| `timestamp` | string, **required** | The record's own stamp, epoch milliseconds as a string. Not the cycle's clock. That is the two dates below. |
| `product` | string, **required** | What was cooled, as text. |
| `beginDate` | string, **required** | When the cycle started, epoch milliseconds as a string. |
| `beginTemperature` | number, **required** | The temperature it started at. |
| `endDate` | string \| null | When it finished. `null` while it has not. |
| `endTemperature` | number \| null | The temperature it finished at. `null` alongside `endDate`. |
| `reminderId` | string \| null | The reminder the app attached to the cycle, when there was one. |
| `userId` | string \| null | The [staff member](https://developers.backresto.com/en/docs/facilities) who recorded it, when the app recorded one. |

```json
{
  "id": "0e5d1a7c-9f24-4b13-8d60-c1a7f0b25e94",
  "collection": "cooling",
  "deleted": false,
  "capturedAt": "1789779612441",
  "receivedAt": "1789779910228",
  "sequence": "1",
  "data": {
    "timestamp": "1789772400000",
    "product": "Blanquette de veau",
    "beginDate": "1789772400000",
    "beginTemperature": 63.5,
    "endDate": "1789779600000",
    "endTemperature": 8.2,
    "userId": "2774953d-8d9b-4a68-8ec4-1209edd90777"
  }
}
```

**`product` is a name, not a reference.** There is no `productId` on these
records, so you cannot join them to `products` without matching strings, and
the strings are typed during service, in the language of the restaurant.

**`reminderId` is opaque.** No collection in this API resolves it. Carry it if
it helps you group records; do not expect to look it up.

## `freezing`

The same shape, for a product taken down to frozen rather than to fridge
temperature. Field for field, it is `cooling`.

| Field | Type | Meaning |
| --- | --- | --- |
| `timestamp` | string, **required** | The record's own stamp. |
| `product` | string, **required** | What was frozen. |
| `beginDate` | string, **required** | When the operation started. |
| `beginTemperature` | number, **required** | The temperature it started at. |
| `endDate` | string \| null | When it finished, or `null`. |
| `endTemperature` | number \| null | The temperature it finished at, or `null`. |
| `reminderId` | string \| null | As above. |
| `userId` | string \| null | Who recorded it. |

Nothing in the record says which of the three it is: that is the collection it
came from, and the envelope's `collection` field echoes it. A pipeline that
merges all three into one table needs to keep that column.

## `reheating`

A cold product brought back up. Same shape again, read in the other direction:
`beginTemperature` is the low one and `endTemperature` the high one.

| Field | Type | Meaning |
| --- | --- | --- |
| `timestamp` | string, **required** | The record's own stamp. |
| `product` | string, **required** | What was reheated. |
| `beginDate` | string, **required** | When it went in. |
| `beginTemperature` | number, **required** | The temperature it started at. |
| `endDate` | string \| null | When it came out, or `null`. |
| `endTemperature` | number \| null | The temperature it reached, or `null`. |
| `reminderId` | string \| null | As above. |
| `userId` | string \| null | Who recorded it. |

An operation with no end looks like this:

```json
{
  "id": "b4c8e21d-3a76-4f58-9c02-77ad5e1b8f30",
  "collection": "reheating",
  "deleted": false,
  "capturedAt": "1789783221907",
  "receivedAt": "1789783402115",
  "sequence": "2",
  "data": {
    "timestamp": "1789783200000",
    "product": "Gratin dauphinois",
    "beginDate": "1789783200000",
    "beginTemperature": 4.1,
    "endDate": null,
    "endTemperature": null,
    "userId": "2774953d-8d9b-4a68-8ec4-1209edd90777"
  }
}
```

## `transport`

The same transition, in space rather than in time: where the product left
from and where it arrived, with a temperature at each end.

| Field | Type | Meaning |
| --- | --- | --- |
| `timestamp` | string, **required** | The record's own stamp. |
| `product` | string, **required** | What was transported, as text. |
| `departureLocation` | string, **required** | Where it left from, as text. |
| `departureTime` | string, **required** | When it left, epoch milliseconds as a string. |
| `departureTemperature` | number, **required** | The temperature on departure. |
| `arrivalLocation` | string \| null | Where it arrived. `null` while it has not. |
| `arrivalTime` | string \| null | When it arrived, or `null`. |
| `arrivalTemperature` | number \| null | The temperature on arrival, or `null`. |
| `reminderId` | string \| null | As above. |
| `userId` | string \| null | Who recorded it. |

```json
{
  "id": "f31b6a08-5c47-4de9-b1a5-6e0c9d247b82",
  "collection": "transport",
  "deleted": false,
  "capturedAt": "1789786944610",
  "receivedAt": "1789787101883",
  "sequence": "3",
  "data": {
    "timestamp": "1789785000000",
    "product": "Plats préparés, service traiteur",
    "departureLocation": "Cuisine centrale",
    "departureTime": "1789785000000",
    "departureTemperature": 3.4,
    "arrivalLocation": "Salle Montparnasse",
    "arrivalTime": "1789786800000",
    "arrivalTemperature": 5.9,
    "userId": "2774953d-8d9b-4a68-8ec4-1209edd90777"
  }
}
```

The two locations are free text, not [areas](https://developers.backresto.com/en/docs/facilities) and not
addresses. They are whatever the person typed, and the arrival end is exactly
as optional as the arrival temperature: one record can carry a departure and
nothing else.

## Working with these

**A null end is two different things.** `endDate` and `endTemperature` (and
`arrivalTime`, `arrivalTemperature` and `arrivalLocation` on `transport`) are
nullable, and the record does not tell you why. It may be an operation still
running as you read it, or one nobody ever closed. Both look identical.

That matters the moment you compute a duration. The dates are strings, so
`endDate - beginDate` subtracts fine on a closed record and, on an open one,
coerces `null` to zero and hands you a large negative number instead of an
error. Nothing throws; your average is simply wrong. Filter to closed records
first, count the open ones separately, and decide for yourself at what age an
open record stops being in progress and starts being abandoned. Nothing in
this API makes that call for you.

**Compute on `beginDate` and `endDate`, not on `timestamp`.** The dates are the
operation's clock. `timestamp` is the record's own, and it is not the thing a
duration is made of.

**Report on `capturedAt`, sync on `receivedAt`.** A tablet in a cold room uploads
when it finds signal, so a cycle started at 09:00 can arrive at 14:00.
[The envelope page](https://developers.backresto.com/en/docs/collections) has the full story.

**Absence proves nothing.** A product with no cooling record may never have
been cooled, or may be sitting on a device that has not uploaded yet. Do not
turn a count of these into a compliance figure. See
[the caveat](https://developers.backresto.com/en/docs/support).

---

## Surface analyses

> Surface swabs. What was tested, whether it passed, and the action plan when it did not.

Source: https://developers.backresto.com/en/docs/surface-analyses

A surface analysis is a swab. Someone runs a test over a work surface (a
cutting board, a slicer, a cold-room shelf) and records what came back. One
record per swab: what was tested, whether it was satisfactory, and what was
decided when it was not.

| Collection | Scope | What a record is |
| --- | --- | --- |
| `surface-analyses` | `surface-analyses:read` | One swab, its verdict, and the action plan behind it. |

It shares the [snapshot envelope](https://developers.backresto.com/en/docs/collections): `id`, `deleted`,
`capturedAt`, `receivedAt`, `sequence` and the rest sit around the `data`
below.

## `surface-analyses`

| Field | Type | Meaning |
| --- | --- | --- |
| `timestamp` | string, **required** | When the swab was taken, epoch milliseconds as a string. |
| `name` | string, **required** | What was tested. Free text, typed by the person. |
| `isSatisfactory` | boolean, **required** | The verdict that was recorded. |
| `actionPlan` | string \| null | What was decided about it. Free text. |
| `userId` | string \| null | The [staff member](https://developers.backresto.com/en/docs/facilities) who recorded it, when the app kept one. |

```json
{
  "id": "6f1d92c4-0b7a-4d31-9f18-3a6c2e5b7d40",
  "collection": "surface-analyses",
  "deleted": false,
  "capturedAt": "1789815240512",
  "receivedAt": "1789815312004",
  "sequence": "412",
  "data": {
    "timestamp": "1789812000000",
    "name": "Planche de découpe viande",
    "isSatisfactory": false,
    "actionPlan": "Désinfection renforcée, nouveau prélèvement lundi",
    "userId": "b3f7c1a0-5d42-4e88-9a16-7c0e2d4b9f31"
  }
}
```

## Reading them

**`isSatisfactory` is a verdict that was taken, not one you compute.** It is
what the laboratory reported or what the operator concluded on the spot,
recorded as given. There is no threshold, no count and no unit in the record to
recompute it from, and you should not go looking for one: present it as their
verdict, in their words, and let a disagreement be theirs to settle.

**`name` is text, not a reference.** It does not point at an
[area or a piece of equipment](https://developers.backresto.com/en/docs/facilities): there is no id here to join
on. Two swabs of the same surface a month apart can be spelled two different
ways, so group on it only if you are willing to normalise, and never present a
normalised name as the one that was recorded.

**`actionPlan` is free text and independent of the verdict.** It is null when
nothing was typed, which is not the same as nothing being done, and it can be
absent on an unsatisfactory swab. Do not infer one field from the other, and do
not build an enum out of a field people write sentences in.

And the caveat that applies to every collection applies here too: what you get
is what this API received, not the restaurant's complete history. See
[the envelope page](https://developers.backresto.com/en/docs/collections) before you count swabs, and
[the completeness note](https://developers.backresto.com/en/docs/support) before you report the count to anyone.

---

## Documents

> The restaurant's own document store (certificates, procedures, reports), each record a filed file with its own media type.

Source: https://developers.backresto.com/en/docs/drive-files

Every restaurant keeps paper beside the checks: supplier certificates, cleaning
procedures, the last inspection report, a signed plan. The app gives them a
place to file it, and this collection is that filing cabinet: one record per
document, each one pointing at the file itself.

| Collection | Scope | What a record is |
| --- | --- | --- |
| `drive-files` | `drive-files:read` | One document filed in the restaurant's document store. |

It shares the [snapshot envelope](https://developers.backresto.com/en/docs/collections): `id`, `deleted`,
`capturedAt`, `receivedAt`, `sequence` and the rest sit around the `data`
below.

## `drive-files`

| Field | Type | Meaning |
| --- | --- | --- |
| `s3Key` | string, **required** | Where the document sits in the store. A key, not a URL. Up to 1024 characters. |
| `name` | string, **required** | The file name as the restaurant sees it. |
| `sizeBytes` | number, **required** | Size of the document in bytes. |
| `contentType` | string \| null | The media type the app recorded. Can be missing. |
| `asset` | object | The file. Read the next section. |

```json
{
  "id": "a94c7e51-3f60-4b2d-8e17-05c9d3a6f482",
  "collection": "drive-files",
  "deleted": false,
  "capturedAt": "1789743015220",
  "receivedAt": "1789743098644",
  "sequence": "97",
  "data": {
    "s3Key": "drive/fournisseurs/attestation-metro-2026.pdf",
    "name": "Attestation Metro 2026.pdf",
    "sizeBytes": 184320,
    "contentType": "application/pdf",
    "asset": {
      "objectKey": "restaurants/36eaa3fa/drive/a17c93be4f02",
      "status": "uploaded",
      "contentType": "application/pdf",
      "byteLength": 184320,
      "sha256": "9f2a…"
    }
  }
}
```

There is no `timestamp` in `data`. When the document was filed is `capturedAt`
on the envelope, like every other collection.

## The file is the point

Elsewhere the record is the information and the file is evidence. Here it is
the other way round: five fields describe a document whose content is the whole
reason anyone reads this collection. So you will almost always follow the
record to the bytes.

```http
GET /v1/restaurants/{restaurantId}/collections/drive-files/records/{recordId}/assets
```

Signed URLs valid for **fifteen minutes**, each carrying its own authorisation.
[The collections page](https://developers.backresto.com/en/docs/collections) has the rules, and two of them
matter more here than anywhere else:

- **`sha256` lets you skip a download.** It is the digest of the bytes. A
  certificate that has not changed since your last walk does not need fetching
  again, and documents are the largest things this API will hand you.
- **Fetch now, store the bytes, never the link.** Fifteen minutes is long
  enough to download and short enough that a URL in your database is a dead
  link by morning.

**`asset` describes the file; only the endpoint hands it over.** It carries
`objectKey`, `status`, `contentType`, `byteLength` and `sha256`, enough to
decide whether you want the bytes, and no URL, because a URL that never expired
would be a permanent unauthenticated link to a restaurant's paperwork.

`status` is the field to branch on. It is `uploaded` once the bytes have landed
and been verified, and `pending` while a device is still sending them. A
`pending` asset is absent from the assets endpoint, which is correct rather than
broken: ask again later instead of treating it as a missing document. `asset` is
also the one field here that can be absent altogether: a record filed with no
file yet.

## These are not pictures

A cleaning proof is a photograph. A document is whatever the restaurant filed:
a PDF certificate, an Excel or CSV temperature export, a Word procedure, a scan
someone took with their phone. All of them turn up here.

**Read `contentType` rather than assuming one.** It is nullable in the record
(the app does not always have it), so when it is null, take the `contentType`
from the asset instead; that one is the media type of the object that is
actually stored, and it is the one to trust when the two disagree. A client
that renders everything as an image, or saves everything as `.pdf`, breaks on
the first spreadsheet.

**Do not derive the type from `name` or `s3Key` either.** An extension is a
convention, not a guarantee, and both fields are free text from a person
naming a file on a tablet.

## Filing them on your side

**`s3Key` is a key, not an address.** It identifies the object in the store:
it has no scheme, no host and no leading slash, and you cannot fetch it. Every
byte you get comes from the assets endpoint.

**Key on the envelope `id`, not on `name`.** Nothing stops two documents being
called `Attestation 2026.pdf`, in the same restaurant, filed a year apart.

**`sizeBytes` is worth reading before you download.** It is the cheapest way to
decide whether to pull a 40 MB scan on a mobile connection. The stored object's
own `byteLength`, on the asset, is the authoritative one.

**A tombstone takes the file with it.** `deleted: true` means the document was
removed in the app, and its assets stop being listed. If you needed that
certificate, you needed the bytes. See
[the envelope page](https://developers.backresto.com/en/docs/collections) for how tombstones behave.

---

## Catalogue

> Suppliers, products and in-house preparations, the reference lists the rest of the record points at.

Source: https://developers.backresto.com/en/docs/catalogue

The catalogue is what a restaurant keeps a list of rather than measures: who
delivers, what comes through the door, and what the kitchen makes itself.
Nothing here is a check or a reading. These are the rows everything else names,
so they are usually the first thing you load and the last thing that changes.

| Collection | Scope | What a record is |
| --- | --- | --- |
| `suppliers` | `suppliers:read` | A company that delivers, and how to reach it. |
| `products` | `products:read` | Something the restaurant receives and uses, by name. |
| `preparations` | `preparations:read` | Something the kitchen makes, with its shelf life and allergens. |

All three share the [snapshot envelope](https://developers.backresto.com/en/docs/collections): `id`, `deleted`,
`capturedAt`, `receivedAt`, `sequence` and the rest sit beside the `data`
described below.

## `suppliers`

One record per supplier the restaurant has entered, whether or not anything has
arrived from them lately.

| Field | Type | Meaning |
| --- | --- | --- |
| `name` | string, **required** | The supplier as the restaurant names it. Free text, not a company register. |
| `isDeleted` | boolean, **required** | The app's own retirement flag. Not the envelope's `deleted`. See below. |
| `contactMethods` | object[] | How to reach them. Each entry is `{ "type": string, "value": string }`. |
| `accountNumber` | string \| null | The restaurant's account with this supplier, when one was entered. |

```json
{
  "id": "1f3c2a76-5b94-4b0e-9c1a-6d8f0a2e7b31",
  "collection": "suppliers",
  "deleted": false,
  "capturedAt": "1789431600214",
  "receivedAt": "1789431604771",
  "sequence": "412",
  "data": {
    "name": "Metro Nanterre",
    "isDeleted": false,
    "contactMethods": [
      { "type": "phone", "value": "+33 1 41 20 30 40" },
      { "type": "email", "value": "commandes@example.test" }
    ],
    "accountNumber": "FR-884213"
  }
}
```

**`contactMethods[].type` is not an enum.** The schema says string and stops,
and the values above are an illustration rather than a list. Switch on it with
a default branch, and show the `value` whichever way the `type` is spelled.

A [delivery](https://developers.backresto.com/en/docs/deliveries) points at its supplier by
`supplierDeliveriesId`, the `id` of a record in this collection. The name, the
account number and the phone number all live here.

## `products`

What the restaurant receives and uses. The record is as thin as it looks.

| Field | Type | Meaning |
| --- | --- | --- |
| `name` | string, **required** | The product as the restaurant named it. |
| `isDeleted` | boolean, **required** | The app's retirement flag. See below. |

```json
{
  "id": "6b0d4ea2-91c7-4f3d-a0be-2c5f7d1e8a44",
  "collection": "products",
  "deleted": false,
  "capturedAt": "1789431980551",
  "receivedAt": "1789432001903",
  "sequence": "413",
  "data": {
    "name": "Beurre doux 250 g",
    "isDeleted": false
  }
}
```

That is the whole record: no reference, no category, no unit, no supplier.
If your model needs any of that, it is yours to hold, keyed on the envelope's
`id`.

**Nothing else points at a product by id.** A delivery records what was
measured as `temperatureRecords[].product`, free text typed during the check.
See [deliveries](https://developers.backresto.com/en/docs/deliveries). Matching that to this list is string work
on your side, and "Beurre doux 250 g" is not "beurre doux". Do it if you must,
but do not present the result as a join.

## `preparations`

Something made in-house rather than received: a sauce, a stock, a terrine.

| Field | Type | Meaning |
| --- | --- | --- |
| `name` | string, **required** | The preparation as the kitchen names it. |
| `lifespan` | number, **required** | How long it keeps. A bare number. |
| `allergens` | string[] | What it contains. Free strings, not a closed set. |
| `isDeleted` | boolean, **required** | The app's retirement flag. See below. |

```json
{
  "id": "c47e8b13-0a52-4d96-8f1b-73ae2905cd6f",
  "collection": "preparations",
  "deleted": false,
  "capturedAt": "1789455120087",
  "receivedAt": "1789455133642",
  "sequence": "418",
  "data": {
    "name": "Sauce béarnaise",
    "lifespan": 3,
    "allergens": ["oeuf", "lait"],
    "isDeleted": false
  }
}
```

**`lifespan` carries no unit.** The schema gives you a number and nothing to
interpret it with. Do not print "3 days" because three looks like days.
Confirm what the app means by it for the restaurant you are reading, and label
it plainly if you cannot.

**`allergens` is a list of strings, not a regulatory list.** Entries come from
the app in the language of the restaurant. Do not map them onto the fourteen
named allergens without checking what the strings actually say, and do not
treat an empty array as a cleared allergen check. It also means nobody filled
it in.

## `isDeleted` is not `deleted`

Every collection on this page carries both, they mean different things, and a
consumer that filters on one of them gets a wrong list.

- **`deleted`, on the envelope**, is the shadow copy's tombstone. `true` means
  the record was deleted in the app and `data` is gone. It is how you learn
  something went away. The [envelope page](https://developers.backresto.com/en/docs/collections) has the rules.
- **`isDeleted`, inside `data`**, is the app's own soft-delete flag on the row.
  The record is still there, still has its name, and still arrives with
  `deleted: false`. The restaurant retired it: it stopped offering it in
  pickers, and kept it so old records still resolve.

So filter on both. Honour `deleted` alone and your supplier list fills up with
suppliers the restaurant dropped two years ago. Honour `isDeleted` alone and
you keep rows that were deleted outright, because a tombstone has no `data` to
read the flag from.

Keep the retired rows rather than dropping them, though. A delivery from last
March still points at a supplier that is `isDeleted: true` today, and resolving
that id to a name is the whole reason you hold this list.

## Reading the catalogue

These three are small, slow-moving and needed by almost everything else, which
makes them the cheap part of a sync and the easy part to get subtly wrong.

- **Walk them first, keep them, refresh them on a schedule.** A restaurant's
  whole catalogue is a handful of pages at `limit=100`. Hold it in your own
  store keyed on the envelope `id`, and resolve names from there rather than
  fetching per record.
- **Names change, ids do not.** `name` is free text the restaurant edits during
  service. Store the `id` as your key and treat the name as a label you
  refresh, never as something to join on.
- **Absence is ambiguous here too.** A supplier that does not appear may never
  have been entered, or may not have reached us yet. See
  [the caveat](https://developers.backresto.com/en/docs/collections) before you report a count.

---

## Facilities & people

> The site, its staff, its zones and its machines. The fixed map every temperature reading hangs off.

Source: https://developers.backresto.com/en/docs/facilities

These are the things that do not move: the restaurant itself, the people who
work in it, the zones it is divided into, and the machines that hold food at a
temperature. None of it is a check.

It still decides what the checks mean. A [temperature](https://developers.backresto.com/en/docs/temperatures) is a
number with no verdict attached until you read the thresholds off the equipment
it was taken on, and a reading belongs to a part of the building only because
the equipment says which area it stands in. Get this page wrong and every
figure downstream is wrong quietly.

| Collection | Scope | What a record is |
| --- | --- | --- |
| `restaurants` | `restaurants:read` | The site itself: name, address, closing days, settings. |
| `users` | `users:read` | A staff account that records checks. |
| `areas` | `areas:read` | A zone the site is divided into: kitchen, cold room, bar. |
| `equipment` | `equipment:read` | A fridge, a freezer, a cold-chain unit, with its thresholds. |
| `sensors` | `sensors:read` | A wireless probe, by MAC address. |
| `cooking-equipment` | `cooking-equipment:read` | An oven or other cooking unit, with its thresholds. |

All six share the [snapshot envelope](https://developers.backresto.com/en/docs/collections): `id`, `deleted`,
`capturedAt`, `receivedAt`, `sequence` and the rest sit beside the `data`
described below.

## `restaurants`

The site your key is scoped to, as a record. One per restaurant, so this
collection is usually a single page.

| Field | Type | Meaning |
| --- | --- | --- |
| `name` | string, **required** | The site's name, as it is displayed in the app. |
| `address` | string, **required** | The postal address, as one string. |
| `closingDays` | string[], **required** | The days the site is shut. Plain strings, not constrained by the schema. |
| `exceptionalClosures` | object[] | One-off closures, each an object with `from` and `to`. |
| `detailedAddress` | object \| null | The address broken into parts, when the app holds it that way. |
| `deliveryAddress` | string \| null | Where goods are delivered, when it differs from `address`. |
| `deliveryDetailedAddress` | object \| null | The same, in parts. |
| `preferredLanguage` | string \| null | The language the restaurant works in. |
| `multiArea` | boolean \| null | Whether the site is split into more than one area. |
| `settings` | object \| null | App settings. The shape is the app's and it moves. |

```json
{
  "id": "e5a1d3c9-7b40-4a28-9df6-18c0b2e46a75",
  "collection": "restaurants",
  "deleted": false,
  "capturedAt": "1789300481002",
  "receivedAt": "1789300489517",
  "sequence": "7",
  "data": {
    "name": "Le Comptoir de Nanterre",
    "address": "12 rue des Anciennes Mairies, 92000 Nanterre",
    "closingDays": ["sunday"],
    "preferredLanguage": "fr",
    "multiArea": true
  }
}
```

The example shows the operational half only. Alongside it the record carries
the commercial one: `subscription`, `subscriptions`, `companyName`,
`billingAddress`, `billingEmail`, `tvaNumber`, `trialEndDate`, `customerId`,
`discount`. They exist, they are in the OpenAPI document, and this page will
not talk you through them.

**Read the operational fields and leave the commercial ones alone.** They
describe the restaurant's contract with us, not its kitchen. They are not a
billing API, they change for reasons that have nothing to do with food safety,
and an integration that renders a customer's subscription state back at them is
a support ticket waiting to happen.

**`closingDays` is a list of plain strings.** The schema puts no shape on them,
so read them and show them; do not switch on them and do not assume a
particular spelling or case.

## `users`

The staff accounts that record checks. This is who a
[temperature record's](https://developers.backresto.com/en/docs/temperatures) `userId` points at.

| Field | Type | Meaning |
| --- | --- | --- |
| `firstName` | string, **required** | Given name, as entered. |
| `lastName` | string, **required** | Family name, as entered. |
| `email` | string, **required** | The account's email address. |
| `phoneNumber` | string \| null | A contact number, when one was given. |
| `modules` | string[] | Which parts of the app this person uses. Free strings. |
| `preferredNotificationTime` | string \| null | When this person asked to be reminded. |
| `isChildren` | boolean \| null | An internal flag. The schema gives it no meaning; do not build on it. |
| `isDeleted` | boolean \| null | The app's own retirement flag, and nullable here, unlike elsewhere. |

```json
{
  "id": "2774953d-8d9b-4a68-8ec4-1209edd90777",
  "collection": "users",
  "deleted": false,
  "capturedAt": "1789315002664",
  "receivedAt": "1789315010218",
  "sequence": "31",
  "data": {
    "firstName": "Amina",
    "lastName": "Berthier",
    "email": "amina.berthier@example.test",
    "phoneNumber": null,
    "modules": ["temperatures", "cleaning"],
    "isDeleted": false
  }
}
```

**This is personal data.** `email`, `phoneNumber` and the two name fields
identify a real person, and they are in this API for one reason: a food-safety
record has to say who performed the check. That is the only job they have here.

So store the `id` and resolve a display name when you need one. Do not copy
contact details into your own tables, your logs, your analytics events or a
third-party tool because they happened to be in the payload. The restaurant is
the data controller for their staff, and every copy you make is one they now
have to account for.

`isDeleted` is nullable on this collection where it is required elsewhere, so
treat a missing flag as "not retired" rather than letting it fall through as
false-ish by accident. The difference between it and the envelope's `deleted`
is [explained on the catalogue page](https://developers.backresto.com/en/docs/catalogue).

## `areas`

A zone of the restaurant. Two fields, and far more important than two fields
suggest.

| Field | Type | Meaning |
| --- | --- | --- |
| `name` | string, **required** | The zone as the restaurant names it: kitchen, cold room, bar. |
| `isDeleted` | boolean, **required** | The app's retirement flag. See [the catalogue page](https://developers.backresto.com/en/docs/catalogue). |

```json
{
  "id": "9c2b17ae-4d80-4f55-b3e1-0a6c8f4d2b19",
  "collection": "areas",
  "deleted": false,
  "capturedAt": "1789301120440",
  "receivedAt": "1789301126871",
  "sequence": "12",
  "data": {
    "name": "Chambre froide",
    "isDeleted": false
  }
}
```

**`areaId` is how everything gets grouped by zone.** Equipment, cooking
equipment, fryers and cleaning tasks all carry one, and it is the only link
between a [reading](https://developers.backresto.com/en/docs/temperatures) and a part of the building. There is no
`areaId` on the records themselves: you get there through the equipment.

`areaId` is nullable everywhere it appears. A fridge with no area is normal.
It means nobody assigned it, usually on a single-room site where `multiArea` is
false. Group those under "unassigned" rather than dropping them.

## `equipment`

Fridges, freezers and other cold-chain units. The record that decides whether a
temperature was acceptable.

| Field | Type | Meaning |
| --- | --- | --- |
| `index` | integer, **required** | The position the restaurant gave it in its own list. Display order, not an identifier. |
| `type` | string, **required** | What kind of unit it is. An unconstrained string. Read it, and do not switch on it. |
| `name` | string, **required** | The unit as the kitchen calls it. |
| `min` | number \| null | The lowest acceptable temperature. |
| `max` | number \| null | The highest acceptable temperature. |
| `areaId` | string \| null | The area it stands in. |
| `equipmentSensorId` | string \| null | The sensor fitted to it, when there is one. |
| `state` | string \| null | The unit's current state, as an unconstrained string. |
| `outOfRangeCount` | number \| null | A count of out-of-range readings that the app maintains. |
| `isDeleted` | boolean, **required** | The app's retirement flag. |

```json
{
  "id": "84ce5c13-3237-40d4-901a-cbba59a6406f",
  "collection": "equipment",
  "deleted": false,
  "capturedAt": "1789302455901",
  "receivedAt": "1789302461330",
  "sequence": "58",
  "data": {
    "index": 2,
    "type": "freezer",
    "name": "Congélateur bas",
    "min": -22,
    "max": -18,
    "areaId": "9c2b17ae-4d80-4f55-b3e1-0a6c8f4d2b19",
    "equipmentSensorId": "b31f7d64-0e29-42ca-9a57-51d3c8e07f28",
    "state": "ok",
    "outOfRangeCount": 0,
    "isDeleted": false
  }
}
```

**`min` and `max` are the only verdict you get.** A
[temperature record](https://developers.backresto.com/en/docs/temperatures) carries a value, a time and the
equipment it was taken on. Nothing in it says whether it was fine. -14.4 °C
is a crisis in a fridge and a normal Tuesday in a freezer, and this record is
what tells the two apart. Every compliance figure you build joins here.

They are also nullable. When `min` or `max` is absent you have no threshold,
and the honest answer for that reading is "unknown", not "in range". Say so in
your interface rather than defaulting to green.

**Thresholds are the current ones, not the ones that applied.** The snapshot
gives you today's `min` and `max`; a reading from March was judged against
whatever was set in March, and the restaurant can change them at any time. If
you re-evaluate old readings against today's numbers (which is all this API
lets you do), label the result as your recalculation, not as what the kitchen
saw.

**`type` and `state` are unconstrained strings.** Both are single free-text
fields in the schema with no list behind them. Display them, group on them if
you must, and never let an unrecognised value fall through a switch into
silence.

**`outOfRangeCount` is the app's number, not yours.** The schema does not say
what window it covers, and you cannot rebuild it from the snapshots here.
Treat it as a signal from the app, and if you need a count you can defend,
compute your own from the readings and thresholds and label it as yours.

`equipmentSensorId` points from the equipment to its sensor. The sensor record
points back the other way. Both sides are nullable, and neither is guaranteed
to be filled in just because the other is.

## `sensors`

The wireless probes. Two fields, both optional.

| Field | Type | Meaning |
| --- | --- | --- |
| `macAddress` | string \| null | The probe's hardware address, how you tell one physical device from another. |
| `sensorEquipmentId` | string \| null | The equipment this sensor watches. |

```json
{
  "id": "b31f7d64-0e29-42ca-9a57-51d3c8e07f28",
  "collection": "sensors",
  "deleted": false,
  "capturedAt": "1789302501764",
  "receivedAt": "1789302509002",
  "sequence": "61",
  "data": {
    "macAddress": "F4:12:9D:3A:77:0B",
    "sensorEquipmentId": "84ce5c13-3237-40d4-901a-cbba59a6406f"
  }
}
```

Note the two field names, which are mirror images and easy to transpose:
equipment carries `equipmentSensorId`, a sensor carries `sensorEquipmentId`.
Read the wrong one and you get `undefined` with no error.

There is no name here, no battery level and no last-seen time. What a sensor
reported is on [`temperature-readings`](https://developers.backresto.com/en/docs/temperatures), and those are keyed
by `equipmentId` rather than by the sensor, so a probe that has gone quiet
looks exactly like one that had nothing to report.

## `cooking-equipment`

Ovens, holding cabinets and the rest of the hot side. Same idea as `equipment`,
with the cold-chain machinery stripped out.

| Field | Type | Meaning |
| --- | --- | --- |
| `index` | integer, **required** | Display order in the restaurant's own list. |
| `type` | string, **required** | What kind of unit it is. Unconstrained string. |
| `name` | string, **required** | The unit as the kitchen calls it. |
| `min` | number \| null | The lowest acceptable temperature. |
| `max` | number \| null | The highest acceptable temperature. |
| `areaId` | string \| null | The area it stands in. |
| `isDeleted` | boolean, **required** | The app's retirement flag. |

```json
{
  "id": "3d90f4c8-62b7-4e13-8a05-ff71d6b9c204",
  "collection": "cooking-equipment",
  "deleted": false,
  "capturedAt": "1789303880115",
  "receivedAt": "1789303887640",
  "sequence": "64",
  "data": {
    "index": 1,
    "type": "oven",
    "name": "Four à sole",
    "min": 63,
    "max": 260,
    "areaId": "9c2b17ae-4d80-4f55-b3e1-0a6c8f4d2b19",
    "isDeleted": false
  }
}
```

No `state`, no `outOfRangeCount`, no sensor: cooking units are read by a
person, so there is nothing watching them between checks. Their readings are
[`cooking-temperature-records`](https://developers.backresto.com/en/docs/temperatures), which point here with
`cookingEquipmentId`, a different field name from the cold-chain one, and the
usual place a client silently reads nothing.

## Reading the map

Everything on this page is small, slow-moving and needed before any other
collection makes sense.

- **Load it first and hold it.** Walk `areas`, `equipment`,
  `cooking-equipment` and `sensors` before you walk any record collection, and
  resolve names and thresholds from your own copy rather than per record.
- **Refresh it anyway.** Equipment gets renamed, thresholds get corrected, a
  fridge moves to another area. A copy taken once and never walked again drifts
  without ever failing.
- **Keep ids, not copies, especially for people.** Store `userId` and resolve
  a name at render time. See the personal-data note above.
- **Both delete flags, everywhere.** The envelope's `deleted` and `data`'s
  `isDeleted` are different things, and
  [the catalogue page](https://developers.backresto.com/en/docs/catalogue) explains which is which.

---

## MCP server

> Connect Claude, Cursor, Codex or any MCP client to a restaurant's compliance records with one URL and your API key.

Source: https://developers.backresto.com/en/docs/mcp

BackResto runs a **Model Context Protocol** server at
`https://api.backresto.com/mcp`. Connect your AI tool to it with your API key
and you can ask questions of a restaurant's records in the tool's own
interface: no code, nothing to install on our side, nothing to host on yours.

It reads through the same Partner API as everything else, with the same key.
**It cannot see anything the key could not already see**: the restaurant and
scope grants are enforced by the API, not by the tool you connect.

## Connect your tool

You need a key first; see [Getting a key](https://developers.backresto.com/en/docs/access). Then pick your tool:

### Claude

1. **Add a custom connector**: In Claude, on the desktop app or on claude.ai, open Customize, then Connectors, and click Add custom connector. On a Team or Enterprise plan, an owner adds it once in the organisation settings first.

2. **Name it and paste the address**: Call it BackResto and paste this URL. Under Authentication and OAuth client, Claude detects our server and preselects Sign in now and Register automatically: keep those two. Don't enter a client ID or a secret. Then click Add.

```
https://api.backresto.com/mcp
```

3. **Connect with your key**: Click Connect. A BackResto page opens: paste your key, starting with brp_, and click Connect. Claude comes back with the connector switched on, with five tools.

4. **All done**: Ask about your records in plain words: temperatures, cleaning, deliveries, labels. The key already knows which restaurant is yours.

### Claude Code

1. **Register the server**: Open a terminal and run this command, with your key in place of brp_YOUR_KEY.

```sh
claude mcp add --transport http --scope user backresto \
  https://api.backresto.com/mcp \
  --header "Authorization: Bearer brp_YOUR_KEY"
```

2. **Check the connection**: Start Claude Code and type /mcp. backresto is listed as connected, with five tools.

3. **All done**: Ask about your records in plain words: temperatures, cleaning, deliveries, labels. The key already knows which restaurant is yours.

### Cursor

1. **Open the MCP settings**: In Cursor, go to Settings, then Tools & MCP, and click New MCP Server. That opens mcp.json.

2. **Add the server**: Paste this into mcp.json, with your key in place of brp_YOUR_KEY. The server appears in the list with five tools.

```json
{
  "mcpServers": {
    "backresto": {
      "type": "http",
      "url": "https://api.backresto.com/mcp",
      "headers": {
        "Authorization": "Bearer brp_YOUR_KEY"
      }
    }
  }
}
```

3. **All done**: Ask about your records in plain words: temperatures, cleaning, deliveries, labels. The key already knows which restaurant is yours.

### Codex

1. **Put your key in the environment**: Codex reads a bearer token from an environment variable rather than from its configuration file. Add this line to your shell profile, with your key in place of brp_YOUR_KEY.

```sh
export BACKRESTO_API_KEY="brp_YOUR_KEY"
```

2. **Register the server**: Then run this once. Codex will send the variable's value as the Authorization header.

```sh
codex mcp add backresto \
  --url https://api.backresto.com/mcp \
  --bearer-token-env-var BACKRESTO_API_KEY
```

3. **All done**: Ask about your records in plain words: temperatures, cleaning, deliveries, labels. The key already knows which restaurant is yours.

### Other

1. **Open your tool's MCP settings**: Find the MCP or integrations section and add a remote server using Streamable HTTP. If your tool asks only for a URL, it opens a BackResto page where you paste the key, and you can skip the header.

2. **Enter the address**: This is the server URL.

```
https://api.backresto.com/mcp
```

3. **Add your key as a header**: Send it with every request as the Authorization header.

```
Authorization: Bearer brp_YOUR_KEY
```

4. **All done**: Ask about your records in plain words: temperatures, cleaning, deliveries, labels. The key already knows which restaurant is yours.

## The tools

Five tools: one that finds the restaurant, and four that read its
[collections](https://developers.backresto.com/en/docs/collections).

| Tool | What it does |
| --- | --- |
| `backresto_list_restaurants` | Lists the restaurants the key reaches, with its scopes on each. |
| `backresto_list_collections` | Lists the collections this key was granted, with the scope that opened each. The right first call when you do not know what the key reaches. |
| `backresto_list_records` | Reads a page of records from one collection, tombstones included. Takes `collection`, optional `limit` (1-100, default 50) and `cursor`. |
| `backresto_get_record` | Fetches one record by `collection` and `recordId`. |
| `backresto_list_record_assets` | Lists the files attached to a record (`cleaning-task-pictures`, `delivery-pictures`, `traceability-labels` or `drive-files`) as signed URLs, and shows photographs to the model as images it can look at. |

Deliveries are two of those collections, `deliveries` and `delivery-pictures`,
read with the same tools as everything else. See [Deliveries](https://developers.backresto.com/en/docs/deliveries)
for what their fields mean.

`restaurantId` is optional everywhere. Leave it out and the key's own restaurant
is used, so a restaurant with one key never has to know its identifier. Only a
key that reaches several restaurants is asked to choose, and the error names the
choices.

All five are declared read-only and idempotent, so a well-behaved client will
not ask permission for each call the way it does for a tool that writes.

Two practical limits. Photographs are inlined for the model up to **ten images
and about 7.5 MB** per call to `backresto_list_record_assets`; anything beyond that still appears in the summary,
with its URL and the reason it was not shown. And the whole endpoint shares the
Partner API [budget](https://developers.backresto.com/en/docs/rate-limits) of 300 requests a minute per key: one
tool call is one request, which a conversation will never approach and a loop
will.

## Keeping the key safe

The key is the whole of your access, and an MCP client's configuration is an
ordinary file on a laptop.

- **Never commit that file.** If your tool keeps its configuration in a
  repository, reference an environment variable or an OS secret store instead,
  as the Codex setup above does.
- **Give each machine its own key.** One key per laptop means a lost laptop is
  one revocation, not a rotation across every integration you run.
- **Ask us when a key was last used** if you suspect a copy is still live
  somewhere you thought it was gone. We can see when each key last
  authenticated, and a revocation is the same email.

## Connecting by URL alone

Claude (desktop and claude.ai), ChatGPT and other tools that take only a server
URL connect through OAuth: they register with BackResto on their own, then open
a BackResto page where you paste your key once. Nothing to install and no
configuration file. The tool keeps the key and sends it for you, so it reaches
exactly what the key reaches, and revoking the key disconnects it.

There is no sign-in with a BackResto account yet: the key is still the
credential. If signing in with your account is what stands between you and an
integration, say so: it moves up the list.

## What it is good at

Concretely, with the tools connected, an operations lead can ask:

- *"Which deliveries were refused last month, and why?"*
- *"Show me every chicken delivery above 4 °C this quarter."*
- *"Show me the photos of the delivery refused on Tuesday: is the damage visible?"*
- *"Which fridges went out of range most often, and in which area?"*
- *"Did the cooling cycles all come down in time last week?"*
- *"Which cleaning tasks were skipped, and which have no photograph?"*

The first three read the `deliveries` and `delivery-pictures` collections, the
rest read other [collections](https://developers.backresto.com/en/docs/collections), and every one of them only
what your key was granted. The
answers come from the same records an inspector would read, through the same
grants the restaurant issued.

A model reading collections should be told what it is reading: a snapshot of
what the API received, not a guaranteed-complete history. If you put this in
front of a customer, put that sentence next to it.

---

## Support & data completeness

> What the current data does and does not cover, how the API is versioned, and how to reach a human.

Source: https://developers.backresto.com/en/docs/support

## The completeness caveat, stated plainly

The Partner API exposes records captured **after the feature was enabled for
that restaurant**, in every [collection](https://developers.backresto.com/en/docs/collections). It does not claim
to hold a restaurant's full history, and it will not backfill one. Deliveries
are the one exception: their two collections carry the history the app still
held when they opened.

This matters more than it sounds:

- An empty result is **not** evidence that nothing happened. It may mean the
  restaurant was not yet enabled, or that a device has not uploaded yet.
- A count from this API is not a compliance figure. Do not print one on a
  report that reads as an audit.
- If you need to know a restaurant's enablement date, ask us or ask the
  customer. It is not currently exposed through the API. If you need it as a
  field, tell us and it becomes one.

Collections say this in their own response: `stateKind` is
`received-shadow-snapshot`, meaning the state this API received, not the state
the restaurant's app holds. The two agree in the ordinary case and diverge
exactly when a device has not uploaded yet.

Once a restaurant is enabled, records arrive reliably, including ones captured
while a device was offline: those are uploaded when it reconnects, which is why
[incremental polling should overlap](https://developers.backresto.com/en/docs/pagination) and why `capturedAt` and
`receivedAt` are both on every record.

## Versioning

Every path is prefixed `/v1`, and **this API is in closed beta.** Keys are
issued by hand, to a handful of integrators, and the shape of the API is still
being settled. Read that literally: inside `/v1`, while the beta lasts, an
endpoint can change shape or be withdrawn, and we are not promising otherwise.

What that means in practice:

- **Parse leniently.** Ignore fields you do not know rather than failing on
  them; fields get added often.
- **Watch for withdrawn endpoints.** The dedicated delivery endpoints, and the
  scope that opened their photographs, are gone: deliveries are read as
  [collections](https://developers.backresto.com/en/docs/collections), like every other record type. See below.
- **Tell us you exist.** We know which keys have called us and when. If yours
  is in use we will get in touch before we move something under it, not
  because the beta obliges us to, but because breaking a working integration
  by surprise is a bad way to run one.

When the beta ends this section becomes the usual promise: additive changes
inside a version, anything else behind `/v2`. It is not that yet, and saying so
is more useful to you than a guarantee we would have to walk back.

The [OpenAPI document](https://api.backresto.com/openapi.json) is generated from
the running service, so it is the authoritative description of what is deployed
right now. If this documentation and that document disagree, the document is
right and we have a page to fix. Please tell us.

## Health checks

Two public endpoints, no authentication:

| Endpoint | Meaning |
| --- | --- |
| `GET /health/live` | The process is running. |
| `GET /health/ready` | The process can reach its database and serve traffic. |

`/health/ready` is the one to poll if you monitor us. Successful probes are not
audit-logged, so a monitor does not add noise.

## Getting help

Write to [contact@backresto.com](mailto:contact@backresto.com). What makes an
answer fast:

- the `requestId` from the problem document, or the `X-Request-ID` you sent;
- the **public prefix** of your key, the `brp_…` half before the dot, never the
  secret;
- the environment, the endpoint, and roughly when.

Never send us a key secret. The public prefix identifies it unambiguously. If
a secret has gone somewhere it should not, say so in the subject line and send
the prefix: revocation is immediate, and it is the whole remedy. See
[Getting a key](https://developers.backresto.com/en/docs/access) for the rest of the key lifecycle.

## Asking for more

What exists here exists because somebody asked for it. Cooking and cooling
temperatures, cleaning plans, labels and a hosted MCP endpoint were all on this
list a few months ago; they are now [collections](https://developers.backresto.com/en/docs/collections) and
[an endpoint](https://developers.backresto.com/en/docs/mcp).

**Deliveries were the last item on this list.** They were the first thing this
API served, through their own endpoints, with their own shape and a time range
instead of a cursor. They are now two collections, `deliveries` and
`delivery-pictures`, read through the same envelope, the same paging and the
same `GET .../collections/{collection}/records` as every other record type, and
the old endpoints are withdrawn rather than kept alongside. One way to read a
record is the point of the change. If you built against the old endpoints,
[Deliveries](https://developers.backresto.com/en/docs/deliveries) shows the new shape, and we are happy to help
you move.

What is still on it: webhooks instead of polling, an incremental cursor on
collections, an enablement date on the restaurant, and OAuth sign-in for the MCP
clients that will not take a key. Which one comes next is decided by who asks.
So ask.
