nutrients
Get a nutrient
Return a single nutrient by its canonical code, or a 404 if unknown.
Supports sparse fieldsets via fields[nutrients]. A non-code id (lowercase slug, legacy integer) resolves to a clean 404, not a validation error.
get/v1/nutrients/{id}
Request
- Base URL: https://api.noms.sh
- URL: https://api.noms.sh/v1/nutrients/{id}
- Auth: API key in header X-API-Key
Path parameters
idstring required
Canonical nutrient code (UPPER_SNAKE, e.g. TOTAL_FAT).
Example:TOTAL_FAT
Query parameters
fields[nutrients]string
Sparse fieldset. A comma-separated subset of nutrients fields to return (e.g. id,name). Omit to return all fields.
Headers
If-None-Matchstring
An ETag from a previous response for this URL. If it still matches, the API answers 304 Not Modified with no body; otherwise you get the full 200. Either way the request is metered.
Response
A single nutrient. fields[nutrients] may trim the keys present in data.
Example response
{
"data": {
"id": "SATURATED_FAT",
"name": "Saturated fat",
"parent_id": "TOTAL_FAT",
"unit": "g"
}
}Changes
No recorded changes to this operation across all 1 revision of this API.