# TikTok Ad Library Scraper (`pulsedata/tiktok-ad-library-scraper`) Actor

Extract ads from TikTok's Commercial Content Library: advertiser, ad video, run dates, reach and the targeting behind every ad shown in Europe.

- **URL**: https://apify.com/pulsedata/tiktok-ad-library-scraper.md
- **Developed by:** [PulseData](https://apify.com/pulsedata) (community)
- **Categories:** Marketing, Lead generation, Social media
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 ad scrapeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## TikTok Ad Library Scraper

Extract ads from TikTok's official [Commercial Content Library](https://library.tiktok.com/ads) – the ad repository TikTok publishes for Europe. Search by **advertiser or by what the ad says** and get the advertiser, the ad video, the run dates, how many people saw it and the ad's category, as structured JSON.

**$1.50 per 1,000 ads, plus $0.01 per run.** No TikTok account, no cookies, no login.

### What you get

| Field | Description |
|---|---|
| `adId`, `url` | TikTok's ad ID and a link to the ad in the library |
| `advertiserName` | The account that runs the ad |
| `title` | The ad's caption, hashtags included |
| `subject` | TikTok's category for the ad, e.g. "Apparel & Accessories" |
| `firstShown`, `lastShown`, `daysShown` | When the ad ran and for how many days |
| `estimatedAudience` | TikTok's estimate of unique users who saw it, as a range (`0-1K`, `1K-10K`, `10K-100K`, …) |
| `impressions`, `spent` | Reported where TikTok publishes them |
| `videoUrl`, `coverImageUrl`, `videoUrls`, `imageUrls` | The creative itself – a direct MP4 link and the cover image |
| `adStatus`, `rejectionInfo` | Whether the ad was approved, rejected or is under review, with TikTok's reason |

Example item:

```json
{
  "adId": "1876613526161602",
  "url": "https://library.tiktok.com/ads/detail/?ad_id=1876613526161602&region=DE",
  "advertiserName": "Unisport A/S",
  "title": "#sneakers #custom #nike",
  "subject": "Apparel & Accessories",
  "firstShown": "2026-09-17",
  "lastShown": "2026-09-19",
  "daysShown": 3,
  "estimatedAudience": "10K-100K",
  "videoUrl": "https://library.tiktok.com/api/v1/cdn/…/video/…mp4",
  "coverImageUrl": "https://p16-common-sign.tiktokcdn.com/…",
  "adStatus": "approved",
  "region": "DE"
}
```

### Use cases

- **Competitor ad tracking** – which videos a brand is running right now, how long each has been live and how big the audience got. Long-running ads are usually the ones that work.
- **Creative research** – download the actual ad videos for a swipe file or to analyse hooks, formats and lengths.
- **Category and market overview** – search a keyword and see every advertiser pushing that product type in a country.
- **Agency pitches** – show a prospect what their competitors are doing on TikTok, with dates and reach.
- **Compliance and brand protection** – find ads that use your brand name, including ones TikTok rejected.

### Input

| Field | Meaning |
|---|---|
| `queries` | Advertiser names or keywords, one per line - the library matches both. Wrap in double quotes for an exact phrase |
| `countryCode` | Which country's library to search: `DE`, `FR`, `ES`, `IT`, `NL`, `PL`, `GB`, … |
| `startDate`, `endDate` | The period an ad was shown in, `YYYY-MM-DD`. Defaults to the last 90 days |
| `maxAdsPerQuery` | Stop after N ads per query; `0` means no limit |

```json
{
  "queries": ["Nike"],
  "countryCode": "DE",
  "startDate": "2026-06-01",
  "endDate": "2026-09-20",
  "maxAdsPerQuery": 200
}
```

### What the library covers

TikTok publishes this library for the **EU and EEA plus the UK and Switzerland** – 33 regions in total. Ads that only ran outside those countries are not in it. Pick the country you care about with `countryCode`; one run searches one country.

The date filter matches the period an ad was **shown**, not when it was created, and TikTok only keeps ads in the library for a limited time, so a long lookback returns less than you might expect.

### How it works

The library signs its own API calls in the browser, so this actor opens the library page, lets TikTok make the first search itself, and then pages through the results with that signed request. That means no fragile reverse-engineering of TikTok's signature – and it also means a run needs a browser, which is why the actor defaults to 2 GB of memory. A query of 200 ads takes roughly a minute.

### FAQ

**Do I need a TikTok account?**
No. The Commercial Content Library is public and this actor never logs in.

**Can I download the videos?**
`videoUrl` is a direct MP4 link from TikTok's CDN. The links are signed and expire after a few hours, so download them soon after the run.

**Does the search look at the advertiser or at the ad text?**
Both - TikTok's library has a single search box for "advertiser name or keyword", and so does this actor. A quoted query is matched as an exact phrase.

**Why do I get fewer ads than the "total" in the log?**
`maxAdsPerQuery` caps the run, and TikTok sometimes returns the same ad on two pages – the actor removes those duplicates.

**Which countries can I search?**
Any of the 33 EU/EEA regions plus the UK and Switzerland. Use the ISO code, e.g. `DE` for Germany.

### Related actors

- [LinkedIn Ad Library Scraper](https://apify.com/pulsedata/linkedin-ad-library-scraper) – the same for B2B ads, with impressions per country and targeting.
- [Google Ads Transparency Center Scraper](https://apify.com/pulsedata/google-ads-transparency-scraper) – Search, YouTube, Display, Shopping and Maps ads.
- [App Store & Google Play Scraper](https://apify.com/pulsedata/app-store-google-play-scraper) – app listings and reviews for the apps behind the ads.

# Actor input Schema

## `queries` (type: `array`):

One entry per line. The library matches advertiser names and the ad content itself, so both `Nike` and `running shoes` work. Wrap a phrase in double quotes for an exact-phrase search.

## `countryCode` (type: `string`):

ISO country code of an EU/EEA country plus UK and Switzerland, e.g. `DE`, `FR`, `ES`, `GB`. The library only covers these regions.

## `startDate` (type: `string`):

`YYYY-MM-DD`. Defaults to 90 days before the end date.

## `endDate` (type: `string`):

`YYYY-MM-DD`. Defaults to today.

## `maxAdsPerQuery` (type: `integer`):

Stop after this many ads per query. 0 means no limit.

## `proxyConfiguration` (type: `object`):

TikTok's library rejects datacenter and residential proxies, so this actor uses the Apify Unblocker by default.

## `debugDump` (type: `boolean`):

Stores a screenshot and the page HTML in the run's key-value store. Only needed when reporting a problem.

## Actor input object example

```json
{
  "queries": [
    "Nike"
  ],
  "countryCode": "DE",
  "maxAdsPerQuery": 100,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "UNBLOCKER"
    ]
  },
  "debugDump": false
}
```

# Actor output Schema

## `results` (type: `string`):

TikTok ads stored in the default dataset.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "queries": [
        "Nike"
    ],
    "countryCode": "DE",
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "UNBLOCKER"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("pulsedata/tiktok-ad-library-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "queries": ["Nike"],
    "countryCode": "DE",
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["UNBLOCKER"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("pulsedata/tiktok-ad-library-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "queries": [
    "Nike"
  ],
  "countryCode": "DE",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "UNBLOCKER"
    ]
  }
}' |
apify call pulsedata/tiktok-ad-library-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,pulsedata/tiktok-ad-library-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/HW9A5aW6dwwf9azVO/builds/NEDI6fXgthfm2VqPt/openapi.json
