> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.laposta.org/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.laposta.org/_mcp/server.

# How does authentication with your API key work?

> The API uses basic auth, with your key as the username and an empty password.

You need an API key for every call over https. The key determines which account you are working on: there is no separate username and no token that expires.

## Sending your key

Authentication uses basic auth. You enter your key as the username and leave the password blank. In curl, place a colon after the key, otherwise curl will still ask for a password.

To see how this works with the ‘Try it’ button in this documentation, read [Trying out the API with Try it](/api-uitproberen).

```bash
curl https://api.laposta.nl/v2/list \
  -u YOUR_API_KEY:
```

If you do not send a valid key, the API returns a `401` error message:

```json
{
  "error": {
    "type": "invalid_request",
    "message": "No valid API-key provided"
  }
}
```

## Creating a key

You can create keys in your account under ‘Connect’. To find out how to do this, what you can still see of a key afterwards and how many keys you can create, read [Create an API key](/hoe-kom-ik-aan-een-api-sleutel).

## Keeping your key safe

A key grants access to all data in the account, so treat it like a password.

> **Warning**
>
> Never put your key in code that runs in the browser, nor in a public repository. Anyone who has it can read your subscribers and send campaigns.

Instead, use an environment variable or the secrets storage of your hosting provider, and run the calls from your own server. If you want to test something, use a separate list in your own account. Make sure to do this for endpoints that create or delete data. Creating a separate free test account is usually not possible: see [One free account per organisation](/er-is-al-een-gratis-account-voor-je-organisatie).

## Related articles

#### [Creating an API key](/hoe-kom-ik-aan-een-api-sleutel)

You can create and manage your API keys on the Connect page. Please note: a new key can…

#### [Making your first API call](/je-eerste-api-aanroep)

Make your first API call and retrieve your lists, directly on this site or from your…

#### [What are the limits and error messages of the API?](/api-limieten-en-foutmeldingen)

How many requests per minute the API allows and which status and error codes may be…