Read target-scoped post analytics totals with GET /api/v1/analytics/posts/{postId}. Requires an API key with the read scope or a signed-in workspace member.
Request
Returns one entry per destination target. A target whose attempt is not published or lacks a provider post ID returns a pending or unavailable state, not 404.
| Parameter | In | Type | Required |
|---|---|---|---|
postId |
path | UUID | Yes |
workspaceId |
query | UUID | Yes |
targetId |
query | UUID | No |
from |
query | string | No |
to |
query | string | No |
timezone |
query | string | No |
granularity |
query | "day", "total" |
No |
metrics |
query | array of string | No |
Response
- HTTP 200:
PostAnalyticswithpostId,workspaceId,range,targets,freshness.
The OpenAPI document has each field’s type.
Examples
const totals = await workspace.analytics.post(postId);totals = workspace.analytics.get_post(post_id)curl "https://pubnio.com/api/v1/analytics/posts/$POST_ID?workspaceId=$WORKSPACE_ID" \
-H "Authorization: Bearer $PUBNIO_API_KEY"pnio analytics posts get "$POST_ID"async () => {
const postId = "<postId>";
const response = await codemode.request({
method: "GET",
path: `/api/v1/analytics/posts/${postId}`,
query: { workspaceId: codemode.workspaceId },
});
return response.data;
};Errors
It declares no problem of its own.
It declares the problems every Analytics operation and most operations declare.
Idempotency
None needed: a read is safe to retry.
Limits
- Field lengths and ranges are in the OpenAPI document.