Foods
Function-calling namespace: foods
- Base URL:
https://api.aivida.in - Engine endpoint:
POST /api - Auth: Stack token middleware enabled in
optionalmode. - Send token in header:
x-stack-access-token: <access_token>(orAuthorization: Bearer <access_token>). - In
optionalmode: no token is allowed; invalid token is rejected with401.
analyze
Source: backend/endpoints/foods/analyze
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
image_url | string | No | - |
image_base64 | string | No | - |
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
| Field | Type | Required | Constraints |
|---|---|---|---|
items | array<object> | Yes | min: 1; max: 1000; dive |
Nested Field Structures
items item
| Field | Type | Required | Constraints |
|---|---|---|---|
name | string | Yes | - |
category | string | No | - |
calories | integer | No | - |
protein | number | No | - |
carbs | number | No | - |
fat | number | No | unix-ms timestamp |
fiber | number | No | - |
serving_size | string | No | - |
ingredients | array<string> | No | - |
image_url | string | No | - |
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
| Field | Type | Required | Constraints |
|---|---|---|---|
name | string | Yes | - |
foodCode | string | No | - |
categoryId | string | No | - |
category | string | No | - |
description | string | No | - |
calories | integer | No | - |
protein | number | No | - |
carbs | number | No | - |
fat | number | No | unix-ms timestamp |
fiber | number | No | - |
sugar | number | No | - |
sodium | number | No | - |
cholesterol | number | No | - |
serving_size | string | No | - |
ingredients | array<string> | No | - |
image_url | string | No | - |
imageUrl | string | No | - |
nutritionPer100g | object | No | nullable |
servings | array<object> | No | - |
Nested Field Structures
nutritionPer100g
| Field | Type | Required | Constraints |
|---|---|---|---|
calories | integer | No | - |
protein | number | No | - |
carbs | number | No | - |
fat | number | No | unix-ms timestamp |
fiber | number | No | - |
sugar | number | No | - |
sodium | number | No | - |
cholesterol | number | No | - |
nutritionBaseWeight | number | No | - |
servings item
| Field | Type | Required | Constraints |
|---|---|---|---|
id | string | No | - |
servingName | string | No | - |
weightInGrams | number | No | - |
displayOrder | integer | No | - |
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
| Field | Type | Required | Constraints |
|---|---|---|---|
id | string | Yes | - |
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
| Field | Type | Required | Constraints |
|---|---|---|---|
id | string | Yes | - |
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
| Field | Type | Required | Constraints |
|---|---|---|---|
categoryId | string | No | - |
cursor | string | No | - |
page | integer | No | - |
page_size | integer | No | - |
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": {} }search
Source: backend/endpoints/foods/search
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
query | string | No | - |
category | string | No | - |
min_calories | integer | No | - |
max_calories | integer | No | - |
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
| Field | Type | Required | Constraints |
|---|---|---|---|
id | string | Yes | - |
name | string | No | nullable |
foodCode | string | No | nullable |
categoryId | string | No | nullable |
category | string | No | nullable |
description | string | No | nullable |
calories | integer | No | nullable |
protein | number | No | nullable |
carbs | number | No | nullable |
fat | number | No | unix-ms timestamp; nullable |
fiber | number | No | nullable |
sugar | number | No | nullable |
sodium | number | No | nullable |
cholesterol | number | No | nullable |
serving_size | string | No | nullable |
ingredients | array<string> | No | nullable |
image_url | string | No | nullable |
imageUrl | string | No | nullable |
nutritionPer100g | object | No | nullable |
servings | array<object> | No | nullable |
isActive | boolean | No | nullable |
Nested Field Structures
nutritionPer100g
| Field | Type | Required | Constraints |
|---|---|---|---|
calories | integer | No | - |
protein | number | No | - |
carbs | number | No | - |
fat | number | No | unix-ms timestamp |
fiber | number | No | - |
sugar | number | No | - |
sodium | number | No | - |
cholesterol | number | No | - |
nutritionBaseWeight | number | No | - |
servings item
| Field | Type | Required | Constraints |
|---|---|---|---|
id | string | No | - |
servingName | string | No | - |
weightInGrams | number | No | - |
displayOrder | integer | No | - |
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": {} }