Food

Ingredient Search

0calls
1 credits / call

Enter a food keyword (e.g. "白菜") and get a list of matching ingredients. Each item includes the ingredient code, calories per 100g, health light rating and a thumbnail.

GET
uapis.cn
/api/v1/food/ingredient
Query parameters
2
keyword
string
required

Food keyword, up to 64 characters.

page
integer

Page number, 1-100. Defaults to 1.

What you get

  • Ingredient code (code): unique identifier you can pass to the detail endpoint.
  • Calories (calory): kcal per 100g.
  • Health light (health_light): 1 = green (recommended), 2 = yellow (moderate), 3 = red (limit).

Notes

Results are sorted by relevance; the first page usually contains what you need. Returns 404 when nothing matches.

Query parameters

keyword
stringrequired

Food keyword, up to 64 characters.

page
integeroptional

Page number, 1-100. Defaults to 1.

Response

200 / OK

Search succeeded. Returns matching ingredients.

JSON
{
  "keyword": "白菜",
  "count": 10,
  "total_pages": 2,
  "items": [
    {
      // Ingredient code for the detail endpoint
      "code": "xiaobaicai",
      "name": "小白菜",
      // kcal per 100g
      "calory": "14",
      // Weight basis for calories
      "weight": "100",
      // 1 green / 2 yellow / 3 red
      "health_light": 1,
      "thumb_image_url": "string",
      // Carbs per 100g
      "carbohydrate": 2.4
    }
  ]
}

400 / Bad Request

Invalid parameters, e.g. missing or over-length keyword.

JSON
{
  "code": "INVALID_PARAMETER",
  "message": "keyword 不能为空"
}

404 / Not Found

No matching ingredient found.

JSON
{
  "code": "NO_MATCH",
  "message": "没有找到相关结果: xxx"
}

502 / Bad Gateway

Data service temporarily unavailable. Retry later.

JSON
{
  "code": "SERVICE_UNAVAILABLE",
  "message": "查询服务暂时不可用,请稍后重试"
}