Resolve a food name to a NutrientsDB record and read its nutrient profile
Version 1.0.0
Two-step flow over the free, keyless NutrientsDB Sample API: search the public 1,000-food sample by name fragment, then re-fetch the chosen record by its stable public_id. Both steps use the single published operation, findFoods, selected by q or by id. No authentication is required.
1 workflow1 source API1 provider
View SpecView on GitHubNutritionFoodNutrientsfood-compositionDataSearchSample DataDatasetai-buildersReference DataOpen Datakeyless-apiArazzoWorkflows
Search the sample by food name, then retrieve the selected food by public_id.
Step 1 searches by name fragment and returns up to 20 matches with total_matches so the caller knows how many were withheld. Step 2 pins the chosen record by its stable public_id, which is the identifier to persist — food names are verbose and ambiguous, ids are not.
arazzo: 1.0.1
info:
title: Resolve a food name to a NutrientsDB record and read its nutrient profile
version: 1.0.0
description: >-
Two-step flow over the free, keyless NutrientsDB Sample API: search the public 1,000-food sample
by name fragment, then re-fetch the chosen record by its stable public_id. Both steps use the
single published operation, findFoods, selected by q or by id. No authentication is required.
sourceDescriptions:
- name: foodsApi
url: ../openapi/nutrientsdb-foods-api-openapi.yml
type: openapi
workflows:
- workflowId: search-then-lookup-food
summary: Search the sample by food name, then retrieve the selected food by public_id.
description: >-
Step 1 searches by name fragment and returns up to 20 matches with total_matches so the caller
knows how many were withheld. Step 2 pins the chosen record by its stable public_id, which is
the identifier to persist — food names are verbose and ambiguous, ids are not.
inputs:
type: object
required: [query]
properties:
query:
type: string
minLength: 2
maxLength: 100
description: Food name fragment, case-insensitive substring match.
example: banana
limit:
type: integer
minimum: 1
maximum: 20
default: 10
description: Maximum search results. Values above 20 are capped at 20.
example: 5
steps:
- stepId: search-foods
description: Search the public 1,000-food sample by name fragment.
operationId: findFoods
parameters:
- name: q
in: query
value: $inputs.query
- name: limit
in: query
value: $inputs.limit
successCriteria:
- condition: $statusCode == 200
- context: $response.body
condition: $.count > 0
type: jsonpath
outputs:
firstFoodId: $response.body#/foods/0/public_id
firstFoodName: $response.body#/foods/0/name
matchCount: $response.body#/count
totalMatches: $response.body#/total_matches
- stepId: lookup-food
description: >-
Retrieve the selected food by its exact public_id. q and id are mutually exclusive, so this
step sends only id.
operationId: findFoods
parameters:
- name: id
in: query
value: $steps.search-foods.outputs.firstFoodId
successCriteria:
- condition: $statusCode == 200
outputs:
foodName: $response.body#/food/name
nutrients: $response.body#/food/nutrients
energyKcal: $response.body#/food/nutrients/energy_kcal
proteinG: $response.body#/food/nutrients/protein_g
outputs:
publicId: $steps.search-foods.outputs.firstFoodId
name: $steps.lookup-food.outputs.foodName
nutrients: $steps.lookup-food.outputs.nutrients
totalMatches: $steps.search-foods.outputs.totalMatches
Discovery needs no key. Ratings and market analysis are Pro.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. See our Privacy Policy and
Terms.