Platforms · Facebook

Facebook Ad Library Search Ads Scraper API

Searches the Facebook Ad Library for ads matching a keyword. Returns matching ads with creative text, images, sponsor info, and status.

GET /api/v1/data/facebook/adlibrary-search-ads · 5 credits per page · The same call repeated within 2 minutes may get the same answer, so data can be up to 2 minutes old.

Inputs

  • query (required): Search keyword or phrase to find ads in the Facebook Ad Library
  • sort_by: Sort by impressions (high to low), or Most Recent (relevancy_monthly_grouped). Defaults to impressions.
  • search_type: If you want to search by exact phrase or not
  • ad_type: Search for all ads or only political and issue ads
  • country: This can only be one country. It has to be the 2 letter code for the country. It defaults to ALL.
  • status: Status of the ad. Defaults to ACTIVE.
  • media_type: Media type of the ad. Defaults to ALL. Meme just means the ad has text and an image. No clue why they call it meme.
  • start_date: Impressions start date. Needs to be in YYYY-MM-DD format.
  • end_date: Impressions end date. Needs to be in YYYY-MM-DD format.
  • cursor: Leave it out for the first page. For the next page, send next_cursor from the previous answer.
  • trim: Set to true for a trimmed down version of the response

What comes back

  • result_status (string): success, or not_available when the item does not exist, was removed or is not public.
  • items[].ad_archive_id (string): The ad's id in the Ad Library.
  • items[].ad_id (string)
  • items[].categories (array): The ad's categories, such as `UNKNOWN`.
  • items[].collation_count (integer): How many ads share this creative.
  • items[].collation_id (string): The id of the group of ads that share a creative.
  • items[].contains_digital_created_media (boolean): Whether the ad contains digitally created media.
  • items[].contains_sensitive_content (boolean): Whether Facebook marks the ad as sensitive content.
  • items[].currency (string): The currency of `spend`. Empty when the ad reports no spend.
  • items[].end_date (number): When the ad ended or will end, as Unix seconds.
  • items[].end_date_string (string): When the ad ended or will end, as ISO 8601.
  • items[].fev_info (any): Null in every sample, so its shape is not on record.
  • items[].gated_type (string): Whether Facebook restricts the ad, such as `ELIGIBLE`.
  • items[].has_user_reported (boolean): Whether a user reported the ad.
  • items[].hide_data_status (string): Whether Facebook hides the ad's data, such as `NONE`.
  • items[].impressions_with_index (object): How many people saw the ad, as Facebook shows it.
  • items[].impressions_with_index.impressions_index (integer): The impressions range as a rank. -1 when Facebook shows none.
  • items[].impressions_with_index.impressions_text (string): The impressions range as text, or null when Facebook shows none.
  • items[].is_aaa_eligible (boolean): Whether the ad is eligible for the Ad Library's extra transparency data.
  • items[].is_active (boolean): Whether the ad is running now.
  • items[].menu_items (array): Menu items Facebook shows on the ad.
  • items[].page_id (string): The advertiser Page's id.
  • items[].page_is_deleted (boolean): Whether the Page has been deleted.
  • items[].page_name (string): The advertiser Page's name.
  • items[].publisher_platform (array): Where the ad runs, such as `FACEBOOK` and `INSTAGRAM`.
  • items[].reach_estimate (any): It is set only on ads Facebook reports reach for, and no sample shows one.
  • items[].regional_regulation_data (object): Flags for regional ad rules.
  • items[].regional_regulation_data.finserv (object): The financial services rule.
  • items[].regional_regulation_data.finserv.is_deemed_finserv (boolean): Whether Facebook treats the ad as a financial service ad.
  • items[].regional_regulation_data.finserv.is_limited_delivery (boolean): Whether delivery of the ad is limited under that rule.
  • items[].regional_regulation_data.tw_anti_scam (object): Taiwan's anti-scam rule.
  • items[].regional_regulation_data.tw_anti_scam.is_limited_delivery (boolean): Whether delivery of the ad is limited under Taiwan's anti-scam rule.
  • items[].report_count (integer)
  • items[].snapshot (object): The ad as it was shown: the Page, the text, the button and the media.
  • items[].snapshot.additional_info (any): Null in every sample, so its shape is not on record.
  • items[].snapshot.body (object): The ad's main text.
  • items[].snapshot.body.text (string): The ad's text.
  • items[].snapshot.branded_content (object): The brand the ad is a paid partnership with, or null for an ad that is not branded content.
  • items[].snapshot.branded_content.page_id (string): The advertiser Page's id.
  • items[].snapshot.branded_content.page_is_deleted (boolean): Whether the Page has been deleted.
  • items[].snapshot.branded_content.page_name (string): The Page's name.
  • items[].snapshot.branded_content.page_profile_uri (string): The Page's link.
  • items[].snapshot.brazil_tax_id (string): The advertiser's Brazilian tax id, or null.
  • items[].snapshot.byline (string): The `paid for by` line, or null when the ad has none.
  • items[].snapshot.caption (string): The ad's caption, usually the website it points to.
  • items[].snapshot.cards (array): The cards of a carousel or dynamic ad. Empty for a single-creative ad.
  • items[].snapshot.cards.body (string): The card's text.
  • items[].snapshot.cards.caption (string): The card's caption, usually the website it points to.
  • items[].snapshot.cards.cta_text (string): The card's button text.
  • items[].snapshot.cards.cta_type (string): The card's button type, such as `LEARN_MORE`.
  • items[].snapshot.cards.image_crops (array): The crops of the card's image.
  • items[].snapshot.cards.link_description (string): The text under the card's link.
  • items[].snapshot.cards.link_url (string): Where the card's button leads.
  • items[].snapshot.cards.original_image_url (string): A link to the card's image at full size.
  • items[].snapshot.cards.resized_image_url (string): A link to the card's image, resized.
  • items[].snapshot.cards.title (string): The card's headline.
  • items[].snapshot.cards.video_hd_url (string): A link to the high-definition video. The link expires.
  • items[].snapshot.cards.video_preview_image_url (string): A link to the video's preview image.
  • items[].snapshot.cards.video_sd_url (string): A link to the standard-definition video. The link expires.
  • items[].snapshot.cards.watermarked_resized_image_url (string): A link to the resized image with Facebook's watermark. Often empty.
  • items[].snapshot.cards.watermarked_video_hd_url (string): A link to the high-definition video with Facebook's watermark, or null when there is none.
  • items[].snapshot.cards.watermarked_video_sd_url (string): A link to the standard-definition video with Facebook's watermark, or null when there is none.
  • items[].snapshot.country_iso_code (string): The ISO 3166-1 alpha-2 country the advertiser registered in, or null.
  • items[].snapshot.cta_text (string): The ad's button text.
  • items[].snapshot.cta_type (string): The ad's button type, such as `APPLY_NOW`.
  • items[].snapshot.disclaimer_label (string): The disclaimer Facebook shows on the ad, or null.
  • items[].snapshot.display_format (string): The ad's format, such as `VIDEO`, `IMAGE`, `DCO` or `CAROUSEL`.
  • items[].snapshot.ec_certificates (array): Certificates the advertiser filed for the ad.
  • items[].snapshot.event (any): Null in every sample, so its shape is not on record.
  • items[].snapshot.extra_images (array): Further images in the ad.
  • items[].snapshot.extra_links (array): Further links in the ad.
  • items[].snapshot.extra_texts (array): Further texts in the ad.
  • items[].snapshot.extra_videos (array): Further videos in the ad.
  • items[].snapshot.images (array): The ad's images.
  • items[].snapshot.is_reshared (boolean): Whether the ad reshares a post.
  • items[].snapshot.link_description (string): The text under the ad's link.
  • items[].snapshot.link_url (string): Where the ad's button leads.
  • items[].snapshot.page_categories (array): The Page's categories.
  • items[].snapshot.page_id (string): The advertiser Page's id.
  • items[].snapshot.page_is_deleted (boolean): Whether the Page has been deleted.
  • items[].snapshot.page_like_count (number): The Page's likes.
  • items[].snapshot.page_name (string): The Page's name.
  • items[].snapshot.page_profile_picture_url (string): A link to the Page's picture.
  • items[].snapshot.page_profile_uri (string): The Page's link.
  • items[].snapshot.root_reshared_post (any): Null in every sample, so its shape is not on record.
  • items[].snapshot.title (string): The ad's headline.
  • items[].snapshot.videos (array): The ad's videos.
  • items[].snapshot.videos.video_hd_url (string): A link to the high-definition video. The link expires.
  • items[].snapshot.videos.video_preview_image_url (string): A link to the video's preview image.
  • items[].snapshot.videos.video_sd_url (string): A link to the standard-definition video. The link expires.
  • items[].snapshot.videos.watermarked_video_hd_url (string): A link to the high-definition video with Facebook's watermark, or null when there is none.
  • items[].snapshot.videos.watermarked_video_sd_url (string): A link to the standard-definition video with Facebook's watermark, or null when there is none.
  • items[].spend (any): It is set only on ads Facebook reports spend for, and no sample shows one.
  • items[].start_date (number): When the ad started, as Unix seconds.
  • items[].start_date_string (string): When the ad started, as ISO 8601.
  • items[].state_media_run_label (string): The label Facebook shows on state-run media, or null.
  • items[].targeted_or_reached_countries (array): The countries the ad targeted or reached. Empty when Facebook shows none.
  • items[].total_active_time (number): How long the ad has been active, in seconds.
  • items[].url (string): The ad's link in the Ad Library.
  • next_cursor (string): Send it as cursor to get the next page; null when there is none.
  • has_more (boolean): Whether there is another page.
  • source_data (object): Everything the platform sent for this call, as it came.

Good to know

  • Each page costs 5 credits. A call that finds nothing, or fails, is free.
  • Each call returns one page of about 10 rows. To get the next page, send next_cursor from the answer as cursor.
  • The same call repeated within 2 minutes may get the same answer, so data can be up to 2 minutes old.

Example call

GET /api/v1/data/facebook/adlibrary-search-ads?query=artificial+intelligence&trim=true

Questions

How much does the Facebook Ad Library Search Ads API cost?

Each page costs 5 credits. A call that finds nothing, or fails, costs nothing.

What do I send?

You must send query. 9 more inputs are optional: sort_by, search_type, ad_type, country, status, media_type, start_date, end_date and trim. Inputs go in the query string of a GET, or as JSON in a POST, along with your API key.

How do I get the next page?

Each call returns one page of about 10 rows. The answer carries next_cursor: send it back as cursor to get the page after. Each page is charged on its own, and an empty page is free.

How fresh is the data?

The same call repeated within 2 minutes may get the same answer, so data can be up to 2 minutes old.

Do I need a Facebook account or developer app?

No. You call SocialHz with your SocialHz API key, and the same key works for every platform.

Can I try it before paying?

Yes. Signing up gives you 10 free credits, with no card needed.

Related Facebook endpoints

More Facebook scraper APIs