API reference
How to call api.onesandwich.com: every endpoint with its parameters and an example, what needs a key, paging, errors, and the MCP server.
Start
The base address is https://api.onesandwich.com. Every answer is JSON. This request needs no key and returns 25 sandwiches in the same shape as the full list:
curl https://api.onesandwich.com/v1/sample/sandwiches
With a key, the same shape for every sandwich on the site:
curl -H "x-api-key: YOUR_KEY" "https://api.onesandwich.com/v1/sandwiches?country=fr&has=butter&limit=5"
JavaScript
const res = await fetch("https://api.onesandwich.com/v1/sandwiches?family=sando", {
headers: { "x-api-key": KEY },
});
const { total, rows, next_cursor } = await res.json();Python
import requests
r = requests.get("https://api.onesandwich.com/v1/sandwiches",
params={"family": "sando"}, headers={"x-api-key": KEY})
rows = r.json()["rows"]Machine-readable: OpenAPI 3.1, the endpoint list, and llms.txt.
Keys and limits
- No key: the sample, the dataset list, the change log, the files, the Big Mac Index, Community sandwiches, and the OpenAPI document.
- Key: the full sandwich list, shops, chains, ingredients, and the Sandwich Score for any build. Ask for a key.
- Send the key as the header
x-api-key, or asAuthorization: Bearer YOUR_KEY. Keep it out of web pages and public code: anyone who reads it can use it. - Limits are per address: 120 requests a minute on the sandwich endpoints, 60 a minute on the open ones. The
RateLimitheaders on every answer say how many are left. - The terms for each dataset are on the data page.
Endpoints
Loading the endpoint list from the API…
If this stays, read the OpenAPI document directly.
Also open, outside the document
GET /v1/big-mac-index/methodology: how the daily figure is worked out, and its sources.GET /v1/builds?sort=new|top|liked|popular&limit=&offset=: Community sandwiches.GET /v1/builds/{id}: one of them.GET /data/v1/manifest.json: the files at fixed addresses.
Paging and polling
- Paging.
/v1/sandwichesreturns up tolimitrows (50 by default, 500 at most) and anext_cursor. Send it back ascursorfor the next page. Rows are in slug order, so a walk by cursor neither skips nor repeats a row when sandwiches are added part-way.offsetworks with anysort. - Only what changed.
updated_since=2026-12-01T00:00:00Zreturns the sandwiches whose page changed after that time. - Polling. Every answer carries an
ETag. Send it back asIf-None-Matchand an unchanged list answers 304 with no body. - Fewer fields.
fields=name,country,sandwich_scorereturns only those.format=csvreturns a spreadsheet, up to 10,000 rows.
Errors
Every error is JSON with an error sentence that says what to fix.
| Status | Meaning | What to do |
|---|---|---|
| 400 | A parameter is malformed | The sentence names it |
| 401 | The endpoint needs a key and none was sent, or the key was withdrawn | Ask for a key |
| 404 | No such address, sandwich or shop | The answer links to the endpoint list |
| 422 | A build names an ingredient the pantry does not have | Look it up in /v1/ingredients |
| 429 | Too many requests from this address | Wait for the time in the RateLimit-Reset header |
| 503 | The list is loading just after a restart | Retry after the seconds in Retry-After |
MCP
The same data is available to assistants that speak the Model Context Protocol. The server is read-only, at https://api.onesandwich.com/mcp (streamable HTTP).
claude mcp add --transport http onesandwich https://api.onesandwich.com/mcp
With a key, the sandwich tools work too:
claude mcp add --transport http onesandwich https://api.onesandwich.com/mcp --header "x-api-key: YOUR_KEY"
| Tool | What it answers | Key |
|---|---|---|
about_the_data | The datasets, their terms and credit lines | No |
list_datasets | Row counts and dates for each dataset | No |
get_big_mac_index | Today's index, for one country or all | No |
get_big_mac_history | One country's series since 1986 | No |
sample_sandwiches | 25 sandwiches in full | No |
search_sandwiches | Sandwiches by name, country, family, ingredients, diet or score | Yes |
get_sandwich | One sandwich with its build and full score | Yes |
find_ingredients | Pantry ingredients by name | Yes |
What will not change
- Loading…
Dated changes are in the change log.