100 free credits. No credit card required. Get a key

Facebook Ad Library company ads API

Every ad one advertiser (a Facebook Page) runs or has run in the Meta Ad Library, 30 a page, with the same filters as search. Pass the Page id, its URL or vanity name, or just the company name.

GET /v1/facebook/ads/companyBeta2 credits per callRefunded on failure
import os, requests

res = requests.get(
    "https://api.groundsocial.dev/v1/facebook/ads/company?page=nike&status=active",
    headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()
Response
200 · 2 credits
{
"ads": [
{
"ad_archive_id": "1702938977100376",
"page_id": "15087023444",
"page_name": "Nike",
"is_active": true,
"start_date": 1744009200,
"end_date": 1795507200,
"publisher_platform": [
"FACEBOOK",
"INSTAGRAM",
"… 2 more"
],
"collation_count": null,
"collation_id": null,
"categories": [
"UNKNOWN"
],
"currency": "",
"spend": null,
"impressions_with_index": {
"impressions_text": null,
"impressions_index": -1
},
"reach_estimate": null,
"…": "16 more fields"
},
{
"ad_archive_id": "1057679207068133",
"page_id": "15087023444",
"page_name": "Nike",
"is_active": true,
"start_date": 1788159600,
"end_date": 1795507200,
"publisher_platform": [
"FACEBOOK",
"INSTAGRAM",
"… 1 more"
],
"collation_count": null,
"collation_id": null,
"categories": [
"UNKNOWN"
],
"currency": "",
"spend": null,
"impressions_with_index": {
"impressions_text": null,
"impressions_index": -1
},
"reach_estimate": null,
"…": "16 more fields"
},
"… 2 more"
],
"count": 14726,
"page_info": {
"has_next_page": true,
"end_cursor": "AQHTJv-Mqo-slQJ7WfNOmRiV6v0bUYhad318wL6WhbOznsuAvQeSDJW5CHoW-pg9DrWW"
}
}

Parameters

NameTypeDescription
pagequerystringPage id, Page URL or vanity name. Example: 15087023444.
company_namequerystringAdvertiser name, when you don’t have the Page. Example: Nike.
countryquerystringISO 3166-1 alpha-2 country the ads reached (US, GB, DE…), or ALL (default).
statusquery"active" | "inactive" | "all"active (default), inactive, or all. One of active, inactive, all.
media_typequery"all" | "image" | "video" | "meme" | "image_and_meme" | "none"all (default), image, video, meme (image with text), image_and_meme, none (text only). One of all, image, video, meme, image_and_meme, none.
ad_typequery"all" | "political_and_issue_ads" | "housing" | "employment" | "credit" | "financial"all (default), or one of Meta’s special ad categories: political_and_issue_ads, housing, employment, credit, financial. One of all, political_and_issue_ads, housing, employment, credit, financial.
sort_byquery"total_impressions" | "relevancy_monthly_grouped" | "total_active_time"total_impressions (default, high to low), relevancy_monthly_grouped (most recent), or total_active_time (longest-running first, within each page of 30). One of total_impressions, relevancy_monthly_grouped, total_active_time.
languagequerystringComma-separated ISO 639-1 languages of the ad text (en,es).
publisher_platformsquerystringComma-separated placements: facebook, instagram, audience_network, messenger, whatsapp, threads, oculus.
start_datequerystringYYYY-MM-DD: only ads delivered on or after this day.
end_datequerystringYYYY-MM-DD: only ads delivered on or before this day.
afterquerystringThe previous page’s page_info.end_cursor; keep the other filters the same.
Response fields

200 with a FacebookAdsPage, in Facebook’s own JSON.

FieldTypeDescription
adsFacebookAd[]
countinteger | nullMeta’s estimate of how many ads match, on the first page (null on later pages). Meta caps it at 50,001.
page_infoobject
Status codes
StatusMeaning
200A page of the advertiser’s ads, with the next cursor.
400Invalid input. Nothing was charged.
401Missing or invalid API key.
402Not enough credits, a spend cap was reached, or payment is required.
403The target is private, or the account is suspended.
404The ad, Page or advertiser is not in the Meta Ad Library.
429Too many requests. Wait for Retry-After seconds.
503Facebook is temporarily unavailable. Retryable; nothing was charged.

Every error has code, message, hint and retryable. All error codes

Questions

Page or company name?

A Page id is exact. A company name is matched through the Ad Library’s own advertiser search, so check page_id on the ads, or resolve it first with the advertiser search endpoint.

Facebook is a trademark of Meta Platforms, Inc. We are not affiliated with or endorsed by Meta.