GroundsocialDocs

API · Facebook

GET /facebook/ads/search

Search the Meta Ad Library by keyword: 30 ads a page with country, status, media, category, language, placement and date filters.

RequestGET /v1/facebook/ads/search
Operation idfacebook.ads.search
Cost2 credits, refunded if the call fails
AuthAPI key: Authorization: Bearer <key> or x-api-key.

Search the Meta Ad Library by keyword: 30 ads a page with country, status, media, category, language, placement and date filters.

Query parameters

NameTypeRequiredDescription
qstringyesKeyword or phrase. Example: running shoes.
search_type"keyword_unordered" | "keyword_exact_phrase"nokeyword_unordered (default: all the words, any order) or keyword_exact_phrase. One of keyword_unordered, keyword_exact_phrase.
countrystringnoISO 3166-1 alpha-2 country the ads reached (US, GB, DE…), or ALL (default).
status"active" | "inactive" | "all"noactive (default), inactive, or all. One of active, inactive, all.
media_type"all" | "image" | "video" | "meme" | "image_and_meme" | "none"noall (default), image, video, meme (image with text), image_and_meme, none (text only). One of all, image, video, meme, image_and_meme, none.
ad_type"all" | "political_and_issue_ads" | "housing" | "employment" | "credit" | "financial"noall (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_by"total_impressions" | "relevancy_monthly_grouped" | "total_active_time"nototal_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.
languagestringnoComma-separated ISO 639-1 languages of the ad text (en,es).
publisher_platformsstringnoComma-separated placements: facebook, instagram, audience_network, messenger, whatsapp, threads, oculus.
start_datestringnoYYYY-MM-DD: only ads delivered on or after this day.
end_datestringnoYYYY-MM-DD: only ads delivered on or before this day.
afterstringnoThe previous page’s page_info.end_cursor; keep the other filters the same.

Responses

StatusMeaningSchema
200A page of ads, with the next cursor.FacebookAdsPage
400Invalid input. Nothing was charged.Error
401Missing or invalid API key.Error
402Not enough credits, a spend cap was reached, or payment is required.Error
403The target is private, or the account is suspended.Error
404The ad, Page or advertiser is not in the Meta Ad Library.Error
429Too many requests. Wait for Retry-After seconds.Error
503Facebook is temporarily unavailable. Retryable; nothing was charged.Error

FacebookAdsPage fields

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

Errors use one shape everywhere; see Errors for every code and what to do.