Call it
curl https://api.peume.com/v1/call/get-youtube-channel-insights \
-H "Authorization: Bearer $PEUME_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": {
"accountId": "your accountId",
"metricType": "total_value"
}
}'const res = await fetch("https://api.peume.com/v1/call/get-youtube-channel-insights", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PEUME_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"input": {
"accountId": "your accountId",
"metricType": "total_value"
}
}),
});
const { output, cost_usd } = await res.json();import os, requests
res = requests.post(
"https://api.peume.com/v1/call/get-youtube-channel-insights",
headers={"Authorization": f"Bearer {os.environ['PEUME_API_KEY']}"},
json={
"input": {
"accountId": "your accountId",
"metricType": "total_value"
}
},
)
print(res.json()["output"])Answer: {"id": "run_…", "status": "completed", "cost_usd": …, "output": {…}}. Long jobs answer 202 with a run id to read later. From an AI agent, connect the MCP server and ask for this by name: get-youtube-channel-insights.
Parameters
accountIdRequiredstringThe SocialAccount ID for the YouTube account.
metricsstringComma-separated list. Defaults to "views,estimatedMinutesWatched,subscribersGained,subscribersLost". Live YouTube Analytics v2 metrics: - views - estimatedMinutesWatched - averageViewDuration (ratio - weighted mean computed across days) - subscribersGained - subscribersLost - likes - comments - shares -synthesized from daily follower snapshots (cross-platform parity): - followers_gained - followers_lost
fromDatestringStart date (YYYY-MM-DD). Defaults to 30 days ago.
toDatestringEnd date (YYYY-MM-DD). Defaults to today. YouTube Analytics has a 2-3 day delay, so the fetch is internally clamped to 3 days ago; any requested range extending beyond that returns zero values for the tail days. The response's dateRange.until field reflects your requested value.
sincestringAlias of fromDate, kept for existing callers
untilstringAlias of toDate, kept for existing callers
metricTypestring"total_value" (default) returns aggregated totals. "time_series" returns per-day values in the "values" array.
time_series · total_value
Example: total_value
