# Find the campaigns using lists

Source: https://docs.emelia.io/docs/lists/find-campaigns-of-lists

Guide: [Lists & contacts](https://docs.emelia.io/docs/lists.md)

`GET https://api.emelia.io/lists/list/campaign-usage`

For each list id, returns the non-archived campaigns that include the list in their recipients. Use it to know whether adding contacts to a list will feed a campaign. Lists used only as exclusion lists are not reported. Ids that are not valid ObjectIds are dropped; ids of lists that are not yours return an empty array.

## Authentication

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

## Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `listIds` | string | yes | Comma-separated list ids. |

## Example request

**cURL**

```bash
curl -X GET "https://api.emelia.io/lists/list/campaign-usage?listIds=66f1c0ffee5a7d3b2c4e8a10%2C66f1c0ffee5a7d3b2c4e8a11" \
  -H "Authorization: $EMELIA_API_KEY"
```

**JavaScript**

```js
const response = await fetch('https://api.emelia.io/lists/list/campaign-usage?listIds=66f1c0ffee5a7d3b2c4e8a10%2C66f1c0ffee5a7d3b2c4e8a11', {
  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/lists/list/campaign-usage?listIds=66f1c0ffee5a7d3b2c4e8a10%2C66f1c0ffee5a7d3b2c4e8a11",
    headers={"Authorization": os.environ["EMELIA_API_KEY"]},
)
print(response.json())
```

## Responses

### 200: Campaigns per list id.

| Field | Type | Required | Description |
|---|---|---|---|
| `usage` | object | yes | Keys are the requested list ids. |

```json
{
  "usage": {
    "66f1c0ffee5a7d3b2c4e8a10": [
      {
        "_id": "66e0d9c8b7a6f5e4d3c2b1a0",
        "name": "Acme Q4 outreach",
        "status": "RUNNING"
      }
    ],
    "66f1c0ffee5a7d3b2c4e8a11": []
  }
}
```

### 400: `listIds` missing or empty.

| Field | Type | Required | Description |
|---|---|---|---|
| `message` | string | yes | English, human-readable message. |
| `code` | string | no | Stable error code, when available (for example `PAYLOAD_TOO_LARGE`, `INVALID_JSON`, `export_too_large`, `companies_only`, `enrichment_running`). |
| `params` | object | no |  |
| `error` | string | no | Raw internal message (unexpected errors only). |

```json
{
  "message": "listIds query param is required"
}
```

### 401: Missing, unknown or disabled API key, or the account of the key no longer exists. Note the body shape: `error` and `code`, not `message`.

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | string | yes |  |
| `code` | enum: `AUTH_REQUIRED`, `ACCOUNT_NOT_FOUND` | yes |  |

```json
{
  "error": "string",
  "code": "AUTH_REQUIRED"
}
```

### 500: Unexpected server error. `error`, when present, is a raw internal message: do not parse it. Retry later.

| Field | Type | Required | Description |
|---|---|---|---|
| `message` | string | yes | English, human-readable message. |
| `code` | string | no | Stable error code, when available (for example `PAYLOAD_TOO_LARGE`, `INVALID_JSON`, `export_too_large`, `companies_only`, `enrichment_running`). |
| `params` | object | no |  |
| `error` | string | no | Raw internal message (unexpected errors only). |

```json
{
  "message": "Hmm... Something went wrong. Please try again later."
}
```
