# Facebook Page metrics

> A Page's audience, engagement on recent posts, and 28-day insights.

Canonical: <https://www.tryadeli.com/docs/api/analytics/facebook-page-metrics>

`GET https://app.tryadeli.com/api/v1/analytics/facebook/page-metrics`

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

Returns the Page's own details and audience size, engagement totalled across
its recent posts, and Page Insights for the last 28 days.

**Query parameters**

| Name        | Type   | Required | Description                                                                                     |
| ----------- | ------ | -------- | ----------------------------------------------------------------------------------------------- |
| `accountId` | `uuid` |          | A connected Facebook Page. Defaults to the profile's Page.                                      |
| `profileId` | `uuid` |          | Required unless you pass accountId, which names its profile. If you pass both, they must agree. |

**insights**

| Name          | Type             | Required | Description                                                                                    |
| ------------- | ---------------- | -------- | ---------------------------------------------------------------------------------------------- |
| `views`       | `number \| null` |          | Times the Page's content was on screen over the window (Meta's page\_media\_view), summed.     |
| `engagements` | `number \| null` |          | Reactions, comments, shares, and clicks on the Page's posts (page\_post\_engagements), summed. |
| `pageViews`   | `number \| null` |          | Visits to the Page itself (page\_views\_total), summed.                                        |
| `followers`   | `number \| null` |          | Followers on the latest day Meta reported (page\_follows).                                     |
| `daily`       | `array`          |          | Daily views, oldest first, as { date, value }.                                                 |

> **Note: When insights is null**
>
> Page Insights need the `read_insights` permission. A Facebook connection made
> before Adeli requested it, or one where it was declined, returns
> `"insights": null` with `"insightsUnavailable": "permission_missing"`;
> reconnecting Facebook fixes it. `"analyze_task_missing"` means Meta refused
> even with the permission, because the person who connected the Page cannot
> view its insights. `"provider_error"` means Meta failed the request. The rest
> of the response is returned either way. A figure Meta did not report is
> `null`, not `0`; small or new Pages often have none yet.

**Errors** — `401 unauthorized`, `400 invalid_request`, `404 account_not_found`,
`409 page_not_selected`, `422 connection_expired`,
`422 provider_not_configured`, `502 provider_error`.

## Request examples

**cURL**

```bash
curl --fail-with-body "https://app.tryadeli.com/api/v1/analytics/facebook/page-metrics?accountId=00000000-0000-4000-8000-000000000003" \
  -H "Authorization: Bearer $ADELI_API_KEY"
```

**JavaScript**

```javascript
const response = await fetch("https://app.tryadeli.com/api/v1/analytics/facebook/page-metrics?accountId=00000000-0000-4000-8000-000000000003", {
  headers: {
    Authorization: `Bearer ${process.env.ADELI_API_KEY}`,
  },
});
console.log(await response.json());
```

**Python**

```python
import os

import requests

response = requests.get(
    "https://app.tryadeli.com/api/v1/analytics/facebook/page-metrics",
    headers={"Authorization": f"Bearer {os.environ['ADELI_API_KEY']}"},
    params={
        "accountId": "00000000-0000-4000-8000-000000000003",
    },
)
print(response.json())
```

## Responses

### 200

```json
{
  "platform": "facebook",
  "accountId": "00000000-0000-4000-8000-000000000003",
  "profileId": "00000000-0000-4000-8000-000000000001",
  "page": { "id": "1234567890", "name": "Jasper’s Market", "username": "jaspers", "category": "Grocery Store", "link": "https://www.facebook.com/jaspers" },
  "metrics": { "followers": 980, "fans": 960, "recentPosts": 10, "recentPostLikes": 42, "recentPostComments": 7, "recentPostShares": 3 },
  "insights": {
    "periodDays": 28,
    "views": 4200,
    "engagements": 310,
    "pageViews": 75,
    "followers": 990,
    "daily": [{ "date": "2026-09-20T07:00:00+0000", "value": 150 }]
  },
  "insightsUnavailable": null,
  "fetchedAt": "2026-09-21T12:00:00.000Z"
}
```

### 409

```json
{
  "error": {
    "code": "page_not_selected",
    "message": "Choose a Facebook Page first"
  }
}
```

### 404

```json
{
  "error": {
    "code": "account_not_found",
    "message": "Facebook account not found"
  }
}
```
