TheCocktailDB API
Free cocktail and drink recipe database — the drinks sibling of TheMealDB.
What it does
TheCocktailDB is a free crowd-sourced cocktail and drink database from the makers of TheMealDB: drink name, category, glass, whether it is alcoholic, instructions in several languages, a photo, and up to 15 ingredient/measure pairs. Search, look up, randomise or filter.
Base URL
Authentication
The test key 1 in the URL path covers all core endpoints. A Patreon key unlocks extras (filter by multiple ingredients, popular and latest drinks, larger images).
Code examples
curl -s "https://www.thecocktaildb.com/api/json/v1/1/search.php?s=margarita" curl -s "https://www.thecocktaildb.com/api/json/v1/1/filter.php?i=Gin" curl -s "https://www.thecocktaildb.com/api/json/v1/1/random.php"
import requests
d = requests.get("https://www.thecocktaildb.com/api/json/v1/1/random.php",
timeout=10).json()["drinks"][0]
parts = [(d[f"strMeasure{i}"] or "", d[f"strIngredient{i}"])
for i in range(1, 16) if d[f"strIngredient{i}"]]
print(d["strDrink"], d["strGlass"])
for m, ing in parts:
print(" ", m.strip(), ing)Rate limits & quotas
No formal rate limit on the free key; cache results as a courtesy. Same 15-numbered-field ingredient shape as TheMealDB, and the same drinks: null convention for ‘no results’.
Key response fields
| drinks[] | Array of matches, or null when none |
| drinks[].strDrink / strCategory / strGlass | Name, type, serving glass |
| drinks[].strAlcoholic | Alcoholic, Non alcoholic or Optional alcohol |
| drinks[].strInstructions | Method (also strInstructionsDE, -ES, etc.) |
| drinks[].strIngredient1..15 / strMeasure1..15 | Ingredients and quantities |
Common errors
| drinks: null | No match — check before iterating. |
| (stub from filter.php) | Filter results carry only id/name/thumb; use lookup.php?i= for detail. |
| (missing measures) | Some ingredients have no strMeasure (‘to taste’) — handle empties. |
When to use it (and alternatives)
The go-to for cocktail apps, bar menus and drink randomisers. Pair with TheMealDB for a full food-and-drink experience. For alcohol-free filtering use filter.php?a=Non_Alcoholic.
FAQ
How do I list only non-alcoholic drinks?
filter.php?a=Non_Alcoholic (note the underscore). Then look up each id for the recipe.
Are instructions available in other languages?
Yes — strInstructionsDE, strInstructionsFR, strInstructionsES, strInstructionsIT and a few more, where contributors have translated them.
Can I filter by two ingredients at once?
Not with the free key — that needs a Patreon key. Otherwise, filter by one and intersect client-side.
New to APIs?
Short guides for working with this API — and any other.