TheMealDB API
Free recipe database — meals, ingredients and categories, no key needed.
What it does
TheMealDB is a free, crowd-sourced database of meal recipes: name, category, cuisine area, step-by-step instructions, a photo, a YouTube link, and up to 20 ingredient/measure pairs. You can search by name, look up by id, get a random meal, or filter by category, area or ingredient.
Base URL
Authentication
The test API key 1 is baked into the URL path and works for all core endpoints. Supporting the project on Patreon gets you a personal key and a few extra endpoints (multi-ingredient filter, latest meals).
Code examples
curl -s "https://www.themealdb.com/api/json/v1/1/search.php?s=arrabiata" curl -s "https://www.themealdb.com/api/json/v1/1/filter.php?c=Seafood" curl -s "https://www.themealdb.com/api/json/v1/1/random.php"
import requests
meal = requests.get("https://www.themealdb.com/api/json/v1/1/random.php",
timeout=10).json()["meals"][0]
ings = [meal[f"strIngredient{i}"] for i in range(1, 21) if meal[f"strIngredient{i}"]]
print(meal["strMeal"], "-", ", ".join(ings))Rate limits & quotas
No formal rate limit on the free test key, but it is a small shared service — cache results. Note the awkward data shape: ingredients are 20 numbered fields (strIngredient1…strIngredient20) with matching strMeasure fields, mostly empty; you have to collapse them yourself.
Key response fields
| meals[] | Array of matches — null (not []) when nothing matched |
| meals[].strMeal / strCategory / strArea | Name, category, cuisine |
| meals[].strInstructions | Full method text |
| meals[].strMealThumb / strYoutube | Photo URL and video link |
| meals[].strIngredient1..20 / strMeasure1..20 | Ingredients and quantities |
Common errors
| meals: null | No results — check for null before iterating. |
| (filter vs search shape) | filter.php returns only id/name/thumb; call lookup.php?i= for full detail. |
| (rate limiting) | Sustained heavy use of the test key may be throttled — get a Patreon key. |
When to use it (and alternatives)
Great for recipe apps, ‘what’s for dinner’ randomisers and cooking tutorials. Its sibling TheCocktailDB does the same for drinks. For nutrition data and large-scale recipe search, Spoonacular or Edamam are richer (and paid past a small free tier).
FAQ
Why is meals null instead of an empty array?
TheMealDB returns {"meals": null} when a query matches nothing. Always check for null rather than assuming a list.
How do I get the full recipe after filtering?
filter.php (by category/area/ingredient) returns a stub with only idMeal, strMeal and strMealThumb. Take the id and call lookup.php?i={idMeal} for instructions and ingredients.
Can I search by multiple ingredients?
Only with a Patreon key. The free key’s filter.php?i= takes a single ingredient.
New to APIs?
Short guides for working with this API — and any other.