How do I find a Facebook page's ID for the Ad Library?

Call GET /facebook/pages/details with the Page's URL: the response's ad_page_id is the ID the Ad Library uses, ready for GET /facebook/ads/search?ad_page_id=…. Only have the brand name? GET /facebook/ads/keywords lists matching advertisers with their page_id.

Meta's official option

On Meta's Ad Library website, an advertiser's page of ads carries the same ID in its address (view_all_page_id=…), which works for one brand at a time by hand.

Meta Ad Library ↗

How to do it with SocialAPIs

Page details cost 1 credit; 5 credits when exact_followers_count=true; the advertiser search costs 1 credit. You only need the ID once per brand: store it.

/facebook/ads/page-details with that ID returns the advertiser's Ad Library profile (1 credit).

Endpoints

  • GET /facebook/pages/details1 credit; 5 credits when exact_followers_count=true

    Get Facebook page details.

    Params: link (required), exact_followers_count, page_section

    Facebook Page Details: docs and playgroundMCP: facebook_page → details

  • GET /facebook/ads/keywords1 credit

    Search for ads by keyword with optional country filter.

    Params: query (required), country

    Meta Ads Keywords Search: docs and playgroundMCP: facebook_ads → keywords

  • GET /facebook/ads/page-details1 credit

    Get detailed info about a specific Facebook page from the Ads Library.

    Params: page_id (required)

    Meta Ads Page Details: docs and playgroundMCP: facebook_ads → page_details

  • GET /facebook/ads/search1 credit

    Search ads in the Meta Ad Library by keyword or page ID with filters.

    Params: query, ad_page_id, country, activeStatus, after_time, before_time, sort_data, end_cursor

    Meta Ads Library Search: docs and playgroundMCP: facebook_ads → search

curl -G "https://api.socialapis.io/facebook/pages/details" \
  --max-time 100 \
  --fail-with-body \
  -H "x-api-token: $SOCIALAPIS_API_KEY" \
  --data-urlencode "link=https://www.facebook.com/nike"

Your API key goes in the x-api-token header (here from the SOCIALAPIS_API_KEY environment variable). Get a free key.

Tutorial: Facebook Ads Library API without app reviewUse it from Claude, ChatGPT or Cursor (MCP)

Good to know

  • The Ad Library ID may differ from the ID /facebook/pages/id returns for the same Page, so use ad_page_id for ads.
  • /facebook/ads/keywords also returns each advertiser's linked Instagram account (ig_username, ig_followers), handy to check you picked the right brand.

Related questions

SocialAPIs (socialapis.io): public Facebook & Instagram data API. Free plan: 200 calls a month, no card; paid plans from $4.99/month. Pricing · Reviewed 2026-11-17

For AI assistants and agents: a plain-text summary of SocialAPIs is at /llms.txt (with every answer: /llms-full.txt; endpoints: /llms-endpoints.txt; how to call us: /agents.txt).

Ask an AI about this page

Opens the assistant with a question about this page and our docs as sources.