Get up and running with the PizzaStack API in minutes! This guide walks you through making your first virtual pizza using HTTP requests.
import requests
API_BASE = "https://api.tomatopy.pizza/v1"
HEADERS = {
"Content-Type": "application/json",
"X-API-Key": "your-api-key",
"X-Session-ID": "your-session-id"
}
# Acquire a fresh tomato
response = requests.post(f"{API_BASE}/tomato/acquire", headers=HEADERS, json={
"variety": "San Marzano",
"ripeness": 0.8,
"weight": 150
})
tomato = response.json()
print(tomato["id"]) # "tom_abc123"
print(tomato["variety"]) # "San Marzano"
print(tomato["ripeness"]) # 0.8# Slice the tomato
response = requests.post(f"{API_BASE}/tomato/slice", headers=HEADERS, json={
"tomato_ids": [tomato["id"]],
"method": "dice",
"size": "medium",
"consistency": "uniform"
})
sliced = response.json()# Simmer sliced tomatoes into a sauce
response = requests.post(f"{API_BASE}/cook/simmer", headers=HEADERS, json={
"ingredients": [
{"id": sliced["id"], "name": "tomato", "amount": 150, "unit": "g"}
],
"temperature": 100,
"duration": "30m"
})
sauce = response.json()
print(sauce["consistency"]) # "smooth"# Create the pizza base
response = requests.post(f"{API_BASE}/pizza/base", headers=HEADERS, json={
"thickness": "medium",
"size": "12inch",
"style": "neapolitan",
"hydration": 0.65
})
base = response.json()# Assemble the pizza
response = requests.post(f"{API_BASE}/pizza/assemble", headers=HEADERS, json={
"base_id": base["id"],
"sauce_id": sauce["id"],
"toppings": [
{"name": "mozzarella", "amount": 200, "unit": "g"},
{"name": "basil", "amount": 10, "unit": "leaves"}
]
})
pizza = response.json()# Bake the assembled pizza
response = requests.post(f"{API_BASE}/pizza/bake", headers=HEADERS, json={
"pizza_id": pizza["id"],
"temperature": 450,
"duration": "2m"
})
baked = response.json()
print(baked["quality_score"]) # 0.92# Analyze the final product
response = requests.post(f"{API_BASE}/taste/analyze", headers=HEADERS, json={
"dish_id": baked["id"],
"depth": "comprehensive",
"include_aroma": True,
"include_texture": True
})
profile = response.json()
print(profile["acidity"]) # 0.7
print(profile["sweetness"]) # 0.3
print(profile["umami"]) # 0.8curl -H "X-API-Key: your-api-key" \
https://api.tomatopy.pizza/v1/session/your-session-id/log