# Get Facebook post monetization earnings

Fetches Facebook post monetization earnings.

```http
GET https://api.pozy.ai/v1/analytics/facebook/post-earnings
```

- Area: Analytics / Analytics
- Auth: Authorization: Bearer pz_live_...

## Query parameters

- `accountId` (string, required)
- `postId` (string, required)
- `metrics` (string)

## Example request

```bash
curl -X GET "https://api.pozy.ai/v1/analytics/facebook/post-earnings?accountId=696e0b682d0a31188e7a2ba9&postId=6108a2cc742cb4e991051e0c" \
  -H "Authorization: Bearer $POZY_API_KEY"
```

```ts
const res = await fetch("https://api.pozy.ai/v1/analytics/facebook/post-earnings?accountId=696e0b682d0a31188e7a2ba9&postId=6108a2cc742cb4e991051e0c", {
  headers: { Authorization: `Bearer ${process.env.POZY_API_KEY}` },
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.get(
    "https://api.pozy.ai/v1/analytics/facebook/post-earnings",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    params={
        "accountId": "696e0b682d0a31188e7a2ba9",
        "postId": "6108a2cc742cb4e991051e0c",
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `success`, boolean
- `accountId`, string
- `postId`, string
- `platform`, string
- `period`, string: One of `lifetime`
- `metrics`, map of object: Keys are free-form; each value has these fields
  - `total`, number
  - `unit`, string: One of `micro_amount`, `unspecified`
  - `currency`, string: Can be null
- `unavailableMetrics`, array of object
  - `metric`, string
  - `reason`, string: One of `not_enrolled`, `permission_missing`, `unsupported_metric`, `no_data`, `unreadable_value`, `mixed_currency`, `upstream_error`
  - `message`, string
- `dataDelay`, string

```json
{
  "success": true,
  "accountId": "696e0b682d0a31188e7a2ba9",
  "postId": "6108a2cc742cb4e991051e0c",
  "platform": "instagram",
  "period": "lifetime",
  "metrics": {
    "key": {
      "total": 12.5,
      "unit": "micro_amount",
      "currency": "USD"
    }
  },
  "unavailableMetrics": [
    {
      "metric": "string",
      "reason": "not_enrolled",
      "message": "Hello from Pozy"
    }
  ],
  "dataDelay": "string"
}
```
