# TikTok Ad Library Scraper (`atkvn/tiktok-ads-library-scraper`) Actor

Export ads from TikTok's public Commercial Content Library (EU, EEA, UK, Switzerland, Turkey, Brazil) by advertiser name or keyword: ad text, video, dates shown, unique users seen, and optional landing page, targeting and impressions by age and gender.

- **URL**: https://apify.com/atkvn/tiktok-ads-library-scraper.md
- **Developed by:** [Dong Nguyen](https://apify.com/atkvn) (community)
- **Categories:** Marketing, Lead generation, Social media
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 40.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.20 / 1,000 ads

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

Export ads from TikTok's public [Commercial Content Library](https://library.tiktok.com/ads) — the ad archive TikTok publishes under the EU Digital Services Act. Search by advertiser name or keyword, pick a country and a date range, and get one clean row per ad: who ran it, the ad text, the video, when it first and last ran, and how many unique users saw it. Turn on **Include details** to add the landing page, call to action, objective, who paid, the TikTok account behind the ad, the targeting (countries, ages, genders, interests, audience size) and impressions broken down by country, age and gender.

No TikTok account or login needed. The Actor opens the same public library pages any visitor opens and reads what they show.

### Who it is for

- **Marketers and agencies** — see which creatives a competitor runs in Europe right now, for how long, and to whom.
- **Brand and compliance teams** — find ads that use your brand name, and ads TikTok removed.
- **Researchers and journalists** — who paid for an ad, which country the advertiser is registered in, and how reach splits by age and gender.
- **AI-agent builders** — every item has the same keys (`null` / `[]` when unknown), so it is safe to feed to a model or a pipeline.

### Coverage

The library only contains ads shown in the **EU and EEA, the United Kingdom, Switzerland, Turkey and Brazil**. Ads shown only in the US or Asia are not in it — this is a limit of TikTok's library, not of the Actor.

### What you get per ad

| Field | Meaning | Needs Include details |
|---|---|---|
| `adId`, `libraryUrl` | TikTok's ad ID and the ad's page in the library | no |
| `advertiserName` | Advertiser as shown in the library | no |
| `adText` | Ad caption | no |
| `industry` | TikTok's industry label (e.g. *Apparel & Accessories*) | no |
| `firstShown`, `lastShown`, `daysShown` | First and last day shown (UTC) and the number of days | no |
| `uniqueUsersSeen` | TikTok's range of unique users reached (e.g. `100K-200K`) | no |
| `hasVideo`, `videos[]` | Video URL and cover image for video ads (TikTok signs these links and they expire — download the files soon if you need them) | no |
| `imageUrls` | Images for image ads | no |
| `removed`, `removalInfo` | Whether TikTok took the ad down, and why when it says | no |
| `advertiserId` | TikTok's advertiser ID — reuse it to pin a query to exactly one advertiser | yes |
| `advertiserRegistryLocation`, `paidFor` | Country the advertiser is registered in; who paid for the ad | yes |
| `tiktokUsername`, `tiktokDisplayName`, `tiktokFollowers`, `tiktokAccountType`, `tiktokProfileUrl` | The TikTok account that ran the ad | yes |
| `landingUrl`, `callToAction`, `objective` | Where the ad sends people, the button text, the campaign objective | yes |
| `totalImpressions`, `impressionsByRegion[]` | Impressions overall and per country, each split by age band and gender | yes |
| `targeting` | `audienceSize`, `countries`, `provinces`, `cities`, `ages`, `genders`, `languages`, `interests`, `videoInteractions`, `creatorInteractions`, `deviceModels`, `operatingSystems`, `customAudience`, `excludedAudience`, `highSpendingPower` | yes |
| `query`, `region`, `detailsFetched`, `scrapedAt` | Which input produced the row, and when | no |

### Input

| Field | Default | Notes |
|---|---|---|
| `queries` | — (required) | Advertiser names or keywords, one per line — searched like the library's own search box. |
| `region` | `all` | One covered country, or all of them. |
| `dateFrom`, `dateTo` | last 30 days | `YYYY-MM-DD`; up to 366 days per run. |
| `sort` | last shown, newest first | Last shown or published date, newest or oldest first. (The website's "unique users seen" orders are left out: TikTok's own results for them are not in reach order.) |
| `maxAdsPerQuery` | `100` | `0` = no limit. More than ~70 ads per query works with the default order (see Limits). |
| `includeDetails` | off | Adds the detail fields. About 5–7 seconds and one extra charge per ad. |
| `proxyConfiguration` | Apify Proxy on | A blocked address is replaced with a fresh one. |

#### Getting exactly one advertiser

A name search also matches ads that merely mention the word. To get one advertiser only, write the name and its ID separated by `|`:

```
NIKE Retail B.V. | 6876453864464188162
```

Run once with **Include details** to find the `advertiserId`, or paste a library search URL (`https://library.tiktok.com/ads?...adv_name=...&adv_biz_ids=...`).

#### Examples

Competitor's ads in France this month, with targeting:

```json
{ "queries": ["NIKE Retail B.V. | 6876453864464188162"], "region": "FR", "includeDetails": true, "maxAdsPerQuery": 50 }
```

Every ad mentioning a keyword across all covered countries, newest published first:

```json
{ "queries": ["black friday"], "region": "all", "sort": "published_newest", "maxAdsPerQuery": 500 }
```

### Output example

One real item (21 Nov 2026, `includeDetails` on, breakdown shortened):

```json
{
  "query": "NIKE Retail B.V. | 6876453864464188162",
  "region": "FR",
  "adId": "1882139943394434",
  "advertiserName": "NIKE Retail B.V.",
  "adText": "Fonce. Les jours Nike Black Friday sont là. Jusqu'à -40 % sur une sélection d'articles. Fin le 1/12",
  "industry": "Apparel & Accessories",
  "firstShown": "2026-11-18",
  "lastShown": "2026-11-19",
  "daysShown": 2,
  "uniqueUsersSeen": "100K-200K",
  "hasVideo": false,
  "videos": [],
  "imageUrls": [],
  "removed": false,
  "removalInfo": null,
  "libraryUrl": "https://library.tiktok.com/ads/detail/?ad_id=1882139943394434",
  "detailsFetched": true,
  "scrapedAt": "2026-11-21T00:48:44+00:00",
  "advertiserId": "6876453864464188162",
  "advertiserRegistryLocation": "Netherlands",
  "paidFor": "INITIATIVE MEDIA B.V.",
  "tiktokUsername": "nike",
  "tiktokDisplayName": "Nike",
  "tiktokFollowers": "9.4M",
  "tiktokAccountType": "VERIFIED_BA",
  "tiktokProfileUrl": "https://www.tiktok.com/share/user/208464585232822272?source=ad_review",
  "landingUrl": "https://www.nike.com/fr/w/black-friday-2phlm",
  "callToAction": "Shop now",
  "objective": "Sales",
  "totalImpressions": "100K-200K",
  "impressionsByRegion": [
    {
      "region": "FR",
      "impressions": "194K",
      "byAgeGender": [
        {
          "age": "18-24",
          "gender": "MALE",
          "impressions": "29K"
        },
        {
          "age": "18-24",
          "gender": "FEMALE",
          "impressions": "41K"
        },
        {
          "...": "13 more rows"
        }
      ]
    }
  ],
  "targeting": {
    "audienceSize": "21.7M-26.6M",
    "countries": [
      "FR"
    ],
    "provinces": [],
    "cities": [],
    "ages": {
      "FR": [
        "18-24",
        "25-34",
        "35-44",
        "45-54",
        "55+"
      ]
    },
    "genders": {
      "FR": [
        "female",
        "male",
        "unknown"
      ]
    },
    "languages": [],
    "interests": [],
    "videoInteractions": [],
    "creatorInteractions": [],
    "deviceModels": [],
    "operatingSystems": [
      "ALL"
    ],
    "customAudience": false,
    "excludedAudience": false,
    "highSpendingPower": false
  }
}
```

When a query finds nothing, comes back short, or TikTok keeps refusing requests, you get one item with an `error` field explaining it. Those items are **not charged**. A run that delivered ads ends as *Succeeded* even if one query came back short; it fails only when nothing could be read.

### Use it from an AI agent (MCP)

Apify's hosted MCP server exposes this Actor as a tool, so Claude, Cursor, VS Code or any other MCP client can call it directly. Server URL:

```
https://mcp.apify.com/?tools=atkvn/tiktok-ads-library-scraper
```

Authenticate with your Apify API token as a bearer header. In Claude Code, for example:

```bash
claude mcp add --transport http tiktok-ads "https://mcp.apify.com/?tools=atkvn/tiktok-ads-library-scraper" --header "Authorization: Bearer YOUR_APIFY_TOKEN"
```

The tool is called `atkvn--tiktok-ads-library-scraper` and takes the same input as described above. It starts a normal run, so pricing and limits are the same. Tested on 21 Nov 2026 with two calls through the MCP server (`nike` in France, 5 ads, 33 seconds; `adidas` in Germany, 3 ads, 11 seconds): both succeeded and were charged per ad as usual. The first call ran longer than the MCP server waits (about 30 seconds) and came back as "running" with a run ID; the agent then fetches the results with the server's `get-actor-run` and `get-dataset-items` tools.

### Pricing

Pay per result:

- **$1.20 per 1,000 ads**
- **$2.00 per 1,000 ad details** (only when Include details is on)

Your maximum charge per run is respected: the run stops cleanly before going over it.

### Limits and good to know

- Data is what TikTok publishes: reach and impressions are ranges, not exact numbers, and spend is not shown.
- **One TikTok search pages only about 7 times (~70 distinct ads)**, then the library refuses the next page, however slowly you click (measured twice on 21 Nov 2026, also on the website). With the default order (last shown, newest first) the Actor works around it: the library filters on the last-shown day, so when a search hits the ceiling the Actor splits its date range at the day it had reached, searches the newer part first, then the older part, and repeats until it has `maxAdsPerQuery` ads. Repeats are skipped and not charged.
- Measured on the platform on 22 Nov 2026, 200 ads per brand, all countries: from the newest last-shown day (20 Nov) the Actor returned **91 `nike` ads and 84 `adidas` ads; the previous version returned 29 and 29**, padding the rest with ads from late October. Runs took 225 and 243 seconds.
- A single day can hold more ads than one search pages through (`nike` had 90+ on 20 Nov). Such a day is kept partial (when the query ends short of `maxAdsPerQuery`, a notice item names the day); to get all of it, run that day per country (`region`).
- If TikTok ends a search early with most of the ads it had already shown for that date range missing, the Actor treats it as a refusal and retries with a fresh session (seen once on 22 Nov 2026: an empty answer late in a long run; the same range on its own returned 60 ads).
- With the other orders the Actor does not continue: it keeps the ~70 ads it reached and adds a notice item.
- The first page load of each run is sometimes refused while the library sets its cookies; the Actor waits and retries on its own.

### Support

Found a field that looks wrong, or need another filter? Open an issue on the Actor's Issues tab — include the run ID and we will reply within one working day.

# Actor input Schema

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

One per line, searched like the library's own search box (advertiser name or keyword). To get exactly one advertiser, write the name and its advertiser ID separated by | (e.g. NIKE Retail B.V. | 6876453864464188162 — the ID is in the advertiserId field when Include details is on), or paste a library.tiktok.com/ads search URL.

## `region` (type: `string`):

The library only covers ads shown in these countries (EU/EEA, UK, Switzerland, Turkey, Brazil). "All" searches all of them.

## `dateFrom` (type: `string`):

Start of the date range. Leave empty for the last 30 days.

## `dateTo` (type: `string`):

End of the date range (inclusive). Leave empty for today. The range can be up to 366 days.

## `sort` (type: `string`):

Same date orders as the library website. With a limit per query, this decides which ads you get.

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

0 = no limit. TikTok pages one search only ~70 ads deep; with the default order the Actor continues with earlier date ranges on its own until it has this many.

## `includeDetails` (type: `boolean`):

Open each ad's detail page: landing URL, call to action, objective, advertiser ID and registry country, who paid, TikTok account, targeting (countries, ages, genders, interests, audience size) and impressions by country, age and gender. Charged per ad detail; about 5-7 seconds per ad.

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

Apify Proxy is on by default so a blocked address is replaced with a fresh one.

## Actor input object example

```json
{
  "queries": [
    "nike"
  ],
  "region": "all",
  "sort": "last_shown_newest",
  "maxAdsPerQuery": 100,
  "includeDetails": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `ads` (type: `string`):

One item per ad, with advertiser, ad text, video, dates shown, unique users seen and (optionally) targeting and impressions.

# 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"
    ],
    "region": "all",
    "maxAdsPerQuery": 100,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("atkvn/tiktok-ads-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"],
    "region": "all",
    "maxAdsPerQuery": 100,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("atkvn/tiktok-ads-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"
  ],
  "region": "all",
  "maxAdsPerQuery": 100,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call atkvn/tiktok-ads-library-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,atkvn/tiktok-ads-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/1taovLZWr9DmNQVFE/builds/bkig0UHrHfEZPrZHJ/openapi.json
