> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.laposta.org/llms.txt.

# Creating API keys in the management environment

> Manage all accounts in your management environment via the API with a single partner key and set the permissions for each key.

With an API key in your [management environment](/wat-is-een-beheeromgeving) (a partner key), you can manage all your accounts via the API using a single key. You set the permissions for each key yourself. If you are looking for a key for a single individual account, please read [Creating an API key](/hoe-kom-ik-aan-een-api-sleutel).

> **Info**
>
> API keys in the management environment are not enabled by default. Please contact the helpdesk to request access. Only administrators of the management environment can see the ‘API keys’ section.

## Creating a new API key

You can create a maximum of 10 keys per management environment.

#### Open the API keys

In the management environment, go to Settings → API keys and click ‘New API key’.

#### Enter a name and description

Under ‘Name’, enter a name. Under ‘Description’, you can enter additional remarks.

#### Choose the permissions

Under ‘Permissions’, tick which API calls the key is allowed to make. Nothing is ticked by default; without any ticks, the key cannot do anything yet.

#### Confirm and save

Enter your password and click ‘Save’. If you log in with [Single Sign-On (SSO)](/single-sign-on-sso), you do not need to enter a password.

#### Copy the key

After saving, the ‘API key created’ screen appears and you will see the full key once. Click ‘Copy the key’ and store it in a safe place. After that, you will only see the first four characters in the overview.

> **Warning**
>
> If you lose a key, you will not be able to view it again. In that case, create a new key and delete the old one.

## Which permissions can you grant to a key?

A key can only make the API calls for which the permission is ticked. The permissions are divided into groups, such as subscribers, campaigns, and automations. The ‘Partner keys only’ group includes the permission to retrieve the partner's accounts.

If your integration makes a call for which the permission is not enabled, the API will return a `403` error message containing the missing permission. Some calls never work with a partner key, such as editing the account settings.

## Editing, blocking, or deleting a key

In the overview, click ‘Details’ next to a key to edit it:

* Edit the name, description, or permissions and click ‘Save’.
* Tick ‘Block this key’ and click ‘Save’ to temporarily disable the key. The key will stop working until you remove the tick.
* Click ‘Delete’ to permanently remove the key. Once you confirm, integrations that use this key will no longer work.

## Using the key in the API

When using [authentication with HTTP Basic Auth](/api-authenticatie), you send the partner key as the username and the `account_id` of the account as the password:

#### cURL

```bash
curl -u KEY:ACCOUNT_ID https://api.laposta.nl/v2/list
```

If you want to retrieve an overview of your accounts and their `account_id`, call the endpoint for partner accounts with an empty password (`-u KEY:`). For this, your key does need the permission to retrieve the partner's accounts:

#### cURL

```bash
curl -u KEY: https://api.laposta.nl/v2/partner/accounts
```

If the API returns a `401` error message, the `account_id` is missing, the `account_id` is incorrect, the account belongs to another partner, or the key or partner is blocked.

## 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…

#### [How does authentication with your API key work?](/api-authenticatie)

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

#### [What is a management environment for departments and brands?](/wat-is-een-beheeromgeving)

With a free management environment, you centrally manage multiple Laposta accounts for…

#### [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…