> ## Documentation Index
> Fetch the complete documentation index at: https://developer.lemlist.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> Learn how to authenticate with the lemlist API.

## HEADS-UP BASIC AUTH (NOT BEARER)

<span style={{ color: '#ff8080', fontWeight: 'bold' }}>We use BASIC authentication NOT bearer.</span>

Pay special attention to the following:

* [You must use HTTP **BASIC** authentication](#authenticate).
* The *login* (username) is **always empty**.
* The *password* is **your API key**.
* <span style={{ color: '#ff8080', fontWeight: 'bold' }}>THERE IS A COLON</span> before your API key.

Read on to learn:

* [how to grab your API key](#grab-your-api-key)
* [how to authenticate](#authenticate)

## Grab your API key

1. [head over to lemlist](https://app.lemlist.com)
2. click on your profile picture in the bottom left-hand corner and click on *Settings*
3. go to the *Integrations* tab
4. click on *Generate a new API key*
5. store it securely because **you won't be able to see it again**

<img src="https://mintlify.s3.us-west-1.amazonaws.com/lemlist/images/getting-started/authentication/generateLemlistAPIKey.gif" alt="Generating a new lemlist API key" />

> Of course, never - ever - share your API key. Treat it like a password.

## Authenticate

Basic authentication involves sending a verified username (**empty**, in our case) and password (your API key) with all requests.

But not just like that.

They must be **Base64 encoded** and passed in the Authorization header of all your requests.

Step by step, this is how to authenticate to our API:

1. you [get an API key](#grab-your-api-key)
2. you build the string `:YourApiKey` (YES, colon at the start)
3. you Base64 encode that `:YourApiKey` string ([this is how to base64-encode a string in Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/toBase64))
4. you pass the encoded result in the Authorization header of all requests with the prefix "Basic ".

In the end, a curl request to any `endpoint` in the API will look similar to this:

```curl theme={"theme":"dracula"}
curl --location 'https://api.lemlist.com/api/{endpoint}' \
--header 'Authorization: Basic {the base64-encoded stuff from step 3}'
```

***

[give us feedback on this page](https://lemlist.typeform.com/to/mfVlkyGf)
