{
  "openapi": "3.0.1",
  "info": {
    "title": "TikTok Ads Library Scraper: EU Ads, No Login",
    "description": "Scrape the TikTok Ad Library (EU Commercial Content Library) by advertiser or keyword across 32 EEA, Swiss and UK markets, no login. Advertiser, first and last shown, reach band, video and image URLs, status, and DSA targeting by country, age and gender on request. JSON, CSV, API. Pay per ad.",
    "version": "0.1",
    "x-build-id": "zgdeTUqYw44Rn5WzN"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/automation_craft~tiktok-ads-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-automation_craft-tiktok-ads-library-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/automation_craft~tiktok-ads-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-automation_craft-tiktok-ads-library-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/automation_craft~tiktok-ads-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-automation_craft-tiktok-ads-library-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "queries": {
            "title": "Advertiser names, keywords or Ad Library URLs",
            "type": "array",
            "description": "One per line: an advertiser name or keyword exactly as you would type it into the Ad Library search box (for example \"nike\"), or a pasted library.tiktok.com URL (its region, dates and filters are applied to that query; an ads/detail URL fetches that one ad). Leave empty with a region set to list every ad shown in that country.",
            "items": {
              "type": "string"
            }
          },
          "regions": {
            "title": "Ad target countries",
            "type": "array",
            "description": "The EEA, Swiss and UK markets the Ad Library serves (the EU Digital Services Act scope). Pick several to run every query in each. Through the API pass ISO codes or names, or \"all\" for every market.",
            "items": {
              "type": "string",
              "enum": [
                "AT",
                "BE",
                "BG",
                "CH",
                "CY",
                "CZ",
                "DE",
                "DK",
                "EE",
                "ES",
                "FI",
                "FR",
                "GB",
                "GR",
                "HR",
                "HU",
                "IE",
                "IS",
                "IT",
                "LI",
                "LT",
                "LU",
                "LV",
                "MT",
                "NL",
                "NO",
                "PL",
                "PT",
                "RO",
                "SE",
                "SI",
                "SK"
              ],
              "enumTitles": [
                "Austria (AT)",
                "Belgium (BE)",
                "Bulgaria (BG)",
                "Switzerland (CH)",
                "Cyprus (CY)",
                "Czech Republic (CZ)",
                "Germany (DE)",
                "Denmark (DK)",
                "Estonia (EE)",
                "Spain (ES)",
                "Finland (FI)",
                "France (FR)",
                "United Kingdom (GB)",
                "Greece (GR)",
                "Croatia (HR)",
                "Hungary (HU)",
                "Ireland (IE)",
                "Iceland (IS)",
                "Italy (IT)",
                "Liechtenstein (LI)",
                "Lithuania (LT)",
                "Luxembourg (LU)",
                "Latvia (LV)",
                "Malta (MT)",
                "Netherlands (NL)",
                "Norway (NO)",
                "Poland (PL)",
                "Portugal (PT)",
                "Romania (RO)",
                "Sweden (SE)",
                "Slovenia (SI)",
                "Slovakia (SK)"
              ]
            }
          },
          "adIds": {
            "title": "Ad ids",
            "type": "array",
            "description": "Ad Library ad ids to fetch directly (the number in library.tiktok.com/ads/detail/?ad_id=...). Each returns the current record of that ad with its detail block when \"Fetch ad details\" is on. Unknown ids are reported and free.",
            "items": {
              "type": "string"
            }
          },
          "advertiserIds": {
            "title": "Advertiser business ids",
            "type": "array",
            "description": "TikTok business ids (adv_biz_ids in an Ad Library URL) to restrict the search to those advertisers. Combined with every query and region.",
            "items": {
              "type": "string"
            }
          },
          "lastShownAfter": {
            "title": "Last shown from",
            "type": "string",
            "description": "Start of the \"last shown\" window (YYYY-MM-DD). Default: one year back, the most the library keeps."
          },
          "lastShownBefore": {
            "title": "Last shown until",
            "type": "string",
            "description": "End of the window (YYYY-MM-DD). Default: today."
          },
          "adType": {
            "title": "Ad type",
            "enum": [
              "0",
              "1",
              "2"
            ],
            "type": "string",
            "description": "TikTok's ad_type filter: 0 keeps every ad, 1 and 2 are the two content types the library distinguishes (each row carries its adType). Measured on one advertiser: 685 ads in total, 336 of type 1.",
            "default": "0"
          },
          "gender": {
            "title": "Audience gender",
            "enum": [
              "ALL",
              "MALE",
              "FEMALE"
            ],
            "type": "string",
            "description": "Keep ads whose declared audience gender matches. ALL keeps every ad.",
            "default": "ALL"
          },
          "maxAdsPerQuery": {
            "title": "Max ads per query",
            "minimum": 0,
            "maximum": 1000000,
            "type": "integer",
            "description": "Cap per query x region. 0 means everything the library serves. One query is capped at 5,000 rows by TikTok; the Actor splits the date window automatically to get past it."
          },
          "maxAds": {
            "title": "Max ads (total)",
            "minimum": 0,
            "maximum": 1000000,
            "type": "integer",
            "description": "Hard cap on delivered, charged ads for the whole run. 0 means no cap."
          },
          "includeDetails": {
            "title": "Fetch ad details (DSA targeting)",
            "type": "boolean",
            "description": "Adds the \"Ad details\" block to each ad: unique users seen by country, age and gender, the targeting the advertiser declared (locations, languages, interests, devices), landing URL, call to action, objective and subject. $8.00 per 1,000 detail records delivered. TikTok opens the detail endpoint for some page loads and refuses it for others, so the Actor reads details while a load is open and reloads the query page on the first refusal (up to six reloads per page): expect a few ads with details per minute per worker, and set a cap below."
          },
          "maxDetails": {
            "title": "Max detail records",
            "minimum": 0,
            "maximum": 1000000,
            "type": "integer",
            "description": "Cap on ads that get the detail block (the rest are delivered without it). 0 means every delivered ad.",
            "default": 0
          },
          "dedupMemoryName": {
            "title": "Dedup memory name (only new ads on later runs)",
            "type": "string",
            "description": "Name this monitor, for example \"competitor-watch\". Ads delivered under that name are remembered in a key-value store the Actor creates in your account and are never delivered or charged again. Schedule the run and you have a change feed."
          },
          "resetDedupMemory": {
            "title": "Reset this memory first",
            "type": "boolean",
            "description": "Forget everything stored under the memory name before running.",
            "default": false
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Leave the default (Apify datacenter proxy). The Ad Library token is bound to the exit IP, so each worker keeps one sticky session; a refused exit is retired automatically.",
            "default": {
              "useApifyProxy": true
            }
          },
          "maxConcurrency": {
            "title": "Parallel queries",
            "minimum": 1,
            "maximum": 3,
            "type": "integer",
            "description": "How many query x region jobs run at the same time, each in its own browser context on its own exit IP. 2 fits the default memory; 3 needs 2 GB.",
            "default": 2
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}