Query Facebook Ad Library programmatically
Obtain structured JSON data of Meta ads and associated store information via API, enabling automated competitor ad research without manual browsing.
How it works
Read-onlyResearch and knowledge
The agent utilizes the AdLibrarySpy MCP server to access the Facebook Ad Library API. It constructs queries to retrieve specific ad creatives, advertiser details, and landing page data. The agent parses the returned JSON to extract key metrics such as ad longevity and creative elements, providing a programmatic alternative to manual ad spying.
Prompt
Paste this into an agent that has the servers below connected. Adjust the names and dates to your own.
Prompt for Query Facebook Ad Library programmatically
Use the AdLibrarySpy MCP server to query the Facebook Ad Library API. Retrieve data for ads related to 'wireless headphones' and return the results in JSON format, including advertiser names and creative details.MCP servers it needs
Source
The vendor page this playbook is drawn from, and the passage that supports it.
Facebook Ad Library API: free programmatic access (2026) Query Meta ads and store data programmatically — free MCP + JSON.Guides: Facebook ad spying and ecommerce intelligence — AdLibrarySpy