Foods

Function-calling namespace: foods

  • Base URL: https://api.aivida.in
  • Engine endpoint: POST /api
  • Auth: Stack token middleware enabled in optional mode.
  • Send token in header: x-stack-access-token: <access_token> (or Authorization: Bearer <access_token>).
  • In optional mode: no token is allowed; invalid token is rejected with 401.

analyze

Source: backend/endpoints/foods/analyze

Input Fields

FieldTypeRequiredConstraints
image_urlstringNo-
image_base64stringNo-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "foods",
  "apiName": "analyze",
  "data": {
    "image_url": "value",
    "image_base64": "value"
  }
}'

Example Response

{ "status": "ok", "data": {} }

bulk

Source: backend/endpoints/foods/bulk

Input Fields

FieldTypeRequiredConstraints
itemsarray<object>Yesmin: 1; max: 1000; dive

Nested Field Structures

items item

FieldTypeRequiredConstraints
namestringYes-
categorystringNo-
caloriesintegerNo-
proteinnumberNo-
carbsnumberNo-
fatnumberNounix-ms timestamp
fibernumberNo-
serving_sizestringNo-
ingredientsarray<string>No-
image_urlstringNo-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "foods",
  "apiName": "bulk",
  "data": {
    "items": [
      {
        "name": "value",
        "category": "value",
        "calories": 1,
        "protein": 1,
        "carbs": 1,
        "fat": 1710201600000,
        "fiber": 1,
        "serving_size": "value",
        "ingredients": [
          "value"
        ],
        "image_url": "value"
      }
    ]
  }
}'

Example Response

{ "status": "ok", "data": {} }

create

Source: backend/endpoints/foods/create

Input Fields

FieldTypeRequiredConstraints
namestringYes-
foodCodestringNo-
categoryIdstringNo-
categorystringNo-
descriptionstringNo-
caloriesintegerNo-
proteinnumberNo-
carbsnumberNo-
fatnumberNounix-ms timestamp
fibernumberNo-
sugarnumberNo-
sodiumnumberNo-
cholesterolnumberNo-
serving_sizestringNo-
ingredientsarray<string>No-
image_urlstringNo-
imageUrlstringNo-
nutritionPer100gobjectNonullable
servingsarray<object>No-

Nested Field Structures

nutritionPer100g

FieldTypeRequiredConstraints
caloriesintegerNo-
proteinnumberNo-
carbsnumberNo-
fatnumberNounix-ms timestamp
fibernumberNo-
sugarnumberNo-
sodiumnumberNo-
cholesterolnumberNo-
nutritionBaseWeightnumberNo-

servings item

FieldTypeRequiredConstraints
idstringNo-
servingNamestringNo-
weightInGramsnumberNo-
displayOrderintegerNo-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "foods",
  "apiName": "create",
  "data": {
    "name": "value"
  }
}'

Example Response

{ "status": "ok", "data": {} }

delete

Source: backend/endpoints/foods/delete

Input Fields

FieldTypeRequiredConstraints
idstringYes-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "foods",
  "apiName": "delete",
  "data": {
    "id": "id_123"
  }
}'

Example Response

{ "status": "ok", "data": {} }

get

Source: backend/endpoints/foods/get

Input Fields

FieldTypeRequiredConstraints
idstringYes-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "foods",
  "apiName": "get",
  "data": {
    "id": "id_123"
  }
}'

Example Response

{ "status": "ok", "data": {} }

list

Source: backend/endpoints/foods/list

Input Fields

FieldTypeRequiredConstraints
categoryIdstringNo-
cursorstringNo-
pageintegerNo-
page_sizeintegerNo-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "foods",
  "apiName": "list",
  "data": {
    "categoryId": "category_123",
    "cursor": "value",
    "page": 1,
    "page_size": 1
  }
}'

Example Response

{ "status": "ok", "data": {} }

Source: backend/endpoints/foods/search

Input Fields

FieldTypeRequiredConstraints
querystringNo-
categorystringNo-
min_caloriesintegerNo-
max_caloriesintegerNo-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "foods",
  "apiName": "search",
  "data": {
    "query": "value",
    "category": "value",
    "min_calories": 1,
    "max_calories": 1
  }
}'

Example Response

{ "status": "ok", "data": {} }

update

Source: backend/endpoints/foods/update

Input Fields

FieldTypeRequiredConstraints
idstringYes-
namestringNonullable
foodCodestringNonullable
categoryIdstringNonullable
categorystringNonullable
descriptionstringNonullable
caloriesintegerNonullable
proteinnumberNonullable
carbsnumberNonullable
fatnumberNounix-ms timestamp; nullable
fibernumberNonullable
sugarnumberNonullable
sodiumnumberNonullable
cholesterolnumberNonullable
serving_sizestringNonullable
ingredientsarray<string>Nonullable
image_urlstringNonullable
imageUrlstringNonullable
nutritionPer100gobjectNonullable
servingsarray<object>Nonullable
isActivebooleanNonullable

Nested Field Structures

nutritionPer100g

FieldTypeRequiredConstraints
caloriesintegerNo-
proteinnumberNo-
carbsnumberNo-
fatnumberNounix-ms timestamp
fibernumberNo-
sugarnumberNo-
sodiumnumberNo-
cholesterolnumberNo-
nutritionBaseWeightnumberNo-

servings item

FieldTypeRequiredConstraints
idstringNo-
servingNamestringNo-
weightInGramsnumberNo-
displayOrderintegerNo-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "foods",
  "apiName": "update",
  "data": {
    "id": "id_123"
  }
}'

Example Response

{ "status": "ok", "data": {} }