> ## Documentation Index
> Fetch the complete documentation index at: https://getanyapi.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# TikTok Ad Library Search

> Sell tiktok.ad_library_search on AnyAPI: the request your endpoint receives, the response it must return, and what the real-request check judges.

Search TikTok's public Ads Library by keyword or advertiser (advertiser, title, audience band, run dates, library link, and video).

This page is the seller-facing summary of one catalog API, `tiktok.ad_library_search`. The transport rules that apply to every API a seller serves - signed requests, the response envelope, timeouts, and body limits - are on [the operator endpoint contract](https://getanyapi.com/docs/sell/operator-endpoint-contract.md).

## The price you compete with

AnyAPI publishes this API from **\$0.80 per 1,000 requests**. That is the price a buyer sees today, so it is the price your endpoint has to come in under to win traffic.

## The request your endpoint receives

This API takes no input fields.

> [accordion] Full input JSON Schema
>
> ```json theme={"dark"}
> {
>   "$schema": "https://json-schema.org/draft/2020-12/schema",
>   "$id": "https://getanyapi.com/schemas/tiktok.ad_library_search.input.json",
>   "example": {
>     "query": "spotify"
>   },
>   "title": "TikTok Ad Library Search input",
>   "type": "object",
>   "additionalProperties": false,
>   "oneOf": [
>     {
>       "required": [
>         "query"
>       ],
>       "not": {
>         "required": [
>           "advertiserName"
>         ]
>       }
>     },
>     {
>       "required": [
>         "advertiserName"
>       ],
>       "not": {
>         "required": [
>           "query"
>         ]
>       }
>     }
>   ],
>   "properties": {
>     "query": {
>       "type": "string",
>       "minLength": 1,
>       "pattern": "\\S",
>       "description": "Keyword to search ad titles and content (e.g. spotify). Provide query or advertiserName, never both."
>     },
>     "advertiserName": {
>       "type": "string",
>       "minLength": 1,
>       "pattern": "\\S",
>       "description": "Advertiser name to list ads for (e.g. Spotify). Provide advertiserName or query, never both."
>     },
>     "region": {
>       "type": "string",
>       "minLength": 1,
>       "description": "Two-letter region code for TikTok's Commercial Content Library, such as DE, FR, GB or IT. Each region holds a different set of ads. Omit it to take the library's own default region, DE. Coverage is the EU and EEA; a non-EU code such as US is not served."
>     },
>     "days": {
>       "type": "integer",
>       "minimum": 1,
>       "maximum": 365,
>       "description": "Number of days of library history to search, from 1 to 365."
>     },
>     "cursor": {
>       "type": "string",
>       "description": "Opaque cursor from a previous response's nextCursor. Omit it for the first page."
>     },
>     "requireFields": {
>       "type": "array",
>       "uniqueItems": true,
>       "items": {
>         "type": "string",
>         "enum": [
>           "format",
>           "status"
>         ]
>       },
>       "description": "Optional; omit it and routing is unchanged, with the cheapest source serving. Name the output fields this request must be able to return, for example `status`, and it is served only by a source that returns every one of them. Fields you do not name are still returned whenever the serving source has them. This can raise your price: when the cheapest source cannot return a named field, a dearer source serves, and you are quoted and charged its price. A named field can still be absent on an ad that genuinely lacks it. Naming a combination that no single source returns together is refused as invalid input, with no charge. On a paginated walk it applies to the first page only; later pages stay with the source that page chose, at the price it was quoted."
>     }
>   }
> }
> ```

## The response your endpoint must return

| Field | Type | Always present | What it means |
| - | - | - | - |
| `data` | null or object | yes | |
| `data.ads` | array | yes | |
| `data.ads[].adId` | string | yes | TikTok ad id. |
| `data.ads[].adTitle` | string | yes | Ad title as shown in TikTok's ad library. |
| `data.ads[].brandName` | string | yes | Advertiser name on the ad. |
| `data.ads[].coverUrl` | string | yes | Cover image URL of the ad's first video. |
| `data.ads[].estimatedAudience` | string | yes | Audience size band TikTok publishes for the ad, for example "100K-200K". |
| `data.ads[].firstShownUtc` | integer | no | UTC epoch timestamp in seconds (Unix time) when TikTok first showed the ad. Multiply by 1000 for a JS Date in milliseconds. |
| `data.ads[].format` | string or null | no | TikTok's creative format code for the ad, as the ad library reports it. Null when the serving source does not report it. |
| `data.ads[].lastShownUtc` | integer | no | UTC epoch timestamp in seconds (Unix time) when TikTok last showed the ad. Multiply by 1000 for a JS Date in milliseconds. |
| `data.ads[].status` | string or null | no | TikTok's audit status code for the ad, as the ad library reports it. Null when the serving source does not report it. |
| `data.ads[].url` | string | no | Link to the ad's detail page in TikTok's public Ads Library. |
| `data.ads[].videoUrl` | string | yes | Playable URL of the ad's first video. |
| `data.hasMore` | boolean | yes | |
| `data.nextCursor` | string or null | yes | Opaque cursor for the next page of ads, or null when this lane has no more. Pass it back as cursor to continue. |
| `data.total` | integer | yes | |
| `found` | boolean | yes | |

Extra fields are kept, missing declared fields fail.

> [accordion] Full output JSON Schema
>
> ```json theme={"dark"}
> {
>   "$schema": "https://json-schema.org/draft/2020-12/schema",
>   "$id": "https://getanyapi.com/schemas/tiktok.ad_library_search.output.json",
>   "title": "TikTok Ad Library Search output",
>   "type": "object",
>   "additionalProperties": false,
>   "required": [
>     "found",
>     "data"
>   ],
>   "properties": {
>     "found": {
>       "type": "boolean"
>     },
>     "data": {
>       "oneOf": [
>         {
>           "type": "null"
>         },
>         {
>           "type": "object",
>           "additionalProperties": false,
>           "required": [
>             "nextCursor",
>             "hasMore",
>             "total",
>             "ads"
>           ],
>           "properties": {
>             "nextCursor": {
>               "type": [
>                 "string",
>                 "null"
>               ],
>               "description": "Opaque cursor for the next page of ads, or null when this lane has no more. Pass it back as cursor to continue."
>             },
>             "hasMore": {
>               "type": "boolean"
>             },
>             "total": {
>               "type": "integer"
>             },
>             "ads": {
>               "x-anyapi-must-populate": true,
>               "type": "array",
>               "items": {
>                 "type": "object",
>                 "required": [
>                   "adId",
>                   "adTitle",
>                   "brandName",
>                   "estimatedAudience",
>                   "videoUrl",
>                   "coverUrl"
>                 ],
>                 "properties": {
>                   "adId": {
>                     "x-anyapi-must-populate": true,
>                     "type": "string",
>                     "description": "TikTok ad id."
>                   },
>                   "adTitle": {
>                     "x-anyapi-must-populate": true,
>                     "type": "string",
>                     "description": "Ad title as shown in TikTok's ad library."
>                   },
>                   "brandName": {
>                     "type": "string",
>                     "description": "Advertiser name on the ad."
>                   },
>                   "estimatedAudience": {
>                     "type": "string",
>                     "description": "Audience size band TikTok publishes for the ad, for example \"100K-200K\"."
>                   },
>                   "firstShownUtc": {
>                     "type": "integer",
>                     "description": "UTC epoch timestamp in seconds (Unix time) when TikTok first showed the ad. Multiply by 1000 for a JS Date in milliseconds."
>                   },
>                   "lastShownUtc": {
>                     "type": "integer",
>                     "description": "UTC epoch timestamp in seconds (Unix time) when TikTok last showed the ad. Multiply by 1000 for a JS Date in milliseconds."
>                   },
>                   "url": {
>                     "x-anyapi-domain": "tiktok.com",
>                     "type": "string",
>                     "description": "Link to the ad's detail page in TikTok's public Ads Library."
>                   },
>                   "videoUrl": {
>                     "x-anyapi-domain": [
>                       "tiktokcdn.com",
>                       "tiktokcdn-us.com",
>                       "tiktokcdn-eu.com",
>                       "tiktokv.com",
>                       "tiktokv.us",
>                       "tiktokv.eu",
>                       "tiktok.com",
>                       "tokcdn.com"
>                     ],
>                     "x-anyapi-must-populate": true,
>                     "type": "string",
>                     "description": "Playable URL of the ad's first video."
>                   },
>                   "coverUrl": {
>                     "x-anyapi-domain": "tiktokcdn.com",
>                     "x-anyapi-must-populate": true,
>                     "type": "string",
>                     "description": "Cover image URL of the ad's first video."
>                   },
>                   "status": {
>                     "type": [
>                       "string",
>                       "null"
>                     ],
>                     "description": "TikTok's audit status code for the ad, as the ad library reports it. Null when the serving source does not report it."
>                   },
>                   "format": {
>                     "type": [
>                       "string",
>                       "null"
>                     ],
>                     "description": "TikTok's creative format code for the ad, as the ad library reports it. Null when the serving source does not report it."
>                   }
>                 }
>               }
>             }
>           }
>         }
>       ]
>     }
>   }
> }
> ```

## Fields that must never come back empty

* `adId`
* `adTitle`
* `ads`
* `coverUrl`
* `videoUrl`

The repository marks these fields as ones every source must be able to fill. An empty value is only correct when the entity itself genuinely has nothing there.

## Not found, and how it differs from empty

When the entity does not exist, answer 2xx with the not-found shape:

```json theme={"dark"}
{
  "found": false,
  "data": null
}
```

An empty list is not a not-found: when the entity exists and has nothing to return, answer 2xx with `found: true` and an empty `ads` array.

This output schema declares no `reason` field, so `found: false` is the whole not-found answer.

## Example request

```json theme={"dark"}
{
  "query": "spotify"
}
```

The registration tests send this example to your endpoint, with the API's other test inputs. After that, the real-request check sends your endpoint real past customer inputs, and an AI reviewer compares each answer with AnyAPI's own answer to the same input.

## Next

* [The operator endpoint contract](https://getanyapi.com/docs/sell/operator-endpoint-contract.md) for signing, budgets, and the real-request check.
* [Every API open to sellers](https://getanyapi.com/docs/sell/apis/index.md).
* Want to sell an API that is not on that list? Email [support@getanyapi.com](mailto:support@getanyapi.com).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.