TheCocktailDB API
Free cocktail recipe API with no signup: search drinks by name, ingredient or category, with instructions, measures, glass type and photos. Tested example.
Endpoint tested and returned HTTP 200 on 19 Aug 2026
What is the TheCocktailDB API?
TheCocktailDB is a free drink recipe API providing cocktails with instructions, measured ingredients, glass type, category and photos. The developer test key `1` works without registration.
TheCocktailDB is TheMealDB's sibling, built by the same team with an identical schema. It covers cocktails and mixed drinks with instructions, ingredient measures, the recommended glass and whether the drink is alcoholic.
The shared schema is genuinely convenient: if you have already written a parser for TheMealDB's numbered ingredient fields, the same code works here with only the field prefix changed from `strMeal` to `strDrink`.
Quick facts
- Base URL
https://www.thecocktaildb.com/api/json/v1/1- Authentication
- Test key `1` in the URL path works for everyone with no registration.
- Rate limit
- No published limit on the test key.
- Pricing
- Free with the test key; Patreon supporters get a production key.
- CORS
- Enabled — callable directly from browser JavaScript
- Official docs
- Read the docs
How to use the TheCocktailDB API
Every request below was executed against the live API on 19 Aug 2026, and the response shown is the real body it returned — not an illustration.
1. Search for a cocktail by name
GET https://www.thecocktaildb.com/api/json/v1/1/search.php?s=margarita
curl 'https://www.thecocktaildb.com/api/json/v1/1/search.php?s=margarita'const res = await fetch("https://www.thecocktaildb.com/api/json/v1/1/search.php?s=margarita");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);import requests
res = requests.get("https://www.thecocktaildb.com/api/json/v1/1/search.php?s=margarita", timeout=20)
res.raise_for_status()
print(res.json()){
"drinks": [
{
"idDrink": "11007",
"strDrink": "Margarita",
"strDrinkAlternate": null,
"strTags": "IBA,ContemporaryClassic",
"strVideo": null,
"strCategory": "Ordinary Drink",
"strIBA": "Contemporary Classics",
"strAlcoholic": "Alcoholic",
"strGlass": "Cocktail glass",
"strInstructions": "Rub the rim of the glass with the lime slice to make the salt stick to it. Take care to moisten only the outer rim and sprinkle the salt on it. The salt should present to the lips of the imbiber and never mix into the cocktail. Shake the other ingredients with ice, then carefully pour into the glass.",
"strInstructionsES": "Frota el borde del vaso con la rodaja de lima para que la sal se adhiera a él. Procure humedecer sólo el borde exterior y espolvorear la sal sobre él. La sal debe presentarse en los labios del imbibidor y nunca mezclarse en el cóctel. Agite los demás ingredientes con hielo y viértalos con cuidado en el vaso.",
"strInstructionsDE": "Reiben Sie den Rand des Glases mit der Limettenscheibe, damit das Salz daran haftet. Achten Sie darauf, dass nur der äußere Rand angefeuchtet wird und streuen Sie das Salz darauf. Das Salz sollte sich auf den Lippen des Genießers befinden und niemals in den Cocktail einmischen. Die anderen Zutaten mit Eis schütteln und vorsichtig in das Glas geben.",
"strInstructionsFR": "Frotter le bord du verre avec la tranche de citron vert pour faire adhérer le sel. Veillez à n'humidifier que le bord extérieur et à y saupoudrer le sel. Le sel doit se présenter aux lèvresParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
s | string | Optional | Search drinks by name on /search.php. margarita |
i | string | Optional | Filter by ingredient on /filter.php. gin |
c | string | Optional | Filter by category on /filter.php. Cocktail |
a | string | Optional | Filter by alcoholic or non-alcoholic. Non_Alcoholic |
Response fields
drinksarray|null- Array of drinks, or null when nothing matched.
drinks[].strDrinkstring- Drink name.
drinks[].strInstructionsstring- Mixing instructions.
drinks[].strDrinkThumbstring- Photo URL.
drinks[].strGlassstring- Recommended glassware.
drinks[].strAlcoholicstring- Alcoholic, Non alcoholic or Optional alcohol.
drinks[].strIngredient1-15string- Ingredients in numbered fields, with matching strMeasure values.
What you can build with the TheCocktailDB API
- Build a cocktail recipe browser or bartending app
- Suggest drinks based on ingredients the user already has
- Filter non-alcoholic options for a mocktail feature
- Add a random cocktail generator to a hospitality site
Common errors and how to fix them
drinks: null
No matches; null rather than an empty array.
Fix: Check for null before iterating.
Ingredient/measure mismatch
Some drinks list an ingredient with no measure.
Fix: Handle a missing measure gracefully rather than rendering 'null' or 'undefined' in the UI.
TheCocktailDB API — frequently asked questions
Is TheCocktailDB free?
Yes, the developer test key `1` is part of the URL and requires no registration. Patreon supporters get a production key with extra endpoints.
Can I search cocktails by ingredient?
Yes, use /filter.php?i=gin to find drinks containing an ingredient. This is the basis of the common 'what can I make with what I have' feature.
How do I find non-alcoholic drinks?
Use /filter.php?a=Non_Alcoholic. Each drink also carries a `strAlcoholic` field you can filter on client-side.
Does it use the same format as TheMealDB?
Yes, identical — including the numbered ingredient and measure fields. A parser written for one works on the other with only the field prefix changed.
Tools that pair with this API
JSON Formatter
Format, beautify and minify JSON online with 2-space, 4-space or tab indentation. Sort keys alphabetically and catch syntax errors instantly — free and private.
Unit Converter
Convert between units of length, weight, temperature, area, volume, speed, time and data storage instantly, with a swap button and common conversion tables.
Alternatives to TheCocktailDB API
If TheCocktailDB does not fit, these food & drink apis cover similar ground. Every one was called before publishing, and each links to its own reference page with a working curl command and the response it returned.
| API | What it does | Auth | CORS | Last verified |
|---|---|---|---|---|
| TheMealDB | Free recipe API with no signup: search meals by name, ingredient, category or area, with full instructions, ingredient lists and photos. Tested example. | No key | Yes | 19 Aug 2026 |
| Open Food Facts | Free food product API with no key: look up nutrition, ingredients, allergens, Nutri-Score and eco-score by barcode. 3M+ products. Tested curl example. | No key | Yes | 19 Aug 2026 |
| Fruityvice | Free fruit API with no key: nutritional data, family, genus and order for dozens of fruits. Simple flat JSON, ideal for beginners. Tested curl example. | No key | No | 19 Aug 2026 |
| Sample APIs Coffee | Free coffee API with no key: hot and iced coffee drinks with ingredients, descriptions and images. Small, clean dataset ideal for tutorials. Tested. | No key | Yes | 20 Aug 2026 |
| WhiskyHunter | Free WhiskyHunter API with no key: distillery information and whisky auction price statistics from international auction houses. Niche but tested and open. | No key | No | 20 Aug 2026 |
| BaconMockup | Free placeholder photo service with no key: put width and height in the path and get a real bacon photograph back at exactly that size. Tested example included. | No key | No | 21 Aug 2026 |
TheCocktailDB is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 19 Aug 2026; always check the official documentation before relying on this API in production, as terms and limits can change.