Lookup Endpoints
The Cocktail API uses token-based authentication. You'll need to authenticate your requests to access any of the endpoints in the Cocktail API API. In this guide, we'll look at how authentication works. To authenticate your requests, include your token in the Authorization header of your HTTP requests as follows: Cocktail API offers two ways to authenticate your API requests:
Token authentication
Obtain a Token
Before making authenticated requests, you need to obtain a token. Typically, this involves logging in with your credentials and receiving a token in the response. For example, you might have an endpoint for obtaining tokens:
Endpoint: /api/token/
Method: POST
Request Body
Example request with token auth
{
"username": "your_username",
"password": "your_password"
}
Response:
Example request with token auth
{
"token": "your_jwt_or_auth_token_here"
}
Please don't commit your Cocktail password to GitHub!
OAuth2 with bearer token
The recommended way to authenticate with the Cocktail API API is by using OAuth2. When establishing a connection using OAuth2, you will need your access token — you will find it in the Cocktail API dashboard under API settings. Here's how to add the token to the request header using cURL:
Endpoint: /api/token/
Method: POST
Request Body
Example request with token auth
{
"username": "your_username",
"password": "your_password"
}
Response:
Example request with token auth
{
"token": "your_jwt_or_auth_token_here"
}
Always keep your token safe and reset it if you suspect it has been compromised.
Using an SDK
SDK support will be comming soon