The Cocktail API allows you to search thousands of cocktail recipes by name or ingredients.
https://api.api-ninjas.com/v1/cocktail
Returns up to 10 cocktail recipes matching the search parameters.
At least one of the following parameters must be present:
name
optionalName of cocktail. This parameter supports partial matches (e.g. bloody
will match bloody mary
and bloody margarita
).
ingredients
optionalComma-separated string of ingredients to search. Only cocktails containing all listed ingredients will be returned. For example, to search cocktails containing Vodka and lemon juice, use vodka,lemon juice
.
X-Api-Key
requiredAPI Key associated with your account.
https://api.api-ninjas.com/v1/cocktail?name=bloody mary
Headers
X-Api-Key
Log in or sign up to get your API Key
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[
{
"ingredients": [
"4.5 cl (3 parts) vodka",
"9 cl (6 parts) Tomato juice",
"1.5 cl (1 part) Lemon juice",
"2 to 3 dashes of Worcestershire Sauce",
"Tabasco sauce",
"Celery salt",
"Black pepper"
],
"instructions": "Stirring gently, pour all ingredients into highball glass. Garnish.",
"name": "bloody mary"
}
]
1
2
3
4
5
6
7
8
9
import requests
name = 'bloody mary'
api_url = 'https://api.api-ninjas.com/v1/cocktail?name={}'.format(name)
response = requests.get(api_url, headers={'X-Api-Key': 'YOUR_API_KEY'})
if response.status_code == requests.codes.ok:
print(response.text)
else:
print("Error:", response.status_code, response.text)
If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.