Facebook Ads Scraper API

With our dedicated Tiktok Ads Scraper API, you can scrape Ads listings from TikTok.

Each successful request will cost you 5 API credits.

You have to send a GET request to http://api.scrapingdog.com/facebook/ads with the below-given parameters.

Parameters

Scrapingdog Parameters

Parameter
Description

api_key

required

Your personal API key. Available on your dashboard Type: String

Search Query

Parameter
Description

page_id

Facebook Page ID used to fetch ads from a specific Facebook page. When this is provided, the API searches ads by page instead of keyword. Type: String

query

Search keyword or phrase used to find matching ads in the Facebook Ads Library. Required when page_id or url is not provided. Type: String

url

Full Facebook Ads Library URL. If provided, the API extracts supported search parameters from the URL automatically, such as q as query and view_all_page_id as page_id. This is useful when users already have a Facebook Ads Library search URL and want to scrape the same results without manually passing each parameter. Type: String

Geographic Location and Localization

Parameter
Description

location_id

Location identifier used to filter ads by a specific city, region, or country. This must be used together with location_name and location_type. Type: String

location_name

Name of the location used in the location filter, such as a city, region, or country name. Required when using location_id. Type: String

location_type

Type of location filter. Accepted values are CITY, REGION, and COUNTRY. Required when using location filters. Type: String

country

Country code used to filter ads by country. Default value is ALL. Example: US, IN, GB. Type: String

content_language

Filters ads by the language of the ad content. Pass the language code supported by Facebook Ads Library. Type: String

Filters

Parameter
Description

ad_type

Type of ads to return. Default value is ALL. Accepted values are ALL, POLITICAL_AND_ISSUE_ADS, HOUSING, EMPLOYMENT, and CREDIT. Type: String

active_status

Filters ads by their current status. Default value is ALL. Accepted values are ALL, ACTIVE, and INACTIVE. Type: String

media_type

Filters ads by creative media type. Default value is ALL. Accepted values are ALL, VIDEO, and IMAGE. Type: String

platforms

Comma-separated list of platforms where the ads are running. Accepted values are facebook, instagram, messenger, and audience_network. Example: facebook,instagram. Type: String

is_targeted_country

Boolean value used to apply targeted country filtering. In your code, this is automatically treated as true when a specific country or location filter is used. Type: String

Date Range

Parameter
Description

start_date

Filters ads that started running on or after this date. Use ISO date format: YYYY-MM-DD. Type: String

end_date

Filters ads that started running on or before this date. Use ISO date format: YYYY-MM-DD. Type: String

Pagination

Parameter
Description

next_page_token

Pagination token used to fetch the next page of ad results. Pass the token returned in the previous response to continue scraping from where the last request ended. Type: String

The next_page_token can get very large when you get deeper into pages. Due to this, NGINX can reject the request because the URI is getting too large. Users can also use the POST API with same endpoint and pass all these parameters as a body.

API Example

API Response

Last updated