# Blacklist

> Add an email address, a whole domain or a LinkedIn profile to the Emelia blacklist by API, so that no campaign of your account ever contacts them.

Source: https://docs.emelia.io/docs/blacklist

The blacklist applies to your whole account: a blacklisted address is skipped by every campaign, current and future, before each email and each LinkedIn action. Use it for people who ask not to be contacted again, competitors and your customers.

The routes start with `/emails/` for historical reasons, but they apply to every campaign, multichannel and legacy.

## Add an address or a domain

[`POST /emails/blacklists/contact`](https://docs.emelia.io/docs/blacklist/blacklist-email-or-domain.md)

**curl**

```bash
curl -X POST https://api.emelia.io/emails/blacklists/contact \
  -H "Authorization: $EMELIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email": "claire.fontaine@nexora.io"}'
```

**JavaScript**

```js
await fetch('https://api.emelia.io/emails/blacklists/contact', {
  method: 'POST',
  headers: { Authorization: process.env.EMELIA_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({ email: 'claire.fontaine@nexora.io' }),
});
```

**Python**

```python
import os
import requests

requests.post(
    "https://api.emelia.io/emails/blacklists/contact",
    headers={"Authorization": os.environ["EMELIA_API_KEY"]},
    json={"email": "claire.fontaine@nexora.io"},
)
```

The `email` field also takes a bare domain, `nexora.io`, which blacklists everyone at that company. Think twice before doing it: it is account wide.

To remove an entry, send the same body to [Remove an email or domain](https://docs.emelia.io/docs/blacklist/remove-email-or-domain.md):

[`DELETE /emails/blacklists/contact`](https://docs.emelia.io/docs/blacklist/remove-email-or-domain.md)

## LinkedIn profiles

[`POST /emails/blacklists/linkedin`](https://docs.emelia.io/docs/blacklist/blacklist-linkedin-profile.md)

**curl**

```bash
curl -X POST https://api.emelia.io/emails/blacklists/linkedin \
  -H "Authorization: $EMELIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"value": "https://www.linkedin.com/in/claire-fontaine"}'
```

**JavaScript**

```js
await fetch('https://api.emelia.io/emails/blacklists/linkedin', {
  method: 'POST',
  headers: { Authorization: process.env.EMELIA_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({ value: 'https://www.linkedin.com/in/claire-fontaine' }),
});
```

**Python**

```python
requests.post(
    "https://api.emelia.io/emails/blacklists/linkedin",
    headers={"Authorization": os.environ["EMELIA_API_KEY"]},
    json={"value": "https://www.linkedin.com/in/claire-fontaine"},
)
```

`value` is a full profile URL or a bare handle (`claire-fontaine`): it is stored as the handle. [Remove a LinkedIn profile](https://docs.emelia.io/docs/blacklist/remove-linkedin-profile.md) takes the same body.

## Read the blacklists

[`GET /emails/blacklists`](https://docs.emelia.io/docs/blacklist/get-blacklists.md)

**curl**

```bash
curl https://api.emelia.io/emails/blacklists \
  -H "Authorization: $EMELIA_API_KEY"
```

**JavaScript**

```js
const res = await fetch('https://api.emelia.io/emails/blacklists', {
  headers: { Authorization: process.env.EMELIA_API_KEY },
});
const [blacklist] = await res.json(); // a plain array
const emails = blacklist?.blacklistContent?.split('\n').filter(Boolean) ?? [];
const linkedin = blacklist?.linkedinBlacklistContent?.split('\n').filter(Boolean) ?? [];
```

**Python**

```python
res = requests.get(
    "https://api.emelia.io/emails/blacklists",
    headers={"Authorization": os.environ["EMELIA_API_KEY"]},
)
items = res.json()  # a plain array
emails = items[0]["blacklistContent"].split("\n") if items else []
```

The response is a plain array, not wrapped in `success`. Each item holds `blacklistContent` (addresses and domains) and `linkedinBlacklistContent` (LinkedIn handles), one entry per line.

## Automatic blacklisting

* With `blacklistUnsub: true` in the [campaign settings](https://docs.emelia.io/docs/campaigns/update-campaign-settings.md), a contact who unsubscribes is blacklisted on its own.
* A contact who **writes** "please remove me" in a reply is not caught by that setting. Read the [replies](https://docs.emelia.io/docs/replies.md) and blacklist those contacts yourself, for example from your webhook handler.
