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.
<?php
// Set the API key and request parameters
$api_key = 'APIKEY';
$page_id = '102479591179005';
// Set the API endpoint
$url = 'https://api.scrapingdog.com/facebook/ads/?api_key=' . $api_key . '&page_id=' . $page_id;
// Initialize cURL session
$ch = curl_init($url);
// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute the cURL request
$response = curl_exec($ch);
// Check if the request was successful
if ($response === false) {
echo 'cURL error: ' . curl_error($ch);
} else {
// Process the response data as needed
echo $response;
}
// Close the cURL session
curl_close($ch);
require 'net/http'
require 'uri'
# Set the API key and request parameters
api_key = 'APIKEY'
page_id = '102479591179005'
# Construct the API endpoint URL
url = URI.parse("https://api.scrapingdog.com/facebook/ads/?api_key=#{api_key}&page_id=#{page_id}")
# Create an HTTP GET request
request = Net::HTTP::Get.new(url)
# Create an HTTP client
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true # Enable SSL (https)
# Send the request and get the response
response = http.request(request)
# Check if the request was successful
if response.is_a?(Net::HTTPSuccess)
puts response.body # Process the response data as needed
else
puts "HTTP request failed with code: #{response.code}, message: #{response.message}"
end
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
try {
// Set the API key and request parameters
String apiKey = "APIKEY";
String page_id = "102479591179005";
// Construct the API endpoint URL
String apiUrl = "https://api.scrapingdog.com/facebook/ads/?api_key=" + apiKey
+ "&page_id=" + page_id
// Create a URL object from the API URL string
URL url = new URL(apiUrl);
// Open a connection to the URL
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
// Set the request method to GET
connection.setRequestMethod("GET");
// Get the response code
int responseCode = connection.getResponseCode();
if (responseCode == 200) {
// Read the response from the connection
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuilder response = new StringBuilder();
while ((inputLine = reader.readLine()) != null) {
response.append(inputLine);
}
reader.close();
// Process the response data as needed
System.out.println(response.toString());
} else {
System.out.println("HTTP request failed with response code: " + responseCode);
}
// Close the connection
connection.disconnect();
} catch (IOException e) {
e.printStackTrace();
}
}
}
{
"ads": [
{
"ad_archive_id": "1451833693256257",
"page_id": "102479591179005",
"snapshot": {
"branded_content": null,
"page_id": "102479591179005",
"page_is_deleted": false,
"page_profile_uri": "https://facebook.com/agilefever",
"root_reshared_post": null,
"byline": null,
"disclaimer_label": null,
"page_name": "AgileFever",
"page_profile_picture_url": "https://scontent-phl2-1.xx.fbcdn.net/v/t39.35426-6/645763362_1241420054208437_1400942722396186234_n.jpg?stp=dst-jpg_s60x60_tt6&_nc_cat=109&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=kGPLPoPeM9MQ7kNvwGYGdvv&_nc_oc=AdoZ9FeiAkvkv6lLo_edyxhFGWI6r6twNpHCt_fFcaBfbC7oGlGZpFp_z2zR-znwA_g&_nc_zt=14&_nc_ht=scontent-phl2-1.xx&_nc_gid=XXKmnNUvX2jfPUbPfuHK1g&_nc_ss=73289&oh=00_Af4H3FRLWiOuCPFfcGb-BvJeCy9p7PO9IKNyrGcZ8T8J_g&oe=6A1CE096",
"event": null,
"caption": "agilefever.com",
"cta_text": "Learn more",
"cards": [
{
"body": "Join the top 1% of engineers who can actually put AI into production.",
"cta_type": "LEARN_MORE",
"caption": "agilefever.com",
"link_description": "Join the top 1% of engineers who can actually put AI into production.",
"link_url": "https://www.agilefever.com/bootcamps/mlops-bootcamp/",
"title": "From Software Engineer to MLOps Architect 🚀",
"cta_text": "Learn More",
"video_hd_url": null,
"video_preview_image_url": null,
"video_sd_url": null,
"watermarked_video_hd_url": null,
"watermarked_video_sd_url": null,
"image_crops": [],
"original_image_url": "https://scontent-phl2-1.xx.fbcdn.net/v/t39.35426-6/646313981_4360384810916665_9099797892930691372_n.jpg?_nc_cat=108&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=1mTtdvKWk2kQ7kNvwHo3ZXp&_nc_oc=Adq_VXXO38FMrlFFtZc5-HAN11qmiP86M_qjtPEO9LmLEdNywMK8RV7w2vUjrDJBYn4&_nc_zt=14&_nc_ht=scontent-phl2-1.xx&_nc_gid=XXKmnNUvX2jfPUbPfuHK1g&_nc_ss=73289&oh=00_Af72g74719xFKFqAxQXxrR1boFeTLD5GVGL-WHmoSHBoqQ&oe=6A1CB9F1",
"resized_image_url": "https://scontent-phl2-1.xx.fbcdn.net/v/t39.35426-6/646638311_897966893038610_8416632628881061211_n.jpg?stp=dst-jpg_s600x600_tt6&_nc_cat=106&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=VdzjvLBMzIcQ7kNvwHw-yrg&_nc_oc=AdqRXSi5PIQbgmz9yf35WK5BFJKC7YIbqYRn-LONR3en2bfx6EQycaTDLuG4r3NjN1w&_nc_zt=14&_nc_ht=scontent-phl2-1.xx&_nc_gid=XXKmnNUvX2jfPUbPfuHK1g&_nc_ss=73289&oh=00_Af7QQuDcYBqIdG-uuSsCPX99_1RkTQCXeKR8Gs7-CuI21g&oe=6A1CBD35",
"watermarked_resized_image_url": ""
},
{
"body": "Join the top 1% of engineers who can actually put AI into production.",
"cta_type": "LEARN_MORE",
"caption": "agilefever.com",
"link_description": "Join the top 1% of engineers who can actually put AI into production.",
"link_url": "https://www.agilefever.com/bootcamps/mlops-bootcamp/",
"title": "From Software Engineer to MLOps Architect 🚀",
"cta_text": "Learn More",
"video_hd_url": null,
"video_preview_image_url": null,
"video_sd_url": null,
"watermarked_video_hd_url": null,
"watermarked_video_sd_url": null,
"image_crops": [],
"original_image_url": "https://scontent-phl2-1.xx.fbcdn.net/v/t39.35426-6/646927756_1251100770326777_5598043279398185210_n.jpg?_nc_cat=107&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=xbxbXbDn2EgQ7kNvwE7jvLn&_nc_oc=AdoJLWsIOXC2kdw6qdn7oG_GHjtTPHtJSISHnNclJkhb5GXTIZQso6ih2eCc8JHm8PI&_nc_zt=14&_nc_ht=scontent-phl2-1.xx&_nc_gid=XXKmnNUvX2jfPUbPfuHK1g&_nc_ss=73289&oh=00_Af4ujX_WP-_yzOn72tPoZrbFaYRKJibWmLJzt5gjxyzJ6A&oe=6A1CCD7B",
"resized_image_url": "https://scontent-phl2-1.xx.fbcdn.net/v/t39.35426-6/645369087_2353670585044965_2218704528678595872_n.jpg?stp=dst-jpg_s600x600_tt6&_nc_cat=102&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=6htQyMkxvmcQ7kNvwFCXMyG&_nc_oc=AdqiYbRw8GHME-G5dZ1x0wCvctefX6Ue-CGQAOevJcnVZydzI2essqZIcQW4Eushy2I&_nc_zt=14&_nc_ht=scontent-phl2-1.xx&_nc_gid=XXKmnNUvX2jfPUbPfuHK1g&_nc_ss=73289&oh=00_Af56Z9wLOHUwxv1UA3ySTa1yL-c9MHkEVN7Eh1IGTeP8tA&oe=6A1CBB9C",
"watermarked_resized_image_url": ""
},
{
"body": "Join the top 1% of engineers who can actually put AI into production.",
"cta_type": "LEARN_MORE",
"caption": "agilefever.com",
"link_description": "Join the top 1% of engineers who can actually put AI into production.",
"link_url": "https://www.agilefever.com/bootcamps/mlops-bootcamp/",
"title": "From Software Engineer to MLOps Architect 🚀",
"cta_text": "Learn More",
"video_hd_url": null,
"video_preview_image_url": null,
"video_sd_url": null,
"watermarked_video_hd_url": null,
"watermarked_video_sd_url": null,
"image_crops": [],
"original_image_url": "https://scontent-phl2-1.xx.fbcdn.net/v/t39.35426-6/646614578_3380223628793906_3270121437360773425_n.jpg?_nc_cat=107&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=xZz9YHgNVzcQ7kNvwGZFJJZ&_nc_oc=AdpJOpGcDpI_vkrjGY2If8UzzxGBhy6Izly-urNzR1vG7N9Yxmi_OaqnPHH0RAnVWxY&_nc_zt=14&_nc_ht=scontent-phl2-1.xx&_nc_gid=XXKmnNUvX2jfPUbPfuHK1g&_nc_ss=73289&oh=00_Af6u7A4xOHRipGVhDpd8VA5hIJo94y6AF68hK7Dgj0kGlA&oe=6A1CCCF0",
"resized_image_url": "https://scontent-phl2-1.xx.fbcdn.net/v/t39.35426-6/645450604_1975098390058857_4510795847006939788_n.jpg?stp=dst-jpg_s600x600_tt6&_nc_cat=102&ccb=1-7&_nc_sid=c53f8f&_nc_ohc=l1_jZzOBchEQ7kNvwHGFBbB&_nc_oc=Adpe0_EaRprG7_2faJL0qekiNgl-r1Rtm2DkkfxB0jt3AQ_JzrPuKlnt9a1AJpPUS7w&_nc_zt=14&_nc_ht=scontent-phl2-1.xx&_nc_gid=XXKmnNUvX2jfPUbPfuHK1g&_nc_ss=73289&oh=00_Af4fIpzNAAgr-v4_cZLv6lcq4XAilh70e2Am7HdwQ_wRuQ&oe=6A1CC7AF",
"watermarked_resized_image_url": ""
}
],
"body": {
"text": "Stop building models that never leave the notebook. 🛑\n\nThe industry is shifting. While everyone is learning \"How to Prompt,\" the real architectural challenge is \"How to Scale.\" As a Software Engineer, you already have the foundation. Our MLOps Bootcamp gives you the missing pieces: CI/CD for ML, Model Monitoring, and automated retraining pipelines.\n\nGo from \"Developer\" to \"MLOps Architect\" and lead the AI transition in your company.\n\n✅ 100% Project-based learning\n✅ Master Docker, Kubernetes, & MLflow\n✅ Architecture patterns used by Netflix and Uber"
},
"cta_type": "LEARN_MORE",
"display_format": "CAROUSEL",
"link_description": null,
"link_url": "https://www.agilefever.com/",
"images": [],
"page_categories": [
"Education website"
],
"page_like_count": 416,
"title": "AgileFever",
"videos": [],
"is_reshared": false,
"extra_links": [
"https://www.agilefever.com/bootcamps/",
"https://www.agilefever.com/privacy/",
"https://www.agilefever.com/bootcamps/"
],
"extra_texts": [
{
"text": "Unlock Your Career Potential with AgileFever Bootcamps!"
},
{
"text": "Accelerate your career with AgileFever’s comprehensive bootcamps in agile, AI, data science, and more. Learn from industry experts through hands-on training designed for immediate impact. Sign up now to get personalized details and exclusive enrollment offers!"
},
{
"text": "Please provide your contact details so we can share exclusive information."
},
{
"text": "How many years of professional experience do you have?"
},
{
"text": "Fresher / No professional experience"
},
{
"text": "1 to 2 years"
},
{
"text": "2 to 5 years"
},
{
"text": "More than 5 years"
},
{
"text": "Full name"
},
{
"text": "Email"
},
{
"text": "Phone number"
},
{
"text": "Job title"
},
{
"text": "Terms and Conditions for AgileFever"
},
{
"text": "Visit AgileFever's Privacy Policy."
},
{
"text": "Thank you for your interest!"
},
{
"text": "We’ve received your info and will be in touch shortly with next steps."
}
],
"extra_images": [],
"extra_videos": [],
"country_iso_code": null,
"brazil_tax_id": null,
"additional_info": null,
"ec_certificates": []
},
"is_active": false,
"page_name": "AgileFever",
"categories": [
"UNKNOWN"
],
"collation_count": 1,
"end_date": 1773385200,
"gated_type": "ELIGIBLE",
"hide_data_status": "NONE",
"impressions_with_index": {
"impressions_text": null,
"impressions_index": -1
},
"publisher_platform": [
"FACEBOOK",
"INSTAGRAM",
"THREADS"
],
"start_date": 1772524800,
"total_active_time": null
},
...
]
}