> Documentation index: https://docs.zernio.com/llms.txt. Every page is also Markdown: add .md to its URL.

# Customer list audiences

Create a Pinterest customer list audience with POST /v1/ads/audiences and upload hashed members to it.

Build a customer list audience on a `pinterestads` account, then target it through `audienceInclude` or `audienceExclude` ([Targeting fields](/platforms/pinterest-ads/targeting)).

## Create an audience

Create the audience with `POST /v1/ads/audiences` (`type: "customer_list"`), then upload members with `POST /v1/ads/audiences/{audienceId}/users`.

Pinterest matches on email, ignores every other key, and takes at most 10,000 users per request.

Send emails in plaintext (SHA-256 hashed before they leave) or already hashed. Each upload after the first adds to the audience, so send larger lists as several uploads.

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
const { data: audience } = await zernio.adaudiences.createAdAudience({
  body: {
    accountId: '66b2e19d8c3f5a7e9d0b1c2d',
    adAccountId: '549123456789',
    type: 'customer_list',
    name: 'Repeat buyers'
  }
});

const { data: upload } = await zernio.adaudiences.addUsersToAdAudience({
  path: { audienceId: audience.audience.id },
  body: { users: [{ email: 'jane@example.com' }, { email: 'sam@example.com' }] }
});

console.log(upload.numReceived);
```
</Tab>
<Tab value="Python">
```python
audience = client.ad_audiences.create_ad_audience(
    account_id="66b2e19d8c3f5a7e9d0b1c2d",
    ad_account_id="549123456789",
    type="customer_list",
    name="Repeat buyers",
)

upload = client.ad_audiences.add_users_to_ad_audience(
    audience_id=audience["audience"]["id"],
    users=[{"email": "jane@example.com"}, {"email": "sam@example.com"}],
)

print(upload["numReceived"])
```
</Tab>
<Tab value="curl">
```bash
curl -X POST "https://zernio.com/api/v1/ads/audiences" \
  -H "Authorization: Bearer $ZERNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "accountId": "66b2e19d8c3f5a7e9d0b1c2d", "adAccountId": "549123456789", "type": "customer_list", "name": "Repeat buyers" }'

curl -X POST "https://zernio.com/api/v1/ads/audiences/66e5b2c3d4f5a6b7c8d9e0f1/users" \
  -H "Authorization: Bearer $ZERNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "users": [{ "email": "jane@example.com" }, { "email": "sam@example.com" }] }'
```
</Tab>
</Tabs>

Response (`201`):

```json
{
  "audience": { "id": "66e5b2c3d4f5a6b7c8d9e0f1", "name": "Repeat buyers", "type": "customer_list", "platform": "pinterest", "status": "pending" },
  "message": "Audience created"
}
```

Response (`200`):

```json
{ "message": "Users added", "numReceived": 2, "numInvalid": 0 }
```

## Remove users

When someone leaves your list, call `DELETE /v1/ads/audiences/{audienceId}/users` with the same body as the upload, up to 10,000 users per request. Each row removes the person it added.

```bash
curl -X DELETE "https://zernio.com/api/v1/ads/audiences/66e5b2c3d4f5a6b7c8d9e0f1/users" \
  -H "Authorization: Bearer $ZERNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "users": [{ "email": "sam@example.com" }] }'
```

- A row without an email counts in `invalid`. A request with no email at all returns 400.

## How it behaves

- Pinterest needs the member file at creation time, so the audience is provisioned lazily.
- The create records it with status `pending` and no platform id. The first upload creates it on Pinterest.

## If it fails

| Error | Cause | Fix |
|-------|-------|-----|
| Members not matched | No `email` was sent; Pinterest matches on email | Send an `email` for each member. |
| No platform id on the audience | No members have been uploaded yet | Upload members: the first upload creates it on Pinterest. |

## Related

- [Targeting fields](/platforms/pinterest-ads/targeting): where `audienceInclude` and `audienceExclude` go.
- [Create ad audience](/ad-audiences/create-ad-audience): every field of the create.
- [Add users to ad audience](/ad-audiences/add-users-to-ad-audience): the member upload.