Query metrics
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");curl_easy_setopt(hnd, CURLOPT_URL, "https://api.focal.inc/v1/metrics/insights?space_id=6916bc3d-e1ab-425b-ac25-eefada01a9a2&ad_account_id=f0958ef1-b662-425b-8794-79ca648489c7&start_date=2027-03-01&end_date=2027-03-31&metric=spend%2Cimpressions%2Cclicks&group_by=date&granularity=day");
struct curl_slist *headers = NULL;headers = curl_slist_append(headers, "Authorization: Bearer <token>");curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);using System.Net.Http.Headers;var client = new HttpClient();var request = new HttpRequestMessage{ Method = HttpMethod.Get, RequestUri = new Uri("https://api.focal.inc/v1/metrics/insights?space_id=6916bc3d-e1ab-425b-ac25-eefada01a9a2&ad_account_id=f0958ef1-b662-425b-8794-79ca648489c7&start_date=2027-03-01&end_date=2027-03-31&metric=spend%2Cimpressions%2Cclicks&group_by=date&granularity=day"), Headers = { { "Authorization", "Bearer <token>" }, },};using (var response = await client.SendAsync(request)){ response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);}package main
import ( "fmt" "net/http" "io")
func main() {
url := "https://api.focal.inc/v1/metrics/insights?space_id=6916bc3d-e1ab-425b-ac25-eefada01a9a2&ad_account_id=f0958ef1-b662-425b-8794-79ca648489c7&start_date=2027-03-01&end_date=2027-03-31&metric=spend%2Cimpressions%2Cclicks&group_by=date&granularity=day"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.focal.inc/v1/metrics/insights?space_id=6916bc3d-e1ab-425b-ac25-eefada01a9a2&ad_account_id=f0958ef1-b662-425b-8794-79ca648489c7&start_date=2027-03-01&end_date=2027-03-31&metric=spend%2Cimpressions%2Cclicks&group_by=date&granularity=day")) .header("Authorization", "Bearer <token>") .method("GET", HttpRequest.BodyPublishers.noBody()) .build();HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());System.out.println(response.body());OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder() .url("https://api.focal.inc/v1/metrics/insights?space_id=6916bc3d-e1ab-425b-ac25-eefada01a9a2&ad_account_id=f0958ef1-b662-425b-8794-79ca648489c7&start_date=2027-03-01&end_date=2027-03-31&metric=spend%2Cimpressions%2Cclicks&group_by=date&granularity=day") .get() .addHeader("Authorization", "Bearer <token>") .build();
Response response = client.newCall(request).execute();import axios from 'axios';
const options = { method: 'GET', url: 'https://api.focal.inc/v1/metrics/insights', params: { space_id: '6916bc3d-e1ab-425b-ac25-eefada01a9a2', ad_account_id: 'f0958ef1-b662-425b-8794-79ca648489c7', start_date: '2027-03-01', end_date: '2027-03-31', metric: 'spend,impressions,clicks', group_by: 'date', granularity: 'day' }, headers: {Authorization: 'Bearer <token>'}};
try { const { data } = await axios.request(options); console.log(data);} catch (error) { console.error(error);}const url = 'https://api.focal.inc/v1/metrics/insights?space_id=6916bc3d-e1ab-425b-ac25-eefada01a9a2&ad_account_id=f0958ef1-b662-425b-8794-79ca648489c7&start_date=2027-03-01&end_date=2027-03-31&metric=spend%2Cimpressions%2Cclicks&group_by=date&granularity=day';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}val client = OkHttpClient()
val request = Request.Builder() .url("https://api.focal.inc/v1/metrics/insights?space_id=6916bc3d-e1ab-425b-ac25-eefada01a9a2&ad_account_id=f0958ef1-b662-425b-8794-79ca648489c7&start_date=2027-03-01&end_date=2027-03-31&metric=spend%2Cimpressions%2Cclicks&group_by=date&granularity=day") .get() .addHeader("Authorization", "Bearer <token>") .build()
val response = client.newCall(request).execute()use reqwest;
#[tokio::main]pub async fn main() { let url = "https://api.focal.inc/v1/metrics/insights";
let querystring = [ ("space_id", "6916bc3d-e1ab-425b-ac25-eefada01a9a2"), ("ad_account_id", "f0958ef1-b662-425b-8794-79ca648489c7"), ("start_date", "2027-03-01"), ("end_date", "2027-03-31"), ("metric", "spend,impressions,clicks"), ("group_by", "date"), ("granularity", "day"), ];
let mut headers = reqwest::header::HeaderMap::new(); headers.insert("Authorization", "Bearer <token>".parse().unwrap());
let client = reqwest::Client::new(); let response = client.get(url) .query(&querystring) .headers(headers) .send() .await;
let results = response.unwrap() .json::<serde_json::Value>() .await .unwrap();
dbg!(results);}curl --request GET \ --url 'https://api.focal.inc/v1/metrics/insights?space_id=6916bc3d-e1ab-425b-ac25-eefada01a9a2&ad_account_id=f0958ef1-b662-425b-8794-79ca648489c7&start_date=2027-03-01&end_date=2027-03-31&metric=spend%2Cimpressions%2Cclicks&group_by=date&granularity=day' \ --header 'Authorization: Bearer <token>'wget --quiet \ --method GET \ --header 'Authorization: Bearer <token>' \ --output-document \ - 'https://api.focal.inc/v1/metrics/insights?space_id=6916bc3d-e1ab-425b-ac25-eefada01a9a2&ad_account_id=f0958ef1-b662-425b-8794-79ca648489c7&start_date=2027-03-01&end_date=2027-03-31&metric=spend%2Cimpressions%2Cclicks&group_by=date&granularity=day'Aggregate ad-platform performance over a date window, grouped by date, ad, ad set, creative, media, or a media attribute.
Values are windowed to start_date–end_date. That is the difference from the metrics block on a media read, which reports lifetime totals.
group_by=media_column groups by the customer’s own tagging (brief, hook, actor, concept…), so the usefulness of that answer tracks how consistently their library is tagged. group_by=date returns one row per bucket; more than 1000 buckets page like any other grouping. Campaign and account grouping aren’t offered — filter by ad_campaign_id, or issue one request per ad account.
All id filters combine as one OR set: a row counts when it sits under any id named in any of ad_campaign_id, ad_set_id, ad_id or media_id. To intersect them, run one filter kind per call.
Campaign and ad-set ids to filter by come from GET /v1/metrics/ad-campaigns and /v1/metrics/ad-sets. Look up a row’s entity by its key: group_by=ad with GET /v1/metrics/ads/{id}, group_by=creative with GET /v1/metrics/creatives/{id}.
Metric keys come from GET /v1/metrics/features.
Required scope: metrics:read — a scope of its own, deliberately not covered by media:read, because ad spend and revenue are a different sensitivity class from asset metadata. (all:read does cover it.)
space_id is required and decides what you can see. The caller must be able to read that space (404 otherwise, so a space you can’t reach is indistinguishable from one that doesn’t exist), and an ad account is returned only when it is shared with that space or with the whole organization — or is private and was connected by the calling user. Rate-limit cost: 10.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Example
6916bc3d-e1ab-425b-ac25-eefada01a9a2Required. The single space to query, as a UUID. The API reads one space at a time — comma-separated lists and wildcards are not accepted, and there is no implicit default.
Example
f0958ef1-b662-425b-8794-79ca648489c7Ad accounts to query, comma-separated. Figures are summed across them without currency conversion.
Example
2027-03-01First day of the window, inclusive.
Example
2027-03-31Last day of the window, inclusive.
Example
spend,impressions,clicksMetric keys to return, comma-separated. See GET /v1/metrics/features.
What each row represents.
Bucket size for group_by=date. Default day.
Required for group_by=media_column.
Count ads under these campaigns, comma-separated. All id filters combine as one OR set: a row counts when it sits under any id named in any of ad_campaign_id, ad_set_id, ad_id or media_id. To intersect them, run one filter kind per call.
Count ads under these ad sets, comma-separated. All id filters combine as one OR set: a row counts when it sits under any id named in any of ad_campaign_id, ad_set_id, ad_id or media_id. To intersect them, run one filter kind per call.
Count these ads, comma-separated. All id filters combine as one OR set: a row counts when it sits under any id named in any of ad_campaign_id, ad_set_id, ad_id or media_id. To intersect them, run one filter kind per call.
Count ads running these media assets, comma-separated. All id filters combine as one OR set: a row counts when it sits under any id named in any of ad_campaign_id, ad_set_id, ad_id or media_id. To intersect them, run one filter kind per call.
One of the requested metrics, or name; prefix with - for descending (-spend). Defaults to the first metric descending. Ignored for group_by=date, which is always chronological.
Max rows per page (1–500). Default 50.
Pagination cursor returned as next_cursor from the previous page.
Responses
Section titled “Responses”OK
object
object
Identifier of the grouped entity — an ad / ad set id, a creative fingerprint, a media id, or an attribute option id.
Display name of the grouped entity, when it has one.
The media assets an ad or creative row resolves to — pass to GET /v1/media. Empty for every other grouping; under group_by=media the row’s key is itself the media id. Media rows and media_ids only include media in space_id.
The requested metrics, keyed by metric key. A metric the platforms reported nothing for reads as 0.
object
object
First day of the bucket, YYYY-MM-DD.
The requested metrics, keyed by metric key. A metric the platforms reported nothing for reads as 0.
object
Pass back as cursor to fetch the next page. null on the last page.
true when another page is available. Equivalent to next_cursor !== null.
Example
{ "data": [ { "key": "0c4a206c-ec59-4a8d-b882-e557d0fd5291", "name": "Hero video – 4:5 cut", "thumbnail_url": "https://scontent.xx.fbcdn.net/v/t45.1600-4/489012345_120210987654321100_n.jpg", "media_ids": [ "786beeda-55ac-4025-bf6e-43b2918e84a9" ], "metrics": { "spend": 1842.5, "impressions": 412380, "clicks": 6931 } } ], "next_cursor": "eyJ0IjoiMjAyNy0wMy0wNFQxMDoxNTowMC4wMDBaIiwiaSI6Ijc4NmJlZWRhLTU1YWMtNDAyNS1iZjZlLTQzYjI5MThlODRhOSJ9", "has_more": true}The request was malformed (invalid cursor, unknown type, validation failure, etc.). error.code is bad_request.
Canonical error envelope. code is stable across releases and intended for programmatic handling; message is human-readable. details only appears for validation failures and lists the offending fields.
object
object
object
Example
{ "error": { "code": "bad_request", "message": "Invalid request body", "details": [ { "field": "space_id", "issue": "Invalid UUID" } ] }}Missing, invalid, or disabled token. error.code is unauthenticated.
Canonical error envelope. code is stable across releases and intended for programmatic handling; message is human-readable. details only appears for validation failures and lists the offending fields.
object
object
object
Example
{ "error": { "code": "unauthenticated", "message": "Bearer token is missing or invalid" }}The token doesn’t have the scope this endpoint requires. error.code is forbidden.
Canonical error envelope. code is stable across releases and intended for programmatic handling; message is human-readable. details only appears for validation failures and lists the offending fields.
object
object
object
Example
{ "error": { "code": "forbidden", "message": "Token doesn't have the required scope" }}Resource doesn’t exist or is outside the token’s space allow-list. The two cases share a response shape so a restricted token can’t probe for the existence of out-of-scope spaces. error.code is not_found.
Canonical error envelope. code is stable across releases and intended for programmatic handling; message is human-readable. details only appears for validation failures and lists the offending fields.
object
object
object
Example
{ "error": { "code": "not_found", "message": "Not found" }}Rate limit exceeded. error.code is rate_limited. Wait the number of seconds in the Retry-After header before retrying. Quotas are per-token; see the “Rate limiting” section at the top of this document.
Canonical error envelope. code is stable across releases and intended for programmatic handling; message is human-readable. details only appears for validation failures and lists the offending fields.
object
object
object
Example
{ "error": { "code": "rate_limited", "message": "Rate limit of 1000 units per 60s exceeded (this request cost 5)" }}Headers
Section titled “Headers”Example
12Seconds to wait before retrying.