# BackResto Partner API

> Read-only access to a restaurant's own HACCP compliance records kept in BackResto, as 26 record collections: goods-in checks with per-product temperatures and their photographs, temperatures, cooling, freezing, reheating, transport, cleaning, fryer oil, surface analyses, traceability labels and drive files.

Every request needs a partner key, sent as `Authorization: Bearer brp_<prefix>.<secret>`. Keys are issued by hand, scoped to named restaurants, once those restaurants have agreed. There is no sign-up. MCP clients that connect by URL alone (claude.ai and Claude Desktop custom connectors) run the authorization code flow: they register themselves, and the person pastes the key on a BackResto page. OAuth 2.0 clients can also run the client credentials grant against the token endpoint, with the part of the key before the dot as client_id and the part after it as client_secret: the access token it returns is that same key.

## When to use

Use this API when a restaurant that works with BackResto has granted you access and you need to read its food-safety records:

- Goods-in checks: what was delivered, by which supplier, the temperature of each product on arrival, and the photographs taken at the door.
- Temperature logs: fridges and freezers, cooling, freezing, reheating and transport.
- Cleaning plans and completed cleaning tasks, with their photographs.
- Traceability: product labels, batches and use-by dates, fryer oil changes, surface analyses.
- Building an audit export, a compliance dashboard or a supplier report from those records.

Do not use it to write, correct or delete a record (it is read-only), for a restaurant that has not granted your key, or as a live alerting feed: records reach it when a device syncs, which is later than capture when the device was offline.

## How to call it

- From an AI agent or an MCP client: connect to the hosted MCP server below. The tools resolve the restaurant for you when the key reaches only one.
- From code: call the REST API described by the OpenAPI document. Start with `GET /v1/restaurants` to list the restaurants and scopes your key reaches.
- Authenticate with the partner key as a bearer token, or exchange it at the [OAuth 2.0 token endpoint](https://api.backresto.com/oauth/token) (client credentials). See [auth.md](https://api.backresto.com/auth.md).

## Rate limits

300 requests per minute per key. Every authenticated response carries `RateLimit-Policy` and `RateLimit` headers (IETF httpapi draft) with the remaining budget and the seconds until it resets. Past the budget the API answers 429 with a `Retry-After` header.

## Versioning and deprecation

Every path is prefixed `/v1`, and the API is in closed beta: inside `/v1` an endpoint can still change shape or be withdrawn. Parse leniently, since fields get added. Before an endpoint in use goes away, it is marked `deprecated` in the OpenAPI document, its responses carry the `Deprecation` (RFC 9745) and `Sunset` (RFC 8594) headers, and the key holders calling it are contacted. After the beta, changes inside a version are additive and anything else goes behind `/v2`.

## Connect

- [Hosted MCP server](https://api.backresto.com/mcp): streamable HTTP, same partner key. Connect an AI client here.
- [MCP server card](https://api.backresto.com/.well-known/mcp/server-card.json): the tools below, as JSON, readable without a key
- [OpenAPI specification](https://api.backresto.com/openapi.json): generated from the running service, authoritative for what is deployed
- [API catalog](https://api.backresto.com/.well-known/api-catalog): RFC 9727 linkset of the above
- [AI catalog](https://api.backresto.com/.well-known/ai-catalog.json): the MCP server and the OpenAPI document, with the questions each answers

## MCP tools

- `backresto_get_record`: Get the current received shadow snapshot of a record, including its deletion state. Requires the collection:read scope.
- `backresto_list_collections`: List explicitly granted collections of received shadow snapshots. These are not complete primary-store history.
- `backresto_list_record_assets`: List verified, uploaded record assets through signed reads, and show photographs to the model as images (up to 10 per call). Requires the collection read grant; an asset not uploaded yet is excluded. A traceability label is several records sharing one groupId: any of them answers the label photograph.
- `backresto_list_records`: Read one page of the records of a collection, newest received first. To answer about a given day, pass fromDate and toDate (YYYY-MM-DD, restaurant time zone) rather than reading everything. A page is not the whole answer: while nextCursor is not null, call again with it before concluding that something is missing. localTimes gives each record own day in the restaurant time zone, weekday included, with the shift or the clock time when the record has one; use it instead of converting timestamps. savedLocalTimes gives when each record reached BackResto. conformity gives, for temperature checks, the equipment name, its limits and isCompliant (true or false) as the BackResto app decides it. notes says how to read and count this collection. Requires the collection:read scope. Keep every other argument unchanged while paging.
- `backresto_list_restaurants`: List the restaurants this Partner API key can read, with its scopes on each. Rarely needed: every tool defaults to the key's restaurant when it has only one.

## Documentation

- [Developer portal](https://developers.backresto.com/en/docs): quickstart, authentication, scopes, pagination, errors, every record type
- [Connect an AI client over MCP](https://developers.backresto.com/en/docs/mcp): Claude, Cursor, Codex, VS Code
- [Request a partner key](https://developers.backresto.com/en/docs/access)
- [Full documentation for language models](https://developers.backresto.com/llms-full.txt)

## What this API does not do

- It never writes, and it has no webhooks.
- It holds only what was captured after a restaurant enabled it. An empty result is not proof that nothing happened.
