TL;DR
TheMealDB provides a searchable database of thousands of recipes from cuisines around the world. Search by main ingredient, meal name, category (dessert, seafood, vegetarian, etc.), area (Canadian, Italian, Japanese, etc.), or get random meal ideas. Each recipe includes ingredients with measurements, step-by-step instructions, source URL, and meal thumbnail. Uses a free API key (the key 1 is the public test key).
Quick start: https://www.themealdb.com/api/json/v1/1/random.php
Free to use with test key "1"!
How to Use This API
1. Get a Random Meal
Returns a random recipe from the database:
https://www.themealdb.com/api/json/v1/1/random.php
2. Search by Name
https://www.themealdb.com/api/json/v1/1/search.php?s=chicken
3. Search by Main Ingredient
https://www.themealdb.com/api/json/v1/1/filter.php?i=salmon
4. JavaScript — Random Meal Generator
fetch('https://www.themealdb.com/api/json/v1/1/random.php')
.then(r => r.json())
.then(data => {
const meal = data.meals[0];
console.log(`🍽 ${meal.strMeal} (${meal.strArea})`);
console.log(`Category: ${meal.strCategory}`);
console.log(`Tags: ${meal.strTags || 'none'}`);
console.log(`\nIngredients:`);
for (let i = 1; i <= 20; i++) {
const ing = meal[`strIngredient${i}`];
const measure = meal[`strMeasure${i}`];
if (ing && ing.trim()) console.log(` • ${measure} ${ing}`);
}
console.log(`\nImage: ${meal.strMealThumb}`);
console.log(`Source: ${meal.strSource || 'N/A'}`);
});
5. Python — Find Recipes with Common Ingredients
import requests
# Find recipes using chicken and rice
chicken = requests.get(
'https://www.themealdb.com/api/json/v1/1/filter.php',
params={'i': 'chicken'}
).json()
rice = requests.get(
'https://www.themealdb.com/api/json/v1/1/filter.php',
params={'i': 'rice'}
).json()
chicken_ids = {m['idMeal'] for m in chicken['meals']}
rice_ids = {m['idMeal'] for m in rice['meals']}
both = chicken_ids & rice_ids
print(f"Recipes with both chicken and rice: {len(both)}")
for meal_id in list(both)[:5]:
detail = requests.get(
f'https://www.themealdb.com/api/json/v1/1/lookup.php?i={meal_id}'
).json()
meal = detail['meals'][0]
print(f" • {meal['strMeal']} ({meal['strArea']})")
6. List All Categories
https://www.themealdb.com/api/json/v1/1/categories.php
Random meal:
https://www.themealdb.com/api/json/v1/1/random.php
Frequently Asked Questions
- Do I need an API key?
- The public test API key is
1(use asv1/1/in the URL). This key is rate-limited. For production applications, register for a free API key at themealdb.com. - What search endpoints are available?
search.php?s=(by name),search.php?f=(by first letter),lookup.php?i=(by meal ID),filter.php?i=(by ingredient),filter.php?c=(by category),filter.php?a=(by area).- What data is included for each meal?
- Meal name, category, area (cuisine), instructions, meal thumbnail, tags, YouTube video URL, ingredients (1-20) with measurements, source URL, and date modified.
- How many recipes are in the database?
- Hundreds of recipes across dozens of categories and areas (cuisines). The database is community-contributed and grows regularly with new submissions.
- What areas/cuisines are available?
- Canadian, Italian, Japanese, Chinese, Indian, French, Mexican, American, British, Egyptian, Greek, Irish, Jamaican, Malaysian, Moroccan, Polish, Portuguese, Russian, Spanish, Thai, Tunisian, Turkish, and Vietnamese, among others.
- Are the ingredients standardized?
- Ingredients use common names and measurements are in both metric and imperial. The
strIngredientandstrMeasurepairs (1-20) provide structured recipe data for each meal.
API Details
- API URL
https://www.themealdb.com/api/json/v1/1/- Documentation
- themealdb.com/api.php
- Category
- Food
- Authentication
- Test key:
1(register for production key) - Geographic Coverage
- Global cuisines — 25+ area categories
What You Can Build
- Recipe discovery app with random meal suggestions
- Meal planner that finds recipes by available ingredients
- International cooking guide exploring cuisines by area
- Dietary preference filter by category and ingredient
- Cooking timer app with step-by-step recipe instructions