# Estimate reach

> How many people a Meta targeting spec reaches.

Canonical: <https://www.tryadeli.com/docs/api/ads/estimate-reach>

`POST https://app.tryadeli.com/api/v1/ads/reach-estimate`

Authorization: `Bearer <API key>` — see [Authentication](https://www.tryadeli.com/docs/authentication)

**Meta Ads.** Meta's estimate of how many people a targeting spec reaches, to
size an audience before creating a campaign or changing an ad set's targeting.
It is a read sent as `POST` because a targeting spec does not fit in a query
string; it creates nothing. `lower` and `upper` are `null` when Meta cannot
estimate, as for some custom audiences, and `ready` is false while Meta is
still working one out.

**Body**

| Name          | Type     | Required | Description                                                                                                             |
| ------------- | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------- |
| `adAccountId` | `string` | Yes      | The ad account to estimate in.                                                                                          |
| `targeting`   | `object` | Yes      | The same targeting as [Create campaign](https://www.tryadeli.com/docs/api/ads/create-campaign#meta-full-campaign-body). |

## Request examples

**cURL**

```bash
curl -X POST "https://app.tryadeli.com/api/v1/ads/reach-estimate?accountId=00000000-0000-0000-0000-000000000000" \
  -H "Authorization: Bearer $ADELI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "adAccountId": "act_1234567890",
  "targeting": {
    "ageMin": 25,
    "ageMax": 44,
    "locations": {
      "countries": [
        "US"
      ]
    },
    "interests": [
      {
        "id": "6003127206524",
        "name": "Coffee"
      }
    ]
  }
}'
```

**JavaScript**

```javascript
const response = await fetch("https://app.tryadeli.com/api/v1/ads/reach-estimate?accountId=00000000-0000-0000-0000-000000000000", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ADELI_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    adAccountId: "act_1234567890",
    targeting: {
      ageMin: 25,
      ageMax: 44,
      locations: {
        countries: [
          "US",
        ],
      },
      interests: [
        {
          id: "6003127206524",
          name: "Coffee",
        },
      ],
    },
  }),
});
console.log(await response.json());
```

**Python**

```python
import os

import requests

response = requests.post(
    "https://app.tryadeli.com/api/v1/ads/reach-estimate",
    headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"},
    params={
        "accountId": "00000000-0000-0000-0000-000000000000",
    },
    json={
        "adAccountId": "act_1234567890",
        "targeting": {
            "ageMin": 25,
            "ageMax": 44,
            "locations": {
                "countries": [
                    "US",
                ],
            },
            "interests": [
                {
                    "id": "6003127206524",
                    "name": "Coffee",
                },
            ],
        },
    },
)
print(response.json())
```

## Responses

### 200

```json
{
  "platform": "meta_ads",
  "accountId": "00000000-0000-0000-0000-000000000000",
  "adAccountId": "act_1234567890",
  "estimate": { "lower": 1200000, "upper": 1400000, "ready": true }
}
```

### 400

```json
{
  "error": {
    "code": "invalid_request",
    "message": "Invalid reach estimate request"
  }
}
```
