Back to Articles

How to use the Meta ad library API to find ad data?

By Shash7. Posted under guides Posted on 23rd Jul, 2025 - Updated on 24th Jul, 2025

How to use the Meta ad library API to find ad data? - Blog post banner image for Swipekit

Using the Meta API for direct access means you can play with the API and write code that quickly fetches results for specific ads.

It's especially helpful for:

  • Bulk fetching ad data

  • Accessing additional metadata available for EU-based ads

Using the Meta API directly, you can also access bulk ad data and throw the data inside chatGPT using JSON context profiles and chat with the data.

Before we start off, there's one big caveat: the api only works for ads running in the European Union(and UK)

That's right. Facebook won't give you access to ads from non-EU contries. This is because the EU mandated api access. As far as I know, you cannot fetch ads running in any other country.

What data access is available?

Technically Meta give out 3 ways to access their data(apart from the Ad library):

Reports: These are more so for researchers. You can narrow down by advertiser(brand) and date range and Meta will give you a csv of data. However in practice I haven't found it much useful since it doesn't give out data for non-political/social issue brands.

API: We're gonna focus on this today, stay tuned!

Branded content: This is for finding influencer posts, eg content creator in collaboration with brand promoted x. This deserves its own topic.

 

Meta ad library data

For our usecase, we're gonna use the API access today. Let's get started!

Getting access to the Meta API

To start using the Meta API, you'll need two things.

1. A app inside the Meta developers console. You can get started from here.

2. Verify your identity. This is only a requirement to access the API endpoints required for the ad library.

Technically it doesn't matter what steps you do this in, however I recommend you get started with creating your Meta app first as that can be daunting for first time users.

How to create a Meta app for Ad library access

First, head over to the https://developers.facebook.com/apps/ and click on 'Create App' in the top right corner.

Meta create app process

It doesn't matter much what details you enter. In the usecases section, you can put down 'Create app without a usecase'.

Your app type can be consumer.

How to verify your identity for ad library API access

Head over to the verification page and start your verification process.

You'll be asked to give proof a identification, eg, driver's license. Upload the file and within a few days you'll be given access(I believe it took me a few hours)

Meta ad library verification

Once you complete these steps, you'll have access to the ad library specific API endpoints!


To verify if you have access, head over the the Fb graph explorer tool and set your app in the sidebar.

Then enter a query, for example: ads_archive?ad_reached_countries=AU&search_terms=sand

Then enter ads/library/ and click on 'Send'. If something comes up in the middle of the screen, you're good.

Check Meta ad library access via the Graph API tool

For the next steps, you'll need a access token. For now you can utilize the access token provided inside the Graph explorer page(the one above the 'Generate Access Token' button.

Working with the Meta API

Ok now comes the hard part. The ad library api is extremely wonky to work with. Notably, there's one major shortcoming - you can't search by ad's id.

Luckily there's a workaround. Let's cover some basic ground first.

Create a wrapper to work with the API

I highly recommend this since working with the ad library is so crummy. I've created a simple wrapper around the ad library here.

Since the API is ergonomically challenged, I highly recommend creating a wrapper around this.

Using the Graph Explorer

The Graph Explorer lets you quickly test API calls:

  1. Visit the Graph Explorer.

  2. Select your app from the top-right dropdown.

  3. Enter your query and test it immediately.

Note: The Graph Explorer UI is not user-friendly. Expect:

  • Slow responses

  • Limited error messaging

  • Clunky navigation

Searching for a brand’s ads

To search ads from a brand, use the following request:

GET /ads_archive?search_terms={brand name}&ad_type=POLITICAL_AND_ISSUE_ADS
  • Replace {brand name} with your target brand

  • Adjust the ad_type if necessary

Fetching a specific ad

There's no direct endpoint to get a specific ad by its ID. Instead:

  • Fetch all ads from the page using:

    GET /{pageId}/ads
    
  • Loop through results until you find the matching ad_id.

Example approach:

GET /{pageId}/ads?fields=id,creative

// Loop through ads in response
// Check ad.id against your target ad_id

Final thoughts

The Meta API is powerful but has its quirks. Be ready to handle pagination and work around some limitations like fetching specific ads directly.

Despite this, it’s an invaluable tool for marketers handling large-scale ad analysis.


The easiest way to find & save winning Ads

Get started today and see how easy it is to save Ads.

14 Day Free Trial Priority Support Ads are stored forever
Start Saving Ads today!
Swipekit Ad library Ads