> ## Documentation Index
> Fetch the complete documentation index at: https://docs.postsyncer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Analytics - by post

> Aggregated analytics for one post across all accounts, plus per-account metrics

## By post

Returns **cumulative** engagement metrics for a single post (summed across every connected account / platform row) and a **per-account** breakdown. The only input is the **post ID** in the path (no query parameters).

Metrics match the `analytics` object on each item under `platforms` when you [get a post](https://docs.postsyncer.com/api-reference/posts/get.md): `comments`, `likes`, `shares`, `impressions`, `quotes`, `saves`, and `engagement_rate`.

For **published** platform rows, `analytics` uses the same values as the dashboard sync. For non-published rows, `analytics` is an empty object `{}`.

The **`total.engagement_rate`** value is a **weighted average** by impressions across published rows when any row has impressions; otherwise it falls back to a simple average of non-zero rates.

### Request

**post** `integer` *required*

Post primary key (same id as in `/posts/{id}`).

```bash theme={null}
curl -X GET "https://postsyncer.com/api/v1/analytics/posts/743" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

### Response

**post\_id** `integer`

The post id from the path

**total** `object`

Cumulative metrics: `comments`, `likes`, `shares`, `impressions`, `quotes`, `saves`, `engagement_rate`

**accounts** `array`

One entry per platform post row: `account_id`, `platform`, `status`, `post_url`, `analytics`, and `account` (same shape as list-accounts when present)

```json theme={null}
{
  "post_id": 743,
  "total": {
    "comments": 16,
    "likes": 84,
    "shares": 12,
    "impressions": 2500,
    "quotes": 4,
    "saves": 20,
    "engagement_rate": 4.25
  },
  "accounts": [
    {
      "account_id": 55,
      "platform": "twitter",
      "status": "PUBLISHED",
      "post_url": "https://twitter.com/user/status/123",
      "analytics": {
        "comments": 8,
        "likes": 42,
        "shares": 8,
        "impressions": 1250,
        "quotes": 2,
        "saves": 12,
        "engagement_rate": 4.4
      },
      "account": {
        "id": 55,
        "workspace_id": 12,
        "platform": "twitter",
        "username": "example",
        "name": "Example",
        "avatar": "https://…",
        "has_expired": false,
        "is_default": false,
        "support_threads": true,
        "is_verified": false
      }
    }
  ]
}
```

### Permissions

Requires the same **`posts`** ability as other post endpoints.

### Error codes

**401** `Unauthorized`

Missing or invalid API token

**403** `Forbidden`

Token does not have the `posts` permission

**404** `Not Found`

Post does not exist or is not in any workspace the user can access

### Code examples

```bash cURL theme={null}
curl -X GET "https://postsyncer.com/api/v1/analytics/posts/743" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

```javascript Node.js theme={null}
const axios = require('axios');

const getPostAnalytics = async (postId) => {
  const { data } = await axios.get(
    `https://postsyncer.com/api/v1/analytics/posts/${postId}`,
    { headers: { Authorization: 'Bearer YOUR_API_TOKEN' } }
  );
  return data;
};
```

```python Python theme={null}
import requests

r = requests.get(
    'https://postsyncer.com/api/v1/analytics/posts/743',
    headers={'Authorization': 'Bearer YOUR_API_TOKEN'},
)
r.raise_for_status()
print(r.json()['total'])
```

See also: [Analytics overview](https://docs.postsyncer.com/api-reference/analytics/overview.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.