TheCocktailDB API

Beginner's Pick Food & Drink / API Key Intermediate HTTPS CORS
78 B
Measured Score 0 50 100 Speed 15/30 Consistency 20/20 Security 20/20 Browser access 15/15 Transparency 8/15 TESTED 2026-08-10

Overview

TheCocktailDB is a free cocktail recipe database with thousands of drinks from around the world. You can search by ingredient, name, or category to find the perfect cocktail. The free tier uses test API key '1' and covers most use cases for learning.

Beginner Tip

Use the free test API key '1' to get started immediately—no registration required. Search by ingredient with ?i=vodka to find all cocktails that use that ingredient.

Measurement Record

What actually happened when we called this API from our own infrastructure. Every value below was recorded by the request, not copied from the provider's documentation.

Request
GET https://www.thecocktaildb.com/api/json/v1/1/search.php?s=margarita
Result
HTTP 200 · application/json · 17,762 bytes · compressed
Response time
262 ms (median of 3) · fastest 258 ms
Transport
TLSv1.3 · TLS_AES_256_GCM_SHA384 · certificate issued by Google Trust Services
Browser CORS
Allowed — Access-Control-Allow-Origin: *
Served by
cloudflare
Recorded
2026-08-10

Fields Returned

Top-level fields present in the response we captured, with the type and value we actually received.

Field Type Value received
drinks array [1 item]

Captured Response

Captured from a real request to https://www.thecocktaildb.com/api/json/v1/1/search.php?s=margarita on 2026-08-10. Long arrays and nested objects are truncated to keep the shape readable.

JSON Response · Captured
{
  "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 shou…",
      "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…",
      "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 streue…",
      "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 …",
      "strInstructionsIT": "Strofina il bordo del bicchiere con la fetta di lime per far aderire il sale.\r\nAvere cura di inumidire solo il bordo esterno e cospargere di sale.\r\nIl sale d…",
      "…": "(37 more fields)"
    }
  ]
}

Field Reference

idDrink Unique identifier for the cocktail
strDrink Name of the cocktail
strCategory Cocktail category such as Ordinary Drink or Cocktail
strInstructions Step-by-step preparation instructions

Implementation Example

Calls a real endpoint of this API. Replace any placeholder credentials with your own key.

Request
const url = "https://www.thecocktaildb.com/";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

Generated guidance based on this API's documentation, not observed by us. Treat it as a starting point and check against the provider's own error reference.

401 Unauthorized Missing or invalid API key in the URL path
Use '1' as the API key for free access: /api/json/v1/1/search.php
Empty drinks array (null) No cocktail matched the search term
Check the spelling of the cocktail name or try a partial name like 'mar' instead of 'margarita'
CORS error in browser Some browsers block HTTP requests from HTTPS pages
Use HTTPS endpoints (www.thecocktaildb.com) or make requests from a backend server

Measured Score Breakdown

Live HTTP request to the API endpoint

Speed 15/30
Consistency 20/20
Security 20/20
Browser access 15/15
Transparency 8/15
Endpoint Response Time 262ms

Fully tested on Aug 10, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS YES
Category Food & Drink
Difficulty Intermediate
Endpoint last called: 2026-08-10

Related Tags

Similar APIs

View All →