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

ParameterTypeRequiredDescription
cartstring[]YesItems currently in the cart. 1-50 items, max 500 chars each.
menustring[]YesAvailable restaurant menu items. 1-500 items, max 500 chars each.
top_kintNoNumber 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

FieldTypeDescription
suggestionsobject[]Recommended items to add to cart
cart_cuisinestringDetected cuisine of the cart
cart_dietarystringDietary status: veg, non_veg, mixed, or unknown
cart_categoriesstring[]Categories present in cart (main, beverage, bread, side, dessert)
processing_time_msfloatProcessing time in milliseconds

Each suggestion:

FieldTypeDescription
itemstringMenu item text (original, not preprocessed)
categorystringItem category: main, beverage, bread, side, or dessert
reasonstringWhy this item is suggested
scorefloatRelevance score 0-1 (higher = better complement)
cuisine_matchboolTrue 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.