curl --request GET \
--url https://api.example.com/api/v1/ad-library/platform-counts \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/api/v1/ad-library/platform-counts"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/api/v1/ad-library/platform-counts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/ad-library/platform-counts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/ad-library/platform-counts"
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(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/ad-library/platform-counts")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/ad-library/platform-counts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"generated_at": "2023-11-07T05:31:56Z",
"total_ads": 0,
"platforms": [
{
"platform": "<string>",
"total_ads": 0
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Get Global Ad Library Platform Counts
Per-platform ad counts for the Explore pill bar.
Library-wide by default — Explore browses the complete ad library, so its
pill counts must cover every advertiser. Pass advertiser_id to scope
the pills to one brand (the Full Brand Page ads grid). Each platform’s
count uses the same filter semantics /search applies for that platform
value.
Brand Library tenancy applies to the SCOPED call only (finding M6). An
advertiser_id arrives from the query string with nothing vouching for
it — the same client-supplied-id shape as finding C2 — and the answer is
a precise fact about one brand (“47 Facebook ads”), so an id the caller
cannot see 404s exactly like the advertiser detail route.
The library-wide call is deliberately NOT filtered. Its answer is an
aggregate over the whole library, identical for every caller, which is
what lets cached_platform_counts key on advertiser_id alone; a
per-caller predicate would make the cache per-caller and cost a query on
the hottest Explore call to hide a number nobody can attribute to a
brand. The consequence is honest and bounded: the library-wide total can
exceed what a filtered /search returns.
curl --request GET \
--url https://api.example.com/api/v1/ad-library/platform-counts \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/api/v1/ad-library/platform-counts"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/api/v1/ad-library/platform-counts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/ad-library/platform-counts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/ad-library/platform-counts"
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(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/ad-library/platform-counts")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/ad-library/platform-counts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"generated_at": "2023-11-07T05:31:56Z",
"total_ads": 0,
"platforms": [
{
"platform": "<string>",
"total_ads": 0
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Response
Successful Response
Library-wide per-platform ad counts for the Explore pill bar.
Per-platform counts use the search's own platform-filter semantics
(a Facebook+Instagram ad counts under both pills); total_ads is the
distinct library-wide count, so the platform rows intentionally don't
sum to it.
Was this page helpful?