nutrients

List nutrients

Return a keyset-paginated page of the canonical nutrient catalog.

Supports filtering (id, name, unit), sorting, sparse fieldsets (fields[nutrients]), and typo-tolerant search (?q=).

get/v1/nutrients

Request

  • Base URL: https://api.noms.sh
  • URL: https://api.noms.sh/v1/nutrients
  • Auth: API key in header X-API-Key

Query parameters

page_sizeinteger nullable

Number of items to return per page (keyset pagination). Allowed range is 1–20; a value outside it is rejected with a 400.

Example:20
cursorstring nullable

Opaque keyset-pagination cursor. Don't build it by hand; follow links.next from a previous response to fetch the next page.

sortstring nullable

Sort key; prefix with - for descending (-name). Comma-join keys for tie-breakers. Defaults to the resource's natural order.

Example:-name
qstring nullable

Typo-tolerant text search. Filters to matching rows and, when no sort is given, orders them by relevance. Composes with filters and pagination.

Example:chocolat
fields[nutrients]string

Sparse fieldset. A comma-separated subset of nutrients fields to return (e.g. id,name). Omit to return all fields.

idstring

Filter on id. Bare id=value means eq; the bracket form names the operator — id[eq], id[in]. id[in] takes a comma-separated list. Rows with no value for the field never match.

namestring

Filter on name. Bare name=value means eq; the bracket form names the operator — name[eq], name[in]. name[in] takes a comma-separated list. Rows with no value for the field never match.

unitstring

Filter on unit. Bare unit=value means eq; the bracket form names the operator — unit[eq], unit[in]. unit[in] takes a comma-separated list. Rows with no value for the field never match.

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 page of nutrients. fields[nutrients] may trim the keys present in each data item.

Example response

{
  "data": [
    {
      "id": "SATURATED_FAT",
      "name": "Saturated fat",
      "parent_id": "TOTAL_FAT",
      "unit": "g"
    }
  ],
  "links": {
    "next": "https://api.noms.sh/v1/foods?page_size=2&cursor=eyJ2IjpbeyJ0IjoicmF3IiwidiI6Ik1pbGsifV0sInMiOiIrbmFtZSJ9",
    "self": "https://api.noms.sh/v1/foods?page_size=2"
  },
  "meta": {
    "has_more": true,
    "page_size": 10
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.