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 as Authorization: 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 RateLimit headers 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/sandwiches returns up to limit rows (50 by default, 500 at most) and a next_cursor. Send it back as cursor for 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. offset works with any sort.
  • Only what changed. updated_since=2026-12-01T00:00:00Z returns the sandwiches whose page changed after that time.
  • Polling. Every answer carries an ETag. Send it back as If-None-Match and an unchanged list answers 304 with no body.
  • Fewer fields. fields=name,country,sandwich_score returns only those. format=csv returns a spreadsheet, up to 10,000 rows.

Errors

Every error is JSON with an error sentence that says what to fix.

StatusMeaningWhat to do
400A parameter is malformedThe sentence names it
401The endpoint needs a key and none was sent, or the key was withdrawnAsk for a key
404No such address, sandwich or shopThe answer links to the endpoint list
422A build names an ingredient the pantry does not haveLook it up in /v1/ingredients
429Too many requests from this addressWait for the time in the RateLimit-Reset header
503The list is loading just after a restartRetry 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"
ToolWhat it answersKey
about_the_dataThe datasets, their terms and credit linesNo
list_datasetsRow counts and dates for each datasetNo
get_big_mac_indexToday's index, for one country or allNo
get_big_mac_historyOne country's series since 1986No
sample_sandwiches25 sandwiches in fullNo
search_sandwichesSandwiches by name, country, family, ingredients, diet or scoreYes
get_sandwichOne sandwich with its build and full scoreYes
find_ingredientsPantry ingredients by nameYes

What will not change

  • Loading…

Dated changes are in the change log.