# List email campaign contacts (paginated)

Source: https://docs.emelia.io/docs/campaigns/legacy/email/list-campaign-contacts

Guide: [Email campaigns](https://docs.emelia.io/docs/campaigns/legacy/email.md)

`GET https://api.emelia.io/emails/campaign/contacts`

Returns a page of the campaign recipients. Pagination is 0-based (page=0 is the first page). perPage defaults to 20, values below 10 are forced to 20, and values above 10000 are capped at 10000. The response envelope is { success, list, count } (NOT { contacts, total }). event filters by contact status and MUST be an array (e.g. event[]=REPLIED); a bare string is rejected (contrast with the LinkedIn variant which also accepts a string). New integrations should use the multichannel /advanced campaign endpoints instead.

> **Deprecated.**

## Authentication

Send your API key in the `Authorization` header: `Authorization: <your API key>`.

## Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Campaign ObjectId. |
| `page` | string | yes | 0-based page index (sent as a string). |
| `perPage` | string | no | Page size. Default 20, min 10 (else forced to 20), max 10000. |
| `event` | array of enum: `SENT`, `OPENED`, `CLICKED`, `REPLIED`, `BOUNCED`, `UNSUBSCRIBED`, `INTERESTED`, `NO_ACTIVITY` | no | Filter by contact status. Must be an array. |
| `query` | string | no | Full email match, or space-separated tokens matched against email/firstName/lastName. |

## Example request

**cURL**

```bash
curl -X GET "https://api.emelia.io/emails/campaign/contacts?id=65f1a2b3c4d5e6f73478765e&page=0" \
  -H "Authorization: $EMELIA_API_KEY"
```

**JavaScript**

```js
const response = await fetch('https://api.emelia.io/emails/campaign/contacts?id=65f1a2b3c4d5e6f73478765e&page=0', {
  method: 'GET',
  headers: { Authorization: process.env.EMELIA_API_KEY },
});
console.log(await response.json());
```

**Python**

```python
import os
import requests

response = requests.get(
    "https://api.emelia.io/emails/campaign/contacts?id=65f1a2b3c4d5e6f73478765e&page=0",
    headers={"Authorization": os.environ["EMELIA_API_KEY"]},
)
print(response.json())
```

## Responses

### 200: One page of contacts.

| Field | Type | Required | Description |
|---|---|---|---|
| `success` | enum: `true` | yes |  |
| `list` | array of object | yes |  |
| `list[]._id` | string | no |  |
| `list[].email` | string (email) | no |  |
| `list[].firstName` | string | no |  |
| `list[].lastName` | string | no |  |
| `list[].phoneNumber` | string | no |  |
| `list[].custom` | object | no | Custom variables. |
| `list[].status` | string | no | Latest status, e.g. SENT, OPENED, CLICKED, REPLIED, BOUNCED, UNSUBSCRIBED, BLACKLISTED. '-' when none. |
| `list[].mailsSent` | integer | no |  |
| `list[].lastContacted` | string (date-time) | no |  |
| `list[].lastOpen` | string (date-time) | no |  |
| `list[].lastReplied` | string (date-time) | no |  |
| `list[].interested` | string | no | Legacy field, always "-" in campaign contact listings. |
| `count` | integer | yes | Total number of matching contacts. |

```json
{
  "success": true,
  "count": 2,
  "list": [
    {
      "_id": "5f3a1b2c4d5e6f00112233aa",
      "email": "john.doe@acme.com",
      "firstName": "John",
      "lastName": "Doe",
      "status": "SENT",
      "mailsSent": 1,
      "interested": "-"
    }
  ]
}
```

### 400: Business or validation error. 400 by default; Joi validation errors carry code INVALID_REQUEST.

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | string or object | yes | Human readable message. A few legacy routes return an empty object `{}` here instead of a string. |
| `code` | enum: `INVALID_REQUEST`, `INVALID_PARAMETERS`, `SUBSCRIPTION_REQUIRED`, `CAMPAIGN_NOT_FOUND`, `CAMPAIGN_ALREADY_RUNNING`, `SCHEDULE_MISSING`, `STEPS_MISSING`, `NO_RECIPIENTS`, `TOO_MANY_RECIPIENTS`, `PLANNED_START_INVALID`, `PLANNED_START_IN_PAST`, `EMAIL_PROVIDER_MISSING`, `EMAIL_PROVIDER_DISCONNECTED`, `EMAIL_PROVIDER_EXPIRED`, `ONE_EMAIL_PROVIDER_EXPIRED`, `EMAIL_ADDRESS_DISCONNECTED`, `TRACKING_DOMAINS_REQUIRED`, `LINKEDIN_ACCOUNT_MISSING`, `LINKEDIN_COOKIE_EXPIRED`, `LINKEDIN_SLOT_EXPIRED`, `WHATSAPP_ACCOUNT_EXPIRED`, `WHATSAPP_SLOT_EXPIRED`, `NO_IDENTITY_SET`, `IDENTITY_FOREIGN_ACCOUNT`, `IDENTITY_EMAIL_PROVIDER_MISSING`, `LINKEDIN_ACCOUNT_AMBIGUOUS`, `WHATSAPP_ACCOUNT_AMBIGUOUS`, `LINKEDIN_AUDIO_MISSING`, `EMAIL_STEP_NO_ACTIVE_VERSION`, `EMAIL_VERSION_NO_CONTENT`, `EMAIL_VERSION_NO_SUBJECT`, `RECIPIENTS_NO_EMAIL`, `RECIPIENTS_NO_LINKEDIN`, `MC_LINKEDIN_DAILY_LIMIT_CONNECTION`, `MC_LINKEDIN_DAILY_LIMIT`, `DAILY_CONTACT_TOO_LOW`, `LINKEDIN_DAILY_CONTACT_LIMIT`, `VERIFY_EMAIL_TOKEN_INVALID`, `VERIFY_EMAIL_TOKEN_EXPIRED`, `FREE_CREDITS_DOMAIN_ALREADY_CLAIMED`, `FREE_CREDITS_ALREADY_GRANTED`, `FREE_CREDITS_NOT_ELIGIBLE`, `RATE_LIMITED`, `STATS_COMPUTING`, `WARMUP_PROVIDER_UNSUPPORTED`, `ACCOUNT_DISCONNECTED` | no | Stable machine readable error code. Present only on catalogued errors (mainly the campaign start checks), on validation errors (`INVALID_REQUEST`) and on some LinkedIn provider errors (`ACCOUNT_DISCONNECTED`, `RATE_LIMITED`). Most other errors have no code: rely on the HTTP status and on `error`. Codes are never renamed once deployed. |
| `params` | object | no | Values interpolated in the message, for example `{"max": 30000}`. |

```json
{
  "error": "string",
  "code": "INVALID_REQUEST",
  "params": {}
}
```
