Skip to content

NutriScan Nutrition API

Food Search API

Your user types a food name. One GET request returns the best matches, each with calories, macros, micronutrients and portions. The user picks one, and your app stores its id.

The test key costs nothing. A search costs 3 credits, and credit packs start at $49 with no subscription.

curl "https://platform-api.nutriscan.app/v1/foods/search?q=apple&limit=5" \
  -H "Authorization: Bearer $NUTRISCAN_KEY"

One search, up to 5 results. This request works with a test key. Send country to get regional values.

What does a food search request do?

GET /v1/foods/search?q= finds foods by name and returns up to 20, best match first. You set the count with limit, from 1 to 20. The default is 10.

q is the food name, 2 to 100 characters, and small typos are tolerated. Encode the query string, so mac & cheese is sent as mac%20%26%20cheese. Every field is in the food search reference.

Search a food

GET /v1/foods/search?q=greek%20yogurt&limit=5

Limit the list

GET /v1/foods/search?q=croissant&limit=3

Fetch one food by id

GET /v1/foods/fd_test_apple

How does the type-then-pick flow work?

Search when the user types, show the list, and let the user pick. Store the id of the pick, and fetch that food again later with a lookup that costs 1 credit.

Each search costs 3 credits and an account can make 60 calls a minute, so call search when the user pauses typing or taps a search button. A call on every key press would use up the 60 a minute quickly.

  1. The user types a food name

    For example "greek yogurt", "pretzel" or "croissant" in the search box of your log screen.

  2. Your server calls the search

    One GET /v1/foods/search with q, a limit and the user's country if you know it. Keep the key on your server.

  3. Your app shows the list

    The results are in results, best match first. Show each name with its serving.label and per_serving.calories.

  4. The user picks a food

    Your app already holds the nutrients for every row in the list, so the pick needs no second request.

  5. Your app stores the id

    Write the id next to the user and the time. Ids are stable, so GET /v1/foods/{id} returns the same food later for 1 credit.

What does the response look like?

It is one JSON object. Loop over results, and read usage for the credits the call used.

The first block is the answer a test key gives for q=apple, shortened. A live answer has the same fields without test_mode. A nutrient we do not know is null, never 0, so show it as unknown and do not add it to a daily total as zero. The second block runs the flow in JavaScript.

Test key answer for q=apple, shortened

{
  "query": "apple",
  "country": null,
  "results": [
    {
      "id": "fd_test_apple",
      "name": "Apple",
      "serving": { "label": "1 medium (182 g)", "grams": 182.0 },
      "per_serving": { "calories": 94.64, "protein_g": 0.55, "carbs_g": 25.12, "fat_g": 0.36, "…": "…" },
      "per_100g": { "calories": 52.0, "protein_g": 0.3, "carbs_g": 13.8, "fat_g": 0.2, "…": "…" },
      "portions": [
        { "unit": "small", "grams": 149.0 },
        { "unit": "medium", "grams": 182.0 }
      ]
    }
  ],
  "usage": { "credits_charged": 0, "credits_left": 48935 },
  "engine_version": "2026.12.0",
  "test_mode": true
}

Search, pick, then fetch again later

const API = "https://platform-api.nutriscan.app/v1";
const headers = { Authorization: `Bearer ${process.env.NUTRISCAN_KEY}` };
const q = new URLSearchParams({ q: "apple", limit: "5" });
const res = await fetch(`${API}/foods/search?${q}`, { headers });
if (!res.ok) throw new Error((await res.json()).error.code);
const { results } = await res.json();
// Show the list. The user taps a row, and you store its id.
const picked = results[0];
// Later, fetch the same food again for 1 credit.
const food = await (await fetch(`${API}/foods/${picked.id}`, { headers })).json();
console.log(food.serving.label, food.per_serving.calories, "kcal");

How do country and portions work?

Send country for regional values, and use portions to fill a unit picker. Without country the values are global.

country takes a two-letter code or a country name. The response repeats the code it read in country, or null when it read none.

Regional values with country

Add country=US, country=DE, country=FR or a name such as country=Germany to the request. A value we cannot read gives you global values.

Portions for a unit picker

portions lists other units for the same food, such as small and medium for the apple, each with its weight in grams. The list can be empty.

Any amount from per 100 g

Multiply per_100g by grams and divide by 100. For the medium apple at 182 g, 52.0 kcal times 182 over 100 is 94.64 kcal, the same number as per_serving.

21 nutrient fields

Both panels hold calories, 7 macro fields and 13 micronutrients, the same fields a scan item has.

Example, worked from our public pricing

What does a food search cost?

A search costs 3 credits, which is $0.003. A lookup by id costs 1 credit, which is $0.001. For 10,000 searches that is 30,000 credits, or $30.

10,000searches

3credits a search

$0.001a credit

$3030,000 credits

A search that returns an empty list is still answered, so it still uses 3 credits. Error responses and test-key calls cost 0. A search needs 3 credits in your balance and a lookup needs 1, otherwise the call returns 402 insufficient_credits. The $49 Starter pack holds 49,000 credits. Credits never expire and there is no subscription.

Starter is $49 for 49,000 credits, Growth is $199 for 199,000 and Scale is $599 for 599,000.

Pack prices

Can I try the food search API before I pay?

Yes. Sign in with your email and you get a free test key. It uses no credits and runs with a zero balance, so your team can build the search box first.

A test key knows three sample foods: Masala Dosa, Paneer Tikka and Apple. A search returns the samples whose name matches your text, and no match gives an empty list. A lookup works for the three sample ids only. Use q=apple for your first run.

RequestTest key answerCredits
q=appleApple0
q=panPaneer Tikka0
q=pizzaAn empty list0

What limits and errors should I plan for?

An account can make 60 calls a minute, and there is a daily limit per account. Four responses need handling in your code.

The 60 calls are shared by all keys on the account. The daily limit has no number here: your app only needs to handle daily_limit when it arrives. Every error costs 0 credits.

ResponseWhenWhat to do
429rate_limited: more than 60 calls in a minute.Wait the seconds in the Retry-After header.
429daily_limit: the daily limit is reached.Stop until 00:00 UTC. Retry-After counts the seconds.
402insufficient_credits: fewer than 3 credits for a search.Buy a pack, then retry.
503search_unavailable: search is down for a moment.Retry after a few seconds.

When should I scan instead of search?

Search when the user types a food name and picks from a list. Scan when the input is a sentence with amounts, a meal photo or a pack label.

A scan uses at least 20 credits and is priced from the work it took, about 65 credits for a typical plate photo. The food logging API page shows how both inputs fit in one diary.

The user gives youUseCredits
A food name to pick from a listGET /v1/foods/search3
A sentence such as "2 eggs and a slice of toast"POST /v1/scans, type text20 or more
A photo of a mealPOST /v1/scans, type meal20 or more
A photo of a pack labelPOST /v1/scans, type label20 or more

Can an AI agent search foods?

Yes. The MCP server has two food tools, search_foods and get_food. They make the same calls, with the same costs and the same key scope.

An agent that logs meals for a user can search by name, let the user confirm one result, and keep the id. Setup for each client and the full tool reference are in the MCP docs.

search_foods

query    the food name
limit    optional, 1 to 20
country  optional, a code or a name

get_food

id       the food id, such as fd_test_apple

What does the food search API not do?

It finds a food by its name and returns its nutrients. It does not look anything up by barcode, grade results or export the list.

It fits when you need

A search box that returns up to 20 foods, best match first

Nutrients per serving and per 100 g, with portions in grams

Regional values when you send country

Stable ids you can store and fetch again for 1 credit

It does not fit when you need

Barcode lookup. There is no barcode endpoint.

A NutriScore grade on a search result. Grades belong to scan results.

A bulk download of the food list. There is no export.

A photo or a sentence as input. Use a scan for those.

Unlimited searches a day. Each account has a daily limit.

For the data itself, see the food database API page.

Food search API questions

Anything else, the food search reference covers every field and error.

What does the food search API return?

GET /v1/foods/search?q= returns up to 20 foods, best match first. Each food has an id, a name, a usual serving, nutrients per serving and per 100 g, and a list of portions in grams. An empty list means nothing matched.

How much does a food search cost?

A search that returns 200 uses 3 credits, which is $0.003, even when the list is empty. A lookup by id uses 1 credit, or $0.001. Errors and test-key calls cost 0. Credit packs start at $49 and credits never expire.

Can I try the food search API without paying?

Yes. A free test key knows three sample foods: Masala Dosa, Paneer Tikka and Apple. A search returns the samples whose name matches your text, and no match gives an empty list. Test calls use no credits.

How do I get values for one country?

Add country to the request, as a two-letter code such as US, DE or FR, or as a country name. Without it you get global values, and country comes back null in the response.

Can I look up a food by barcode?

No. There is no barcode lookup. For a packaged product, send a photo of its nutrition label as a label scan.

How many searches can I run a minute?

An account can make 60 calls a minute across all its keys. Past that you get 429 rate_limited with a Retry-After header. There is also a daily limit per account, which resets at 00:00 UTC and returns 429 daily_limit.

What do I store after the user picks a food?

Store the id from the result. Ids are stable, so you can store them in your own tables and call GET /v1/foods/{id} later for 1 credit. If an id returns 404 not_found, search by name again.

Why do I get 403 scope_missing?

Search needs a key with the search scope. Keys made on or after December 1, 2026 have it unless it was unticked in the console. Older keys are scan only, so create a new key in the console.

Add a food search box with one request

Sign in with your email, run your first search with the test key, and buy credits when you are ready to go live.

  • Test key at sign-up
  • Packs from $49
  • No subscription
  • Credits never expire
A butter croissant on a plate