Search the food database
GET/api/public/food-items
Search the food database the dashboard searches: the shared catalog plus the coach's own items. Use it to build meals with real nutrition data — copy productCode, the per-100g macros and a unit/unitWeight pair onto each meal food item. Omit search and barcode to browse the catalog.
Authentication
Requires an API key, sent as Authorization: Bearer cp_live_....
API keys carry scopes. Get the catalog of scopes and webhook events lists every scope.
Query parameters
| Name | Type | Description |
|---|---|---|
page | integer | Page number (1-based, default 1) |
limit | integer | Number of items to return (default 25, max 500) |
search | string | Food name to search for. Matches anywhere in the name, best matches first. |
barcode | string | Exact barcode lookup. Takes precedence over search. |
Request examples
curl --request GET \
--url 'https://api.coach-platform.com/api/public/food-items' \
--header 'Authorization: Bearer cp_live_...'const response = await fetch('https://api.coach-platform.com/api/public/food-items', {
method: 'GET',
headers: {
Authorization: 'Bearer cp_live_...',
},
});
const data = await response.json();Responses
200 OK
Successful response
{
"data": [
{
"id": "<string>",
"productCode": 123,
"name": "<string>",
"manufacturer": "<string>",
"barcode": "<string>",
"caloriesPer100g": 123,
"proteinPer100g": 123,
"carbsPer100g": 123,
"fatPer100g": 123,
"isFavorite": true,
"isCustom": true,
"units": [
{
"unit": "<string>",
"unitWeight": 123
}
]
}
],
"pagination": {
"page": 123,
"limit": 123,
"total": 123,
"hasMore": true,
"truncated": true
}
}Response fields (21)
| Name | Type | Description |
|---|---|---|
data | object[] | |
data[].id | string | |
data[].productCode | number | Send this as productCode on a meal food item to link it to this entry. |
data[].name | string | |
data[].manufacturer | string | |
data[].barcode | string | |
data[].caloriesPer100g | number | |
data[].proteinPer100g | number | |
data[].carbsPer100g | number | |
data[].fatPer100g | number | |
data[].isFavorite | boolean | |
data[].isCustom | boolean | True when the coach created this item, false when it comes from the shared database. |
data[].units | object[] | Units this food can be measured in. unitWeight is how many grams one unit weighs — copy the pair onto a meal food item as unit + unitWeight. |
data[].units[].unit | string | |
data[].units[].unitWeight | number | |
pagination | object | |
pagination.page | number | |
pagination.limit | number | |
pagination.total | number | null | Total number of matching items. null when the underlying source cannot report an exact count for this page; use hasMore to keep paging. |
pagination.hasMore | boolean | |
pagination.truncated | boolean | Present and true when the result set exceeded the in-memory scan cap and was truncated. Narrow your filters to page through all items. |
Error responses
400Bad Request401Unauthorized403Forbidden429Too Many Requests500Internal Server Error
These statuses share the same response body.
{
"error": {
"code": "<string>",
"message": "<string>",
"fix": "<string>",
"details": {},
"retryAfterMs": 123
}
}Error fields (6)
| Name | Type | Description |
|---|---|---|
error | object | |
error.code | string | |
error.message | string | |
error.fix | string | null | |
error.details | object | null | |
error.retryAfterMs | number | null |
More Nutrition Menus endpoints
This page is also available as Markdown. Browse it in the interactive explorer or download the OpenAPI spec.