Knuspr Composition API returns the public nutrition panel per 100 g or 100 ml for a product id from search: energy, fats, carbohydrates, sugars, protein, salt and fiber.
Set ingredients=true to include the public ingredients text. An optional slug helps locate the page for that text. An unknown id answers 404 and is free. Costs 1 credit per request; failed requests are free.
Run this endpoint
Endpoint
Parameters
Start with the required fields, then add optional filters only when your use case needs them.
Runnable path
1 required parameter needed before sending a request.
2 optional filters available.
string
Required
Numeric id from search, for example 1470.
1234567890
boolean
Optional
true to include the public ingredients text, default false.
true
string
Optional
Optional product slug, letters digits and dashes only.
example
Response Schema
Example response fields are illustrative; inspect the JSON before integrating.
Example response fields
Scan these fields before integrating.
data
meta
success
{
"data": {
"product": "1470",
"composition": {
"nutrients": [
{
"name": "energyKCal",
"unit": "kcal",
"amount": 64
}
],
"plain_ingredients": "Water, oats."
},
"ingredients_requested": true
},
"meta": {
"credits": 1,
"billable": true,
"endpoint_family": "composition"
},
"success": true
}
Errors
Handle these documented responses before retrying or showing customer-facing failures.
Validation Error
The id or a value is invalid. This response is not billable.
{
"errors": {
"id": [
"A product id is required, e.g. id=1470."
]
},
"message": "The request validation failed"
}Upstream Unavailable
The source could not be reached. This response is not billable.
{
"meta": {
"billable": false,
"retryable": true,
"endpoint_family": "composition"
},
"error": {
"code": "UPSTREAM_UNAVAILABLE",
"message": "Knuspr could not be reached. Please retry shortly."
},
"success": false
}Generate Code with AI
Copy a ready-made prompt with all the endpoint details, parameters, and example responses. Paste it into ChatGPT, Claude, or any AI assistant to instantly generate working code.
Try It Live
Test this endpoint in our interactive playground with real data.