Ad libraries

The Meta Ad Library API: what it returns, and what it does not

If you want Meta ads as data rather than web pages, the first thing you find is the official Ad Library API. But it does not return everything the web library shows, and its biggest gap concerns the Gulf. Here is a practical guide for developers and marketers.

The Meta Ad Library API: what it returns, and what it does not
In this article
  1. What is the Ad Library API?
  2. What does the API cover?
  3. How to get access
  4. The key fields it returns
  5. Limits to know before you build on it
  6. An alternative for Gulf commercial ads

Key takeaways

  • The API returns ads about social issues, elections or politics in every country, and every ad delivered in the European Union.
  • Commercial ads in Saudi Arabia and the Gulf are not available through the API, even though the web library shows them.
  • Access requires a Meta developer account and identity confirmation, then an access token to call the ads_archive endpoint.
  • For commercial ad data in the Gulf you need a tool that collects it from the public library, such as GccFY.

What is the Ad Library API?

An official Meta API that lets you search the Ad Library from your own code instead of a browser: you send search terms, countries and other filters, and get ads back as JSON, with fields such as the ad copy, the Page name, delivery start and stop dates, and platforms. Meta built it for transparency and research.

What does the API cover?

Ad typeWeb libraryAPI
Social issue, election or political ads (all countries)Yes, 7 yearsYes, with spend and reach
All ads delivered in the European UnionYes, one year after last impressionYes, with reach and audience data
Branded content (paid partnerships)YesFor authorised users
Commercial ads in the GulfYes, active onlyNo

In other words: a perfume store's ad in Riyadh shows up at facebook.com/ads/library, but the API will not return it. That gap is why tools like GccFY exist.

How to get access

  1. Create a developer account on Meta for Developers.
  2. Confirm your identity and location as Meta requires (this may involve an ID document).
  3. Create an app and generate an access token.
  4. Call the ads_archive endpoint of the Graph API with your search parameters.

An example request for ads in a European country (commercial ads outside Europe will not come back):

GET https://graph.facebook.com/v<version>/ads_archive
  ?search_terms=perfume
  &ad_type=ALL
  &ad_reached_countries=['FR']
  &fields=page_name,ad_creative_bodies,ad_delivery_start_time,ad_snapshot_url,publisher_platforms
  &access_token=<token>

The key fields it returns

  • page_name and page_id: the advertiser.
  • ad_creative_bodies and ad_creative_link_titles: the copy and the link title.
  • ad_delivery_start_time and ad_delivery_stop_time: the delivery period, from which you get running time.
  • ad_snapshot_url: a link that renders the ad, instead of the image and video files.
  • publisher_platforms and languages: platforms and languages.
  • For political ads: spend and impression ranges, and their split by age, gender and region.
  • For EU ads: total reach and its breakdown, targeting, and the beneficiary and payer.

Limits to know before you build on it

  • No commercial ads outside Europe: the biggest limit for anyone working in the Gulf.
  • No direct media files: you get a link that renders the ad, not the image or video file.
  • Rate limits: each app has a request budget, and heavy use gets throttled.
  • Tokens expire: access tokens have a lifetime and need renewing.
  • Terms of use: Meta has terms on how this data may be used; read them before any commercial project.

An alternative for Gulf commercial ads

If your goal is to follow commercial ads in Saudi Arabia and the Gulf, the official API will not do. GccFY collects the Arabic ads of Gulf stores from the public library every day and keeps them after they stop, with running time, store platform and a snapshot of the landing page: 780,000+ ads from 69,000+ advertisers.

GccFY: Gulf commercial ads with filters for country, store, ad type and running time.
GccFY: Gulf commercial ads with filters for country, store, ad type and running time.

For specific data needs, contact us.

Frequently asked questions

Is the Meta Ad Library API free?
Yes. Access is free once you create a developer account and confirm your identity, with limits on the number of requests.
Can I get Saudi commercial ads through the API?
No. The API returns commercial ads delivered in the European Union only, plus social issue, election and political ads in every country.
Does the API return ad budgets?
Only for social issue, election and political ads, as approximate ranges. Commercial ads come with no budgets.
Can I download ad images and videos from the API?
The API returns a link that renders the ad (ad_snapshot_url), not the media files themselves.
What is the alternative for Gulf commercial ad data?
Tools that collect ads from the public library and organise them, such as GccFY, which specialises in Arabic ads in the six Gulf markets.

Start today, and build your next campaign on an ad that wins

Your free account is ready in a minute.