Core API

Ingredient substitutions

Out of an ingredient? Dishora returns safe, sensible swaps that respect the active dietary profile and allergies. A vegan never gets eggs, and someone with a nut allergy never gets almond milk.

Endpoints

GET/v1/substitutionsRule-engine lookup (with AI-fallback flag)
POST/v1/substitutionsSave an AI-generated substitution

Look up substitutions

GET /v1/substitutions

Pass the ingredient and the user’s dietary flags as query parameters. The rule engine returns known safe swaps and tells you whether an AI fallback is recommended. The result is cached server-side for 24 hours.

curl https://api.dishora.app/api/v1/substitutions \
  -H "Authorization: Bearer $DISHORA_API_KEY"   -G --data-urlencode "ingredient=eggs"      --data-urlencode "diet[]=vegan"      --data-urlencode "allergies[]=nuts"

When has_rule_engine_match is false, no cached rule exists. Call the AI service at POST /api/v1/suggest-substitute to generate one, then persist it back with the endpoint below.

Save a substitution

POST /v1/substitutions

Stores an AI-generated substitution so future lookups hit the rule engine instead of the AI. This invalidates the cache for that ingredient. Returns 201 Created.

{
  "original_ingredient": "eggs",
  "substitute_ingredient": "flax egg (1 tbsp flax + 3 tbsp water)",
  "diet_type": "vegan",
  "allergen": null,
  "ratio": "1:1",
  "ratio_unit": "per egg",
  "notes": "best for binding in baking"
}