API Reference
POST /suggest
Given items in a customer's cart and the restaurant's full menu, suggest complementary items to add. The API identifies missing categories (no drink yet, no side dish), matches cuisine affinity (Indian sides for Indian mains), and respects dietary preferences (all-veg carts only get veg suggestions).
Request
| Parameter | Type | Required | Description |
|---|---|---|---|
cart | string[] | Yes | Items currently in the cart. 1-50 items, max 500 chars each. |
menu | string[] | Yes | Available restaurant menu items. 1-500 items, max 500 chars each. |
top_k | int | No | Number of suggestions to return. Default: 5, max: 20. |
{
"cart": ["Chicken Biryani", "Butter Naan"],
"menu": ["Raita", "Masala Chai", "Gulab Jamun", "Paneer Tikka", "Coke", "Dal Fry"],
"top_k": 5
}
Response
| Field | Type | Description |
|---|---|---|
suggestions | object[] | Recommended items to add to cart |
cart_cuisine | string | Detected cuisine of the cart |
cart_dietary | string | Dietary status: veg, non_veg, mixed, or unknown |
cart_categories | string[] | Categories present in cart (main, beverage, bread, side, dessert) |
processing_time_ms | float | Processing time in milliseconds |
Each suggestion:
| Field | Type | Description |
|---|---|---|
item | string | Menu item text (original, not preprocessed) |
category | string | Item category: main, beverage, bread, side, or dessert |
reason | string | Why this item is suggested |
score | float | Relevance score 0-1 (higher = better complement) |
cuisine_match | bool | True if item's cuisine matches the cart's cuisine |
{
"suggestions": [
{"item": "Raita", "category": "side", "reason": "No side dish in cart", "score": 0.89, "cuisine_match": true},
{"item": "Masala Chai", "category": "beverage", "reason": "No beverage in cart", "score": 0.85, "cuisine_match": true},
{"item": "Gulab Jamun", "category": "dessert", "reason": "No dessert in cart", "score": 0.78, "cuisine_match": true}
],
"cart_cuisine": "North Indian",
"cart_dietary": "non_veg",
"cart_categories": ["main", "bread"],
"processing_time_ms": 142.3
}
Example
import requests
response = requests.post("https://embed.statode.com/suggest",
headers={"X-API-Key": "YOUR_KEY", "Content-Type": "application/json"},
json={
"cart": ["Chicken Biryani", "Butter Naan"],
"menu": restaurant_menu_items,
"top_k": 5
}
)
data = response.json()
print(f"Cart: {data['cart_cuisine']} ({data['cart_dietary']})")
print(f"Missing categories: needs {set(['main','beverage','bread','side','dessert']) - set(data['cart_categories'])}")
for suggestion in data["suggestions"]:
print(f" + {suggestion['item']} ({suggestion['category']}) - {suggestion['reason']}")
Cost
0.10 credits per menu item.
Notes
- The API prioritizes filling missing categories. If the cart has no beverage, a drink suggestion will rank highly.
- Dietary filtering is automatic: a fully vegetarian cart will never get non-veg suggestions.
- Cuisine matching ensures Indian mains get Indian sides (Raita, not Coleslaw).
- Items already in the cart are excluded from suggestions.
- Use this at checkout to increase average order value.