Aggregate Post Metrics ⚠️ Experimental
Aggregate normalized post metrics across a window of sent posts, without paginating through individual posts. When authenticating via OAuth, requires the insights:read scope; personal API keys don't need it.
The returned metrics array always includes a baseline trio — postCount, reactions, and comments. Beyond those, additional metric types are included only when every channel in the filter set supports them.
query AggregatePostMetrics {
aggregatedPostMetrics(
input: {
organizationId: "some_organization_id"
startDateTime: "2026-01-01T00:00:00Z"
endDateTime: "2026-03-31T23:59:59Z"
channelIds: ["some_channel_id"]
}
) {
metrics {
type
value
unit
}
metricsUpdatedAt
}
}
curl -X POST 'https://api.buffer.com' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-d '{"query": "query AggregatePostMetrics {\n aggregatedPostMetrics(\n input: {\n organizationId: \"some_organization_id\"\n startDateTime: \"2026-01-01T00:00:00Z\"\n endDateTime: \"2026-03-31T23:59:59Z\"\n channelIds: [\"some_channel_id\"]\n }\n ) {\n metrics {\n type\n value\n unit\n }\n metricsUpdatedAt\n }\n}"}'
async function aggregatePostMetrics() {
const response = await fetch('https://api.buffer.com', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY',
},
body: JSON.stringify({
query: `
query AggregatePostMetrics {
aggregatedPostMetrics(
input: {
organizationId: "some_organization_id"
startDateTime: "2026-01-01T00:00:00Z"
endDateTime: "2026-03-31T23:59:59Z"
channelIds: ["some_channel_id"]
}
) {
metrics {
type
value
unit
}
metricsUpdatedAt
}
}
`,
}),
});
const data = await response.json();
console.log(JSON.stringify(data, null, 2));
}
aggregatePostMetrics();
import requests
query = """
query AggregatePostMetrics {
aggregatedPostMetrics(
input: {
organizationId: "some_organization_id"
startDateTime: "2026-01-01T00:00:00Z"
endDateTime: "2026-03-31T23:59:59Z"
channelIds: ["some_channel_id"]
}
) {
metrics {
type
value
unit
}
metricsUpdatedAt
}
}
"""
response = requests.post(
"https://api.buffer.com",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY",
},
json={
"query": query,
},
)
data = response.json()
print(data)
<?php
$query = '
query AggregatePostMetrics {
aggregatedPostMetrics(
input: {
organizationId: "some_organization_id"
startDateTime: "2026-01-01T00:00:00Z"
endDateTime: "2026-03-31T23:59:59Z"
channelIds: ["some_channel_id"]
}
) {
metrics {
type
value
unit
}
metricsUpdatedAt
}
}
';
$payload = [
'query' => $query,
];
$ch = curl_init('https://api.buffer.com');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer YOUR_API_KEY',
],
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
print_r($data);