Ingredient search
GET /food/ingredient/search.php
Plans: Standard · PremiumNot available on Limited, which covers barcode lookup only.
Look up raw and generic ingredients and get detailed nutrition for each one: nutrients with their data points and sources, portions, and components.
Send one ingredient, or a comma-separated list of up to ten in a single call.
The limit is per term: up to 3 records for each ingredient you send. The default is 1.
Each record names the search term that found it and a score. The lower the score, the closer the match.
Search pace on Standard: this endpoint accepts one search every 10 seconds, within the plan's 100 requests per minute. Each search endpoint has its own pace. Premium has no search pace.
Base URL
Production server — live data
https://chompthis.com/api/v2
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| api_key | string | Required | Your API key, sent as a query parameter on every request. |
| find | string | Required | A single ingredient, or a comma-separated list of up to 10 ingredients. Example: ground beef, raw broccoli. |
| limit | integer | Optional | Maximum number of records to return per term, from 1 to 3. Default is 1. |
| user_id | string | Premium | Premium only. Send one ID per end user, such as an internal ID or a hash, never an email address or a name. For server-side calls with no end users, send one fixed ID such as system-batch. Details |
Errors
400 · 401 · 404 · 500
Bad request. A parameter is missing or invalid — check that find is present, holds at most 10 terms, and that limit is between 1 and 3.
Unauthorized. One message covers several causes:
- The key isn't recognized, or the subscription is cancelled.
- Your plan doesn't include this endpoint.
- You passed your plan's requests-per-minute limit, or on Standard, the search pace.
- A Premium request has no user_id.
Only a missing user_id and a Premium trial over its call cap add a sentence to the message. Try It on this page works out the likely cause for your key.
Not found. No ingredient matched the term. Try the ingredient's common name, or a simpler form of it.
Server error. Something failed on our side. Retry once; if it persists, contact support with the term you sent.
Every error returns its HTTP status and a JSON body with a single error string. The line "Please try again in a minute" appears on most errors, but it only helps after a rate limit or the search pace.
Examples of the errors you will see most often:
401 — any cause except the two below
{ "error": "401 Unauthorized: Invalid API key, unauthorized access, or usage limits exceeded. Please try again in a minute or contact us. https://chompthis.com/api/ticket-new.php?ref=401" }
401 — Premium request without user_id
{ "error": "401 Unauthorized: Invalid API key, unauthorized access, or usage limits exceeded. You are missing the required \"user_id\" parameter to fulfill his request. Please pass in a unique user ID for every user on your platform that accesses our API. Please try again in a minute or contact us. https://chompthis.com/api/ticket-new.php?ref=401" }
404 — nothing matched
{ "error": "404 Not Found: No food items were found. Please try again in a minute or contact us. https://chompthis.com/api/ticket-new.php" }
Response schema
- itemsarray
- The matching ingredients — one object per ingredient. Fields may be null or absent when no data is available for them.
- namestring
- Item name, as recorded in the source data. For generic ingredients, this is the reference name.
- categoriesarray of string
- The categories this ingredient belongs to.
- nutrientsarray
- The nutrients found in this ingredient — one object per nutrient, each carrying the subfields below.
- nutrients.namestring
- Nutrient name, e.g. Protein, Energy.
- nutrients.per_100gnumber
- Amount of the nutrient per 100g of food.
- nutrients.measurement_unitstring
- The unit the amount is measured in, e.g. G, KCAL, MG.
- nutrients.minnumber
- Minimum observed nutrient value.
- nutrients.maxnumber
- Maximum observed nutrient value.
- nutrients.mediannumber
- Median nutrient value.
- nutrients.rankinteger
- Position in the source data’s nutrient ordering (USDA FoodData Central) — a display sequence, not an amount or a quality score. Null when the source record carries no rank.
- nutrients.data_pointsinteger
- Number of observations the value is based on.
- nutrients.footnotestring
- Comments on any unusual aspect of the nutrient value.
- nutrients.descriptionstring
- Description of the nutrient's source, e.g. "Analytical data; derived by linear regression" or "Calculated".
- calorie_conversion_factorobject
- The multiplication factors used to calculate energy from macronutrients for this food.
- calorie_conversion_factor.protein_valuenumber
- The factor for protein.
- calorie_conversion_factor.fat_valuenumber
- The factor for fat.
- calorie_conversion_factor.carbohydrate_valuenumber
- The factor for carbohydrates.
- protein_conversion_factorobject
- The factor used to calculate protein from nitrogen.
- protein_conversion_factor.protein_valuenumber
- The multiplication factor for protein.
- componentsarray
- The constituent parts of the food (e.g. bone is a component of meat) — one object per component.
- components.namestring
- The kind of component, e.g. Bone.
- components.pct_weightnumber
- The component's weight as a percentage of the total weight.
- components.gram_weightnumber
- The component's weight in grams.
- components.is_refuseboolean
- Whether the component is refuse — not edible.
- components.data_pointsinteger
- Number of observations the measure is based on.
- portionsarray
- Discrete amounts of the food (a patty, an ounce) — one object per portion.
- portions.measurement_unitstring
- The unit used for the measure.
- portions.descriptionstring
- Comments giving the measure more specificity.
- portions.modifierstring
- Qualifier of the measure — e.g. patty, oz.
- portions.gram_weightnumber
- The weight of the measure in grams.
- portions.data_pointsinteger
- Number of observations the measure is based on.
- portions.footnotestring
- Comments on any unusual aspect of the measure.
- common_namestring
- Common name associated with this item — e.g. "Hamburger" for the ground-beef record in the example.
- footnotestring
- Comments on any unusual aspect of this item overall.
- search_termstring
- The original search term that found this ingredient.
- scorenumber
- How similar the ingredient's name is to the search term — the lower the value, the closer the match.
In context
- Data Sources and Quality — the knowledge base article on where the generic-ingredient data comes from.
- Allergen Tracking and Identification — the knowledge base article on the allergens tracked across the catalog.
Request example
cURL
curl "https://chompthis.com/api/v2/food/ingredient/search.php?api_key=YOUR_KEY&find=ground+beef"
Try it
Response
Response example
200 — application/json
{
"items": [
{
"name": "Beef, ground, 70% Lean Meat / 30% Fat, Patty Cooked, Pan-Broiled",
"categories": ["Beef Products"],
"nutrients": [
{ "name": "Water", "per_100g": 59.36, "measurement_unit": "G", "min": 0, "max": 0, "median": 0, "rank": 100, "data_points": 36, "footnote": "", "description": "Analytical data; derived by linear regression" },
{ "name": "Energy", "per_100g": 238, "measurement_unit": "KCAL", "min": 0, "max": 0, "median": 0, "rank": 300, "data_points": 0, "footnote": "", "description": "Calculated" },
{ "name": "Protein", "per_100g": 22.86, "measurement_unit": "G", "min": 0, "max": 0, "median": 0, "rank": 600, "data_points": 36, "footnote": "", "description": "Analytical data; derived by linear regression" },
{ "name": "Cholesterol", "per_100g": 84, "measurement_unit": "MG", "min": 0, "max": 0, "median": 0, "rank": 15700, "data_points": 12, "footnote": "", "description": "Analytical data; derived by linear regression" }
],
"protein_conversion_factor": { "protein_value": 6 },
"components": [],
"portions": [
{ "measurement_unit": "undetermined", "modifier": "oz", "gram_weight": 85, "data_points": 1 },
{ "measurement_unit": "undetermined", "modifier": "patty", "gram_weight": 77, "data_points": 18 }
],
"common_name": "Hamburger",
"search_term": "ground beef",
"score": 54
}
]
}