food

Search foods by text. Return maximum of 20 items

get/foods/search_by_text

Query parameters

search_textstring required
context_user_idstring
extended_queryboolean
food_name_onlyboolean
primary_data_origin_codestring

When set, only return foods whose primary_data_origin_code matches (e.g. cnf for recipe ingredient pickers).

result_kind'food' | 'recipe' | 'all'

food returns catalogue foods only. recipe returns recipes only. all returns the owner's recipes first, then foods.

recipe_tagsstring

Comma-separated recipe filter tags. Applied only to recipe hits. Every tag must be present.

nutrient_rangesstring

Per-serving nutrient ranges, applied only to recipe hits. Comma separated nutrient:min..max; either bound may be omitted, e.g. protein_g:20..,sodium_mg:..600,fiber_g:5..15. Limited to the 21 nutrients recipe search indexes: the Canadian Nutrition Facts panel (energy_kcal, fat_g, fattyacids_totalsaturated_g, fattyacids_totaltrans_g, carbohydrate_g, fiber_g, sugars_g, protein_g, cholesterol_mg, sodium_mg, potassium_mg, calcium_mg, iron_mg) plus added_sugars_g, netcarb_g, polyols_g, magnesium_mg, phosphorus_mg, vitamin_c_mg, vitamin_d_iu and folate_dfe_ug. An unknown nutrient or malformed expression is a 400 rather than a silently ignored filter, and at most 10 ranges may be combined.

energy_kcal_minnumber

Shorthand for nutrient_ranges=energy_kcal:<min>... Ignored if nutrient_ranges already sets energy_kcal.

energy_kcal_maxnumber

Shorthand for nutrient_ranges=energy_kcal:..<max>.

protein_g_minnumber

Shorthand for nutrient_ranges=protein_g:<min>...

protein_g_maxnumber

Shorthand for nutrient_ranges=protein_g:..<max>.

Response

successful operation

search_idinteger
search_textstring required

Example response

{
  "results": [
    {
      "nutrient_overrides": {
        "aa_patient": {
          "ontology": {
            "id": 42,
            "levels": [
              "food"
            ]
          }
        },
        "bb_reviewer": {
          "ontology": {
            "id": 42,
            "levels": [
              "food"
            ]
          }
        },
        "cc_external": {
          "ontology": {
            "id": 42,
            "levels": [
              "food"
            ]
          }
        },
        "dd_estimate": {
          "ontology": {
            "id": 42,
            "levels": [
              "food"
            ]
          }
        },
        "ee_validation": {
          "ontology": {
            "id": 42,
            "levels": [
              "food"
            ]
          }
        }
      }
    }
  ]
}

Changes