# TikTok Ads Library Scraper (`maximedupre/tiktok-ads-library`) Actor

Search the TikTok Ads Library by keyword, advertiser, country, ad ID, or library link. Get ad captions, video and image links, dates, advertiser, payer, targeting, and reach. Or count matching ads in EU, EEA, Swiss, UK, and Turkish markets.

- **URL**: https://apify.com/maximedupre/tiktok-ads-library.md
- **Developed by:** [Maxime Dupré](https://apify.com/maximedupre) (community)
- **Categories:** Social media, Marketing, Business
- **Features:** Limited permissions
- **Stats:** 1 total users, 1 monthly users, 78.6% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.70 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

### 🔍 See what brands run in the TikTok Ads Library

This TikTok Ads Library scraper is for marketers, ad buyers, agencies, and researchers who want to see which ads brands run on TikTok. Search by keyword, advertiser, country, ad ID, or library link. You get each ad's caption, video and image links, dates, advertiser, payer, targeting, and published reach in clean rows. You can also count matching ads without saving each ad. It works as a simple TikTok spy tool for public ads shown in the EU, EEA, Switzerland, the United Kingdom, and Türkiye.

- Study a competitor's TikTok ads by searching for their advertiser name.
- Explore top ads on TikTok for a keyword by sorting the results by audience reach.
- Download ad videos, cover images, and image creatives for your swipe file.
- Check who an ad targets by country, age group, gender, and interests.
- Count how many ads match a search before you collect them.

#### 📦 What TikTok ad data you get

Each ad row can include:

- The ad ID and its public TikTok Ads Library link.
- The ad caption, creative format, and call-to-action text.
- Links to the video files, video covers, and images.
- The first and last dates TikTok showed the ad.
- The advertiser name, business ID, registry location, and linked TikTok profile.
- The payer, destination link, campaign objective, and ad subject.
- Target audience details, such as countries, age groups, genders, interests, and audience size range.
- Published reach, reach bands, and reach by country, age group, and gender.
- The moderation status and any published rejection reasons.
- A new-ad flag that compares this run with earlier runs.

TikTok does not publish every detail for every ad. When a detail is missing, the field is left out.

#### 🚀 How to search the TikTok Ads Library

1. Pick a **Result type**: Ads for full ad rows, or Ad counts for matching-ad totals.
2. Pick how to **Find ads by**: advertiser name, keyword, ad IDs, library URL, or country.
3. Fill the list for that choice, and add one or more **Countries** when your search needs them.
4. Add filters if you want, such as dates, delivery status, format, or audience.
5. Set **Maximum results** and start the run. Your rows show up in the dataset.

#### ⚙️ Input

**Input fields**

| Field | Type | What it does |
| --- | --- | --- |
| `resultType` | string | Required. `ads` saves full ad rows. `adCounts` saves TikTok's matching-ad totals without saving each ad. The form prefill is `ads`. |
| `countries` | array | Country names as shown in TikTok's library country menu, such as `France`. Supported markets are in the EU, EEA, Switzerland, United Kingdom, and Türkiye. Invalid names are rejected. Required for country browsing and for searches that have no country in the library URL. The same countries apply to every search value. The form prefill is `France`. |
| `maxItems` | integer | Stop after this many saved rows for the whole run, or sooner when no more results come back. Leave it empty or use `0` for all available rows. For Ad counts, it limits count rows, not the number of ads each count covers. The form prefill is `5`. |
| `findAdsBy` | string | How to find ads: `advertiser`, `keyword`, `adId`, `libraryUrl`, or `country`. The schema default is `advertiser`, and the form prefill is `country`. `adId` works only with Ads. Lists for other choices are ignored. |
| `adIds` | array | For `adId` with Ads. One TikTok Ads Library ad ID per entry, made of digits only. Search filters do not apply. |
| `advertiserNames` | array | For `advertiser`. One full advertiser label per entry, as shown in TikTok's advertiser suggestions, such as `OpenAI, Inc.`. Keep all spaces and punctuation. A label that does not match one advertiser choice is rejected. |
| `keywords` | array | For `keyword`. One word or phrase per entry. TikTok searches advertiser names and ad text together, so results can include other advertisers whose ads use the phrase. |
| `libraryUrls` | array | For `libraryUrl`. Full `https://library.tiktok.com/` search URLs, or ad-detail URLs for Ads. All URLs in one run must share the same search filters. URL filters are kept, and form filters that conflict with them are invalid. |
| `adSortBy` | string | Order Ads search results by `lastShown` (last shown date) or `reach` (audience reach). Empty keeps the URL's order, or last shown date when none is set. |
| `phraseMatch` | string | For advertiser and keyword searches. `phrase` keeps the words together. `broad` uses TikTok's broader matching. Empty uses TikTok's setting or the URL's setting. |
| `lastShownFrom` | string | Keep ads last shown on or after this date, in `YYYY-MM-DD` form. Empty means no start date. |
| `lastShownTo` | string | Keep ads last shown on or before this date, in `YYYY-MM-DD` form. Empty means no end date. |
| `sortOrder` | string | For Ads searches. `descending` puts newest dates or largest values first. `ascending` puts oldest or smallest first. Empty keeps the URL's direction, or descending when none is set. |
| `timeZone` | string | An IANA time zone for the date filters, such as `Europe/Paris` or `UTC`. Empty uses the URL's time zone, or UTC. |
| `deliveryStatus` | string | `all`, `running`, or `stopped`. Empty keeps the URL's status, or all ads. |
| `creativeFormats` | array | `all`, `video`, `image`, or `text`. Ads can use more than one format. Ad counts can use only one. `all` must be picked on its own. Empty keeps the URL's format, or all ad types. |
| `audienceAges` | array | Exact age-group labels from TikTok's audience filter, such as `18-24`. Empty means all age groups, or those in the URL. |
| `audienceGenders` | array | `All genders`, `Female`, or `Male`. Ads can use Female and Male together. Ad counts can use only one. `All genders` is its own TikTok choice and must be picked on its own. |
| `reachBands` | array | Exact reach-band labels from TikTok, such as `10K-100K`. These are ranges, not exact counts. Empty means all reach bands, or those in the URL. |

**Example input**

```json
{
  "countries": [
    "France"
  ],
  "maxItems": 5,
  "resultType": "ads",
  "findAdsBy": "country"
}
```

#### 🧾 Output

**Output fields**

Each run saves only the result type you pick. These fields are for an Ads row.

| Field | Type | What it does |
| --- | --- | --- |
| `resultType` | string | Always `ad` for this row type. |
| `adId` | string | The TikTok ad ID. |
| `libraryUrl` | string | The public TikTok Ads Library detail link for the ad. |
| `caption` | string | The ad text TikTok publishes as the caption. |
| `creativeFormat` | string | The creative format TikTok states, such as `video` or `image`. |
| `media.videos[].downloadUrl` | string | A link to download the video file. |
| `media.videos[].coverUrl` | string | A link to download the video cover image. |
| `media.images[].downloadUrl` | string | A link to download the image file. |
| `firstShown` | string | The first date TikTok reports the ad was shown. |
| `lastShown` | string | The last date TikTok reports the ad was shown. |
| `advertiser.name` | string | The advertiser name TikTok publishes. |
| `advertiser.businessId` | string | The advertiser business ID. Use it to match ads from the same business. |
| `advertiser.registryLocation` | string | The business registry location. |
| `advertiser.profile.accountId` | string | The linked TikTok account ID. |
| `advertiser.profile.username` | string | The linked TikTok username. |
| `advertiser.profile.displayName` | string | The name shown on the TikTok account. |
| `advertiser.profile.profileUrl` | string | The link to the public TikTok profile. |
| `advertiser.profile.avatarUrl` | string | A link to the profile image. |
| `advertiser.profile.followerCount` | number or string | The follower count. A number is exact. Text keeps TikTok's short form, such as `304.1K`. |
| `advertiser.profile.accountType` | string | The account type TikTok states. |
| `payer` | string | Who TikTok says paid for the ad. |
| `destinationUrl` | string | The landing page or app link the ad sends people to. |
| `callToAction` | string | The call-to-action text, such as `Learn more`. |
| `campaignObjective` | string | The campaign objective TikTok states. |
| `subject` | string | The ad subject TikTok states. |
| `reachBand` | string | The reach band TikTok reports. It is a range, not an exact count. |
| `reach` | number or string | Unique users who saw the ad, as TikTok shows it. A number is exact. Text keeps TikTok's range or short form. |
| `targetAudience.sizeRange` | string | The published target audience size range. |
| `targetAudience.countries` | array | Target countries. |
| `targetAudience.ageGroups` | array | Target age groups. |
| `targetAudience.genders` | array | Target genders. |
| `targetAudience.locations` | array | Target cities and provinces, with any stated location type. |
| `targetAudience.languages` | array | Target languages. |
| `targetAudience.interests` | array | Target interests. |
| `targetAudience.devices` | array | Target devices. |
| `targetAudience.operatingSystems` | array | Target operating systems. |
| `targetAudience.spendingPower` | array | Spending power settings. |
| `targetAudience.interactionAudiences` | array | Interaction audience settings. |
| `targetAudience.customAudienceInclusions` | array | Custom audience inclusion settings. |
| `targetAudience.customAudienceExclusions` | array | Custom audience exclusion settings. |
| `reachBreakdowns[].country` | string | The country for this reach group. |
| `reachBreakdowns[].ageGroup` | string | The age group for this reach group. |
| `reachBreakdowns[].gender` | string | The gender for this reach group. |
| `reachBreakdowns[].reach` | number or string | Unique users in this group who saw the ad. Text keeps TikTok's short form, such as `3.7M`. |
| `moderationStatus` | string | The moderation status TikTok states for the ad. |
| `rejections[].reason` | string | A rejection reason TikTok states. |
| `rejections[].countries` | array | The countries for that rejection. |
| `monitoring.isNew` | boolean | `true` when no earlier run saw this ad. It does not mean TikTok just created the ad. |
| `monitoring.observedAt` | string | The time this run read the ad. |

**Example ad**

```json
{
  "resultType": "ad",
  "adId": "1850933570681953",
  "libraryUrl": "https://library.tiktok.com/ads/detail/?ad_id=1850933570681953",
  "caption": "Galaxy S25 Ultra",
  "creativeFormat": "video",
  "media": {
    "videos": [
      {
        "downloadUrl": "https://library.tiktok.com/api/v1/cdn/1794194593/video/aHR0cHM6Ly92NTgudGlrdG9rY2RuLmNvbS92aWRlby90b3Mvbm8xYS90b3Mtbm8xYS12ZS01MWM3MTAtbm8vb3dGUzJBNVcxb1FSdmlFMGdtaWZBQXd5NW9sa0NvSTZtQkIzQkkv/61828666-6e5d-48a4-85f2-4a95b2f96764?VExpiration=1794216210&VSignature=ztB9pPF26iaj8OZMYOZFAg&a=475769&bt=734&btag=e000b8000&bti=PDU2NmYwMy86&ft=.NpOcInz7ThOp5GGXq8Zmo&l=20261109112313CC0C6274EDC71747E2C6&mime_type=video_mp4&rc=ZmU0ZTg2ZTg8Nzw8NWc5NUBpM2pzb3k5cnFkNzMzODYzNEA0YzYuXzI2XzQxMTAuMWFfYSNsaXJwMmRjL29hLS1kMC1zcw%3D%3D&signature=%2Bf5dZfytky%2Fn8OLkTeHHVCUufb4vf7p%2BXTrHZdKRMl8%3D&vvpl=1",
        "coverUrl": "https://p16-common-sign.tiktokcdn.com/tos-alisg-p-0051c001-sg/owxWDf8MgIfFbzSGoQfQJbzUtCjAHQIwWE6jQA~tplv-tiktokx-origin.jpeg?dr=14582&refresh_token=11691697&x-expires=1794214800&x-signature=zl95Wj0hJkswew9mANGsD0Fv%2B7A%3D&t=4d5b0474&ps=13740610&shp=0c75dd76&shcp=9b759fb9&idc=sg1"
      }
    ]
  },
  "firstShown": "2025-12-09",
  "lastShown": "2025-12-31",
  "advertiser": {
    "name": "Samsung Electronics GmbH",
    "businessId": "6886414314308109057",
    "registryLocation": "Germany",
    "profile": {
      "accountId": "6698590748474065926",
      "username": "samsungde",
      "displayName": "Samsung Deutschland",
      "profileUrl": "https://www.tiktok.com/share/user/6698590748474065926?source=ad_review",
      "avatarUrl": "https://p16-common-sign.tiktokcdn-eu.com/tos-maliva-avt-0068/7322804629522087942~tplv-tiktokx-cropcenter:168:168.jpeg?dr=10397&refresh_token=4b67583c&x-expires=1794366000&x-signature=PXYH7AtDARz4lQwx4YeoSXHubUg%3D&t=4d5b0474&ps=13740610&shp=a5d48078&shcp=8aecc5ac&idc=no1a",
      "followerCount": "304.1K",
      "accountType": "BLUEV_BA"
    }
  },
  "payer": "Starcom Germany GmbH",
  "destinationUrl": "https://www.samsung.com/de/smartphones/galaxy-s25-ultra/?cid=de_pd_social_tiktok_social_sustain_s25-phase2_video_influencer-song-and-pepper-3_int&utm_source=tiktok&utm_medium=paid&utm_id=__CAMPAIGN_ID__&utm_campaign=__CAMPAIGN_NAME__",
  "callToAction": "Learn more",
  "campaignObjective": "Video views",
  "reachBand": "1M-10M",
  "targetAudience": {
    "sizeRange": "8.3M-10.1M",
    "countries": [
      "DE"
    ],
    "ageGroups": [
      "18-24",
      "25-34",
      "35-44",
      "45-54",
      "55+"
    ],
    "genders": [
      "female",
      "male",
      "unknown"
    ],
    "interests": [
      "Photography, Wedding Photography"
    ],
    "operatingSystems": [
      "ALL"
    ],
    "spendingPower": [
      "No"
    ],
    "interactionAudiences": [
      "Beauty & Style",
      "Fashion & Beauty, Technology & Education"
    ],
    "customAudienceInclusions": [
      "No"
    ],
    "customAudienceExclusions": [
      "No"
    ]
  },
  "reachBreakdowns": [
    {
      "country": "DE",
      "reach": "3.7M"
    }
  ],
  "moderationStatus": "1",
  "subject": "Tech & Electronics",
  "reach": "1M-10M",
  "monitoring": {
    "isNew": false,
    "observedAt": "2026-11-09T03:23:13.846Z"
  }
}
```

**Ad count fields**

These fields are for an Ad counts row. Each row is one total for one search value.

| Field | Type | What it does |
| --- | --- | --- |
| `resultType` | string | Always `adCount` for this row type. |
| `search.method` | string | The search type that was counted, such as `keyword`. |
| `search.advertiserName` | string | The advertiser label used for this count. |
| `search.keyword` | string | The keyword or phrase used for this count. |
| `search.libraryUrl` | string | The library search URL used for this count. URLs with business-ID filters are invalid for ad counts. |
| `search.countries` | array | The countries this count covers. |
| `search.phraseMatch` | string | The matching rule used. |
| `search.timeZone` | string | The time zone used for the dates. |
| `search.deliveryStatus` | string | The delivery status filter. |
| `search.creativeFormats` | array | The one ad type for this count. `all` means all ad types. |
| `search.audienceAges` | array | The age-group filters. |
| `search.audienceGenders` | array | The one gender choice for this count. |
| `search.reachBands` | array | The reach-band filters. |
| `search.lastShownFrom` | string | The start date filter, in `YYYY-MM-DD` form. |
| `search.lastShownTo` | string | The end date filter, in `YYYY-MM-DD` form. |
| `matchingAdCount` | integer | The matching-ad total TikTok reports. It is not the number of rows saved. |
| `countAccuracy` | string | `exact` when TikTok gives a full total. `capped` when TikTok limits the total, so the real number can be higher. `unspecified` when TikTok does not say. |

**Example ad count**

```json
{
  "resultType": "adCount",
  "search": {
    "method": "keyword",
    "keyword": "Nike",
    "countries": [
      "France",
      "Germany"
    ],
    "phraseMatch": "broad",
    "deliveryStatus": "all",
    "creativeFormats": [
      "all"
    ],
    "audienceAges": [
      "All ages"
    ],
    "audienceGenders": [
      "All genders"
    ],
    "reachBands": [
      "All reach"
    ]
  },
  "matchingAdCount": 5000,
  "countAccuracy": "capped"
}
```

#### 💳 Pricing

This Actor uses pay-per-event pricing. You pay only for rows it saves.

- **Ad**: from $0.0009 per saved ad on the Free and Bronze plans, $0.0008 on Silver, and $0.0007 on Gold, Platinum, and Diamond.
- **Ad count**: $0.005 per saved count row. One row is one total for one search value.

There is no charge for an ad that could not be read, or for a search that saves no rows. Use **Maximum results** to cap how many rows you pay for.

#### 🔌 Integrations

You can connect this Actor to other apps and tools with Apify integrations, such as Make, Zapier, Google Sheets, Slack, webhooks, and the Apify API. Use them to send new TikTok ads to your sheet or team after each run.

https://www.youtube.com/watch?v=bNACk1_S_6w\&list=PLObrtcm1Kw6MUrlLNDbK9QRg8VDJg0gOW\&index=4

#### ❓ FAQ

##### Which countries does the TikTok Ads Library cover?

TikTok publishes this library for ads shown in the EU, EEA, Switzerland, the United Kingdom, and Türkiye. Ads that ran only in other countries are not in it.

##### Why does a run with no limit save fewer ads than TikTok's total?

TikTok gives back a sample of matching ads on each page, and it does not say when a list is complete. So a run collects the ads that TikTok returns, which can be fewer than the total. Use Ad counts to see TikTok's matching-ad total.

##### What does "capped" mean in an ad count?

It means TikTok limits the reported total. The real number of matching ads can be higher than `matchingAdCount`.

##### How does the new-ad flag work?

The Actor keeps a record of ads it has read before in a named key-value store in your Apify account. When an ad has no earlier record, `monitoring.isNew` is `true`. Run the same search on a schedule to spot new ads.

##### Can I download the ad videos and images?

Yes. Each ad row has download links for available videos, video covers, and images. These links can expire, so download the files soon after the run.

##### What is the difference between Keyword and Advertiser name?

Advertiser name finds ads from one exact advertiser label. Keyword searches advertiser names and ad text together, so it can return ads from other advertisers that mention the phrase.

##### Do I need a TikTok account?

No. The Actor reads public TikTok Ads Library data, so you do not need to log in.

##### Is this a TikTok ads library API?

It works like one. You can start runs and read results through the Apify API, and get rows in the same format each time.

### 📝 Changelog

**v0.0** (09-11-2026)

- Initial release.

### 🆘 Support

For issues, questions, or feature requests, [file a ticket](https://console.apify.com/actors/maximedupre~tiktok-ads-library/issues) and I'll fix or implement it in less than 24h 🫡

### 🔗 Related Actors

- [TikTok Creative Center Scraper for Top Ads](https://apify.com/maximedupre/tiktok-creative-center-scraper): collect ranked TikTok top ads and trending hashtags by market and time window.
- [LinkedIn Ads Library Scraper](https://apify.com/maximedupre/linkedin-ads-library): search LinkedIn ads by advertiser or keyword and get creative, targeting, and payer data.
- [Google Ads Scraper](https://apify.com/maximedupre/google-ads-scraper): get Google Ads Transparency Center creatives for a domain, keyword, or advertiser.
- [Snapchat Ads Scraper](https://apify.com/maximedupre/snapchat-ads): search Snapchat's public ads gallery by advertiser, country, or dates.
- [Pinterest Ads Scraper](https://apify.com/maximedupre/pinterest-ads): search Pinterest's ads transparency data by market, advertiser, and audience.

**Made with ❤️ by Maxime Dupré**

# Actor input Schema

## `countries` (type: `array`):

Enter one or more country names as shown in TikTok's library country menu. Supported markets are in the EU, EEA, Switzerland, United Kingdom, and Türkiye. Invalid country choices are rejected. Required for country browsing and searches without a country in the library URL. The same countries apply to all search values.

## `maxItems` (type: `integer`):

Stop after this many saved rows across the whole run, or earlier if no more results are available. Applies to Ads and Ad counts. Leave empty or use 0 for all available rows. For Ad counts, this limits count rows, not the number of ads each count describes.

## `resultType` (type: `string`):

Ads returns paid-ad records and their published data and available media files. Ad counts returns TikTok's matching-ad totals without collecting creatives, and marks totals that TikTok caps.

## `adIds` (type: `array`):

For Ads with Find ads by set to Ad IDs. Enter one TikTok Ads Library ad ID per entry. Get the ID from the ad's library detail link. Search filters do not apply to direct ad IDs.

## `adSortBy` (type: `string`):

Order Ads search results by this value. Leave empty to keep the library URL's order field, or last shown date when none is set. Does not change direct ad ID or ad-detail URL lookups.

## `findAdsBy` (type: `string`):

For Ads and Ad counts. Fill the matching list, or choose Country to browse without a search term. Ad IDs work only with Ads. Library URL accepts search URLs for either result type and ad-detail URLs only for Ads. Other inactive search lists are ignored.

## `advertiserNames` (type: `array`):

Required for Advertiser name with Ads or Ad counts. Copy one full advertiser label from TikTok Ads Library's advertiser suggestions per entry, such as OpenAI, Inc. Keep all spaces and punctuation in each label. Other full labels are allowed. Each label must match one advertiser choice; missing or unclear matches are rejected without guessing or switching to Keyword. This search finds ads from the selected advertisers only. For free-text searches across advertiser names and ad text, choose Keyword. All entries use the same filters.

## `keywords` (type: `array`):

Required for Keyword with Ads or Ad counts. Enter one search word or phrase per entry. TikTok searches advertiser names and ad text together, so results may include other advertisers whose ads mention the phrase. Each entry is one value, including any spaces or punctuation. All entries use the same filters.

## `libraryUrls` (type: `array`):

Required for Library URL with Ads or Ad counts. Add full TikTok Ads Library search URLs, or ad-detail URLs for Ads. URLs must share the same search filters; separate search setups need separate runs. URL filters are kept. Leave matching form filters empty or set them to the same values. Conflicting values are invalid. Direct ad-detail links do not use search filters.

## `phraseMatch` (type: `string`):

For Advertiser name and Keyword searches with Ads or Ad counts. Whole phrase keeps the words together. Broader TikTok matching uses TikTok's broader search. Leave empty to use TikTok's setting, or the setting in a library search URL.

## `lastShownFrom` (type: `string`):

For Ads and Ad counts searches. Keep ads last shown on or after this date. Use YYYY-MM-DD. Leave empty for no start date.

## `lastShownTo` (type: `string`):

For Ads and Ad counts searches. Keep ads last shown on or before this date. Use YYYY-MM-DD. Leave empty for no end date.

## `sortOrder` (type: `string`):

For Ads searches. Descending puts newest dates or largest values first. Ascending puts oldest dates or smallest values first. Leave empty to keep the library URL's direction, or descending when none is set. Does not apply to Ad counts or direct ad lookups.

## `timeZone` (type: `string`):

Time zone for date filters on Ads and Ad counts. Enter an IANA time zone such as Europe/Paris or UTC. Leave empty to use the library search URL's time zone, or UTC when no time zone is in the URL.

## `deliveryStatus` (type: `string`):

For Ads and Ad counts searches. Choose TikTok's delivery-status category. Leave empty to keep the library URL's status, or all ads when no status is in the URL.

## `creativeFormats` (type: `array`):

For Ads searches, choose one or more formats. For Ad counts, choose at most one; multiple formats are invalid because TikTok does not report a combined count. All ad types includes every format and must be selected on its own. Leave empty to use the library URL's format, or All ad types when none is set.

## `audienceAges` (type: `array`):

For Ads and Ad counts searches. Copy exact age-group labels from TikTok Ads Library's audience filter, one per entry. Availability can vary by country. Leave empty for all age groups, or those in the library URL.

## `audienceGenders` (type: `array`):

For Ads searches, choose Female, Male, or both. For Ad counts, choose at most one; multiple genders are invalid because TikTok does not report a combined count. All genders is a separate TikTok choice, not the same as Female and Male together. Select it on its own. Leave empty to use the library URL's gender, or All genders when none is set.

## `reachBands` (type: `array`):

For Ads and Ad counts searches. Copy exact reach-band labels from TikTok Ads Library, one per entry. These are ranges, not exact audience counts. Leave empty for all reach bands, or those in the library URL.

## Actor input object example

```json
{
  "countries": [
    "France"
  ],
  "maxItems": 5,
  "resultType": "ads",
  "findAdsBy": "country"
}
```

# Actor output Schema

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

Open the saved ads or ad search counts.

# 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 = {
    "countries": [
        "France"
    ],
    "maxItems": 5,
    "resultType": "ads",
    "findAdsBy": "country"
};

// Run the Actor and wait for it to finish
const run = await client.actor("maximedupre/tiktok-ads-library").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 = {
    "countries": ["France"],
    "maxItems": 5,
    "resultType": "ads",
    "findAdsBy": "country",
}

# Run the Actor and wait for it to finish
run = client.actor("maximedupre/tiktok-ads-library").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 '{
  "countries": [
    "France"
  ],
  "maxItems": 5,
  "resultType": "ads",
  "findAdsBy": "country"
}' |
apify call maximedupre/tiktok-ads-library --silent --output-dataset

```

## MCP server setup

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

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/WHJfhT9M39oE9pqCA/builds/iyaQtZMQWaG8RfPa2/openapi.json
