Call it
curl https://api.peume.com/v1/call/flexible-live-insights-query \
-H "Authorization: Bearer $PEUME_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": {
"accountId": "your accountId",
"reportType": "BASIC",
"page": 1,
"pageSize": 100,
"limit": 25
}
}'const res = await fetch("https://api.peume.com/v1/call/flexible-live-insights-query", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PEUME_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"input": {
"accountId": "your accountId",
"reportType": "BASIC",
"page": 1,
"pageSize": 100,
"limit": 25
}
}),
});
const { output, cost_usd } = await res.json();import os, requests
res = requests.post(
"https://api.peume.com/v1/call/flexible-live-insights-query",
headers={"Authorization": f"Bearer {os.environ['PEUME_API_KEY']}"},
json={
"input": {
"accountId": "your accountId",
"reportType": "BASIC",
"page": 1,
"pageSize": 100,
"limit": 25
}
},
)
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: flexible-live-insights-query.
Parameters
accountIdRequiredstringSocialAccount id (posting or ads variant); its platform selects the Meta, Google or TikTok contract.
objectIdstringMeta only (required there): insights node (act_<n>, campaign id, ad set id or ad id).
querystringGoogle only (required there): the GAQL SELECT statement to run.
adAccountIdstringGoogle: platform ad account ID (Google customer ID, digits only) when the connection has several Google Ads accounts. TikTok (required there): the advertiser id.
reportTypestringTikTok only: report_type.
BASIC · AUDIENCE
Example: BASIC
dataLevelstringTikTok only (required there): data_level.
AUCTION_ADVERTISER · AUCTION_CAMPAIGN · AUCTION_ADGROUP · AUCTION_AD
dimensionsstringTikTok only (required there): 1-4 comma-separated TikTok dimensions (e.g. country_code, campaign_id, stat_time_day).
metricsstringTikTok only (required there): comma-separated TikTok metrics (e.g. reach,impressions,frequency,spend).
pageintegerTikTok only: page number.
Example: 1
pageSizeintegerTikTok only: rows per page.
Example: 100
customerIdstringAlias of adAccountId, kept for existing callers
pageTokenstringGoogle only: cursor from paging.nextPageToken of the previous page.
levelstringRow granularity
ad · adset · campaign · account
fieldsstringComma-separated Graph insights fields (e.g. spend,impressions,frequency,website_purchase_roas). Omitted = Meta's default set.
breakdownsstringMeta only: comma-separated Graph breakdowns (e.g. age,gender or publisher_platform). Returns 400 on TikTok (add the breakdown to dimensions with reportType=AUDIENCE, e.g. dimensions=campaign_id,placement) and on Google (select segments.* in the query).
actionBreakdownsstringComma-separated Graph action breakdowns; segments the actions[] arrays in each row. Pass `none` to clear Meta's default action_type breakdown, required to combine some non-action breakdowns such as instagram_ads_follow_type (otherwise Meta returns a (#100) invalid-combination error).
actionAttributionWindowsstringComma-separated Meta attribution windows. Action values are returned keyed per window.
actionReportTimestringWhen actions are counted: impression, conversion or mixed.
useUnifiedAttributionSettingbooleanUse the ad sets' own attribution settings for action counting.
filteringstringJSON array of filter objects: [{"field", "operator", "value"}]. Applied server-side by Meta or TikTok (TikTok fields e.g. campaign_ids, adgroup_ids, ad_ids).
datePresetstringMeta date_preset (e.g. last_7d, last_30d, this_month). Mutually exclusive with fromDate/toDate.
fromDatestringStart of range (YYYY-MM-DD); requires toDate. Required on TikTok.
toDatestringEnd of range (YYYY-MM-DD); requires fromDate.
timeIncrementstringDays per row (1-90), monthly, or all_days.
limitintegerRows per page
Example: 25
afterstringCursor from paging.after of the previous page.
