TL;DR
TheCocktailDB provides a free cocktail recipe database with over 600 drinks, searchable by name, ingredient, or category. Each recipe includes the drink name, category (Cocktail, Ordinary Drink, etc.), glass type, ingredients with measurements, and step-by-step instructions. A public test API key (1) is available for development. Perfect for building bartender apps, home mixology tools, or party planning utilities.
Quick start: https://www.thecocktaildb.com/api/json/v1/1/search.php?s=margarita
No API key needed — public test key available!
How to Use This API
1. Search Cocktails by Name
Search for margarita recipes:
https://www.thecocktaildb.com/api/json/v1/1/search.php?s=margarita
2. List by Ingredient
Find all drinks that use gin:
https://www.thecocktaildb.com/api/json/v1/1/filter.php?i=gin
3. Random Cocktail
https://www.thecocktaildb.com/api/json/v1/1/random.php
4. JavaScript — Get Random Drink
fetch('https://www.thecocktaildb.com/api/json/v1/1/random.php')
.then(r => r.json())
.then(data => {
const drink = data.drinks[0];
console.log(`Try a ${drink.strDrink} (${drink.strGlass})`);
console.log(`Instructions: ${drink.strInstructions}`);
});
5. Python — Search by Ingredient
import requests
resp = requests.get(
'https://www.thecocktaildb.com/api/json/v1/1/filter.php',
params={'i': 'vodka'}
).json()
for drink in resp['drinks']:
print(f"{drink['strDrink']} — {drink.get('strDrinkThumb', 'no image')}")
https://www.thecocktaildb.com/api/json/v1/1/search.php?s=margarita
Frequently Asked Questions
- What is the public test API key?
- The API uses the key
1in the URL path for development:/api/json/v1/1/. For production, you can register for a free key at TheCocktailDB website. - How many recipes are in the database?
- The database contains over 600 cocktail recipes, categorized as Cocktail, Ordinary Drink, Shake, Cocoa, Shot, Beer, and Punch/Party Drink.
- Can I search by multiple criteria?
- Yes. Endpoints include search by name (
search.php?s=), by first letter (search.php?f=), by ingredient (filter.php?i=), by category (filter.php?c=), and by glass type (filter.php?g=). - Does each recipe include images?
- Yes, most drinks have a thumbnail image at
strDrinkThumb. The URL pattern ishttps://www.thecocktaildb.com/images/media/drink/{id}/preview.png. - What format does the response use?
- All responses are JSON. The
drinksarray contains one or more drink objects, each with string fields for name, ingredients (strIngredient1-15), measures (strMeasure1-15), and instructions. - Is the data available in other languages?
- The main API returns English data. Some recipe names and instructions may be available in other languages on the main website, but the API primarily serves English content.
API Details
- API URL
https://www.thecocktaildb.com/api/json/v1/1/- Documentation
- www.thecocktaildb.com/api.php
- Category
- Food
- Authentication
- Public test key available (no signup required)
- Geographic Coverage
- Global — cocktail recipes from around the world
What You Can Build
- Home bartender app that suggests cocktails based on available ingredients
- Party planning tool that generates a drink menu with recipes and required spirits
- Bartender training quiz that tests knowledge of cocktail ingredients
- Social drink-sharing platform where users save and rate their favorite cocktails
- Ingredient substitution finder — find recipes that use a specific spirit