> 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.

# Making your first API call

> Make your first API call and retrieve your lists, directly on this site or from your own computer.

The quickest way to check whether everything works is to retrieve your lists. This call does not change anything in your account and gives an immediate response. You can make this call right here on the site or from your own computer.

## Making a call via this site

#### Create an API key

Create a key in your account under ‘Connect’. A new key is only visible once, so save it straight away. See: [Create an API key](/hoe-kom-ik-aan-een-api-sleutel).

#### Open the endpoint

Go to [Retrieve all lists](/lijsten/alle-lijsten-opvragen).

#### Enter your key and send

Click ‘Try it’ on the right of the code example and enter your key under ‘api_key’. Then click send. You can read more about this field and button at [Trying out the API with Try it](/api-uitproberen).

#### Read the response

You will receive a `200` response containing all your lists in `data`. You will need the `list_id` shown there for almost every other call.

> **Warning**
>
> This makes a real API call. To find out how to test safely, see [Trying out the API with Try it](/api-uitproberen).

## Making a call from your own system

You can read how to send your key along at [Authentication with your API key](/api-authenticatie).

**`curl`**

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

With the PHP library, this is:

**`PHP`**

```php title="PHP"
$laposta = new Laposta('YOUR_API_KEY');
$lists = $laposta->listApi()->all();
```

A response looks like this, shortened to one list:

```json
{
  "data": [
    {
      "list": {
        "list_id": "BaImMu3JZA",
        "name": "Newsletter",
        "state": "active",
        "members": { "active": 1232, "unsubscribed": 113, "cleaned": 14 }
      }
    }
  ]
}
```

## Adding a subscriber

The next call you will probably need is adding a subscriber. In addition to the email address, the IP address is required, as this records where the registration came from.

**`curl`**

```bash title="curl"
curl https://api.laposta.nl/v2/member \
  -u YOUR_API_KEY: \
  -d list_id=BaImMu3JZA \
  -d ip=198.51.100.10 \
  -d email=new.subscriber@example.net \
  -d custom_fields[firstname]=Sarah
```

**`PHP`**

```php title="PHP"
$laposta->memberApi()->create('BaImMu3JZA', [
    'ip' => '198.51.100.10',
    'email' => 'new.subscriber@example.net',
    'custom_fields' => ['firstname' => 'Sarah'],
]);
```

The keys within `custom_fields` are the `custom_name` of your own fields. You can retrieve these once with [Retrieve all fields](/velden/alle-velden-opvragen) and store them in your own code.

## Related articles

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

#### [Trying out the API with Try it](/api-uitproberen)

Send a real call to the Laposta API from your browser, without installing anything.

#### [Synchronising subscribers through the API](/relaties-synchroniseren-via-de-api)

Keep your list in sync with your webshop or CRM: adding, updating, unsubscribing and…