{
  "openapi": "3.0.1",
  "info": {
    "title": "TikTok Ads Library Scraper — EU Ad Library & Top Ads",
    "description": "Scrape TikTok's EU Ad Library (advertiser, ad text, video, first/last shown, reach by country, targeting) and Creative Center Top Ads (CTR, likes, industry, objective). Only-new monitor mode, advertiser summary. Pay per ad.",
    "version": "0.1",
    "x-build-id": "ZhNnAO9C2u7MNk5YV"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/latentlark~tiktok-ads-library/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-latentlark-tiktok-ads-library",
        "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/latentlark~tiktok-ads-library/runs": {
      "post": {
        "operationId": "runs-sync-latentlark-tiktok-ads-library",
        "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/latentlark~tiktok-ads-library/run-sync": {
      "post": {
        "operationId": "run-sync-latentlark-tiktok-ads-library",
        "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",
        "required": [
          "source"
        ],
        "properties": {
          "source": {
            "title": "Source",
            "enum": [
              "euLibrary",
              "topAds",
              "both"
            ],
            "type": "string",
            "description": "**EU Ad Library** = TikTok's DSA transparency archive: every ad shown in the EU/EEA, Switzerland, the UK and Turkey, with first/last shown, reach by country and targeting. **Top Ads** = TikTok Creative Center's curated best performers (US and 27 other markets) with CTR, likes, industry and objective. **Both** runs them one after the other.",
            "default": "euLibrary"
          },
          "keywords": {
            "title": "Keywords / advertiser names",
            "type": "array",
            "description": "EU Ad Library: searched in advertiser name and ad text (e.g. `nike`, `meal kit`). Wrap in double quotes for an exact phrase (`\"hello fresh\"`). Top Ads: ignored unless `matchKeywords` is true in Top Ads filters (keyword search on Creative Center needs a login, so we filter client-side).",
            "items": {
              "type": "string"
            }
          },
          "advertisers": {
            "title": "Advertisers (EU Library)",
            "type": "array",
            "description": "EU Ad Library only. Advertiser name (resolved via TikTok's advertiser suggestions; exact legal name works best, e.g. `NIKE Retail B.V.`), `Exact Name|bizId`, or an advertiser link from an ad detail page (`library.tiktok.com/ads?adv_name=...&adv_biz_ids=...`). Returns only that advertiser's ads.",
            "items": {
              "type": "string"
            }
          },
          "countries": {
            "title": "Countries",
            "type": "array",
            "description": "2-letter codes. EU Ad Library: EU/EEA + CH, GB, TR (empty = all regions). Top Ads: one of 28 markets such as US, GB, DE, FR, JP, BR, or `ALL` (empty = US). US ads are only available from Top Ads.",
            "items": {
              "type": "string"
            }
          },
          "dateRange": {
            "title": "Date range (EU Library)",
            "enum": [
              "last7days",
              "last30days",
              "last90days",
              "lastYear",
              "custom"
            ],
            "type": "string",
            "description": "Ads shown in this window. 'custom' uses startDate/endDate.",
            "default": "last30days"
          },
          "startDate": {
            "title": "Start date",
            "type": "string",
            "description": "YYYY-MM-DD, used when dateRange = custom."
          },
          "endDate": {
            "title": "End date",
            "type": "string",
            "description": "YYYY-MM-DD, used when dateRange = custom."
          },
          "onlyActive": {
            "title": "Only active ads (EU Library)",
            "type": "boolean",
            "description": "Only ads that are still running (EU Library ad_status=1).",
            "default": false
          },
          "topAds": {
            "title": "Top Ads filters (Creative Center)",
            "type": "object",
            "description": "Creative Center Top Ads options. {period: 7|30|180 or a list, sortBy: for_you|ctr|like|impression|play_6s_rate|cvr, industry: label (e.g. \"Beauty & Personal Care\") or numeric id, or a list, objective: label (e.g. \"Conversions\") or id, or a list, adLanguage: e.g. \"en\", slice: true (default; combines sort orders and industry/objective sub-filters to get past TikTok's 20-ads-per-filter limit), matchKeywords: false (true = keep only Top Ads whose text/brand contains one of the keywords; TikTok's keyword search needs a login)}. Countries for Top Ads: 28 markets (US, GB, DE, FR, JP, BR, ...) or ALL."
          },
          "maxAdsPerQuery": {
            "title": "Max ads per keyword/advertiser",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "EU Ad Library: per keyword/advertiser and country. Top Ads: per country × period × industry/objective. The Actor auto-slices past TikTok's per-query ceilings (EU short pages, Top Ads' 20-ads anonymous cap) and dedupes by ad id. Keep it low for a test run.",
            "default": 200
          },
          "includeDetails": {
            "title": "Include details (reach by country, targeting, landing page)",
            "type": "boolean",
            "description": "One extra request per ad: landing page, call to action, objective, advertiser business ID and TikTok handle, reach by country and age/gender/interest targeting (EU); landing page, countries, comments/shares, keywords (Top Ads). Charged as `ad-details` only when the detail fetch succeeds.",
            "default": true
          },
          "detailSessions": {
            "title": "Detail sessions (proxy IPs)",
            "minimum": 1,
            "maximum": 8,
            "type": "integer",
            "description": "Parallel EU sessions, one per proxy IP, used for detail fetches. Ignored without a proxy.",
            "default": 3
          },
          "onlyNewSinceLastRun": {
            "title": "Only new ads since last run",
            "type": "boolean",
            "description": "Monitor mode: skip ads already returned for this Monitor key in earlier runs (skipped ads are not charged). Schedule it weekly to get only new competitor ads.",
            "default": false
          },
          "monitorKey": {
            "title": "Monitor key",
            "type": "string",
            "description": "Name of the saved state for only-new mode, one per watchlist (e.g. `nike-weekly`). Leave empty to use `default`. Use a different key per schedule, or two schedules will share (and consume) the same seen-ads list."
          },
          "outputAdvertiserSummary": {
            "title": "Output advertiser summary rows",
            "type": "boolean",
            "description": "Add one `advertiserSummary` row per advertiser (ad count, new ads, countries, industries, landing domains). Top Ads often has no brand name, so those ads are grouped by landing domain and only groups with 2+ ads get a row. Charged as `advertiser-summary`.",
            "default": true
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Apify datacenter proxy works for both sources (tested). Residential is not needed.",
            "default": {
              "useApifyProxy": true
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}