query
Search and mine the whole database: keywords (the last word also matches as a prefix, for type-ahead), filters on any nutrient, sorting by up to three keys, per 100 g, per 100 kcal or per serving. E.g. foods with at least 20 g protein per 100 kcal and under 5 g sugars sorted by fibre; branded yogurts by protein; supplements by magnesium. Runs in memory: milliseconds. Rows whose values contradict each other (macros over 100 g, energy far from the macros) are left out unless include_inconsistent.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| q | No | Keywords in any language. Omit to scan everything that matches the filters. | |
| has | No | Only rows with a known value for each of these properties (registry keys or line:<name>). | |
| per | No | per_100g compares foods and products; per_serving covers supplements and products with a serving weight; per_100kcal needs at least 20 kcal on the basis of the row (per 100 g, or per serving), below that the row is left out; native shows each row on its own basis, for mixed lists. Each row says what its values are per in values_per. | per_100g |
| sort | No | ||
| brand | No | Brand name contains this. | |
| kinds | No | ||
| limit | No | ||
| where | No | Ranges on the chosen basis (per). A property is a registry key or a free label line, line:<name> (see label_lines). | |
| facets | No | Also count matches by kind, brand, dataset, market and proof rank. Each facet counts what passes every other filter. | |
| fields | No | Values to return per row. Defaults to energy, macros and anything filtered or sorted on. A group name ("vitamin_a") returns each of its keys separately; where and sort take one key. | |
| market | No | Country code, e.g. US, CA, FR. | |
| offset | No | ||
| brand_id | No | Exactly this brand (a br_ id). | |
| datasets | No | Source datasets, e.g. "Foundation", "SR Legacy", "CIQUAL 2025", "Branded", "NIH DSLD", "Health Canada LNHPD". Facets list them. | |
| max_rank | No | Only rows whose strongest proof is at least this strong (1 strongest). | |
| has_barcode | No | ||
| include_inconsistent | No |