{
  "openapi": "3.0.1",
  "info": {
    "title": "TikTok Ad Library Scraper: Ads & Targeting · $0.30/1K",
    "description": "TikTok Ad Library: search by keyword, phrase, advertiser, ad ID, country, date or URL. Video, image, landing page, CTA, run dates, viewers by country, targeting, payer, advertiser list, keyword ideas, new-ads monitor, transcript, AI analysis. No login or cookies needed.",
    "version": "1.0",
    "x-build-id": "J0abF6P6jLFNd0UFQ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/pomlabs~tiktok-ad-library-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-pomlabs-tiktok-ad-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/pomlabs~tiktok-ad-library-scraper/runs": {
      "post": {
        "operationId": "runs-sync-pomlabs-tiktok-ad-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/pomlabs~tiktok-ad-library-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-pomlabs-tiktok-ad-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": {
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Words searched in the ads, one search each.",
            "items": {
              "type": "string"
            }
          },
          "query": {
            "title": "Keyword",
            "type": "string",
            "description": "One word or phrase. A pasted Ad Library address also works here."
          },
          "queries": {
            "title": "Keywords (other name)",
            "type": "array",
            "description": "Same as Keywords.",
            "items": {
              "type": "string"
            }
          },
          "searchQueries": {
            "title": "Search queries",
            "type": "array",
            "description": "Same as Keywords.",
            "items": {
              "type": "string"
            }
          },
          "searchTerms": {
            "title": "Search terms",
            "type": "array",
            "description": "Same as Keywords.",
            "items": {
              "type": "string"
            }
          },
          "exactPhrases": {
            "title": "Exact phrases",
            "type": "array",
            "description": "Only ads that contain the words in this order.",
            "items": {
              "type": "string"
            }
          },
          "exactMatch": {
            "title": "Exact match",
            "type": "boolean",
            "description": "Treat every keyword as an exact phrase.",
            "default": false
          },
          "advertiserName": {
            "title": "Advertiser name",
            "type": "string",
            "description": "Brand or company. Every registered advertiser name that contains it is searched."
          },
          "advertiserNames": {
            "title": "Advertiser names",
            "type": "array",
            "description": "Several advertisers.",
            "items": {
              "type": "string"
            }
          },
          "advertisers": {
            "title": "Advertisers (names or ID + name)",
            "type": "array",
            "description": "Names, or objects like {\"id\": \"6886458055832109825\", \"name\": \"LEVI STRAUSS & CO.\"} taken from earlier results."
          },
          "advertiserBizId": {
            "title": "Advertiser ID",
            "type": "string",
            "description": "Advertiser ID, together with Advertiser name."
          },
          "queryType": {
            "title": "Query type",
            "enum": [
              "1",
              "2",
              "url"
            ],
            "type": "string",
            "description": "How to read Keyword: words, advertiser name or Ad Library address."
          },
          "startUrls": {
            "title": "Ad Library addresses",
            "type": "array",
            "description": "Pasted search pages or ad pages of library.tiktok.com, with their filters.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "searchUrls": {
            "title": "Search addresses",
            "type": "array",
            "description": "Same as above, as plain lines.",
            "items": {
              "type": "string"
            }
          },
          "adUrls": {
            "title": "Ad addresses",
            "type": "array",
            "description": "Pages of single ads.",
            "items": {
              "type": "string"
            }
          },
          "adIds": {
            "title": "Ad IDs",
            "type": "array",
            "description": "Numeric ad IDs.",
            "items": {
              "type": "string"
            }
          },
          "urlsFromFile": {
            "title": "Addresses from a file",
            "type": "string",
            "description": "Address of a .txt, .csv or Google Sheet with one library address per line."
          },
          "countries": {
            "title": "Countries",
            "type": "array",
            "description": "2-letter codes of the countries where the ad was shown (European Economic Area, CH, GB, TR, BR), or all. One search per country.",
            "items": {
              "type": "string"
            }
          },
          "country": {
            "title": "Country",
            "type": "string",
            "description": "One country code, or all."
          },
          "region": {
            "title": "Region",
            "type": "string",
            "description": "Same as Country."
          },
          "startDate": {
            "title": "Start date",
            "type": "string",
            "description": "YYYY-MM-DD, or for example 30 days. Default: the last 365 days."
          },
          "endDate": {
            "title": "End date",
            "type": "string",
            "description": "YYYY-MM-DD. Default: today."
          },
          "timezone": {
            "title": "Time zone",
            "type": "string",
            "description": "Time zone the dates are read in, for example Europe/Berlin. Default: UTC."
          },
          "adType": {
            "title": "Ad type",
            "enum": [
              "all",
              "video",
              "image"
            ],
            "type": "string",
            "description": "Video, image or all."
          },
          "adStatus": {
            "title": "Ad status",
            "enum": [
              "all",
              "active",
              "inactive",
              "0",
              "1",
              "2"
            ],
            "type": "string",
            "description": "Active, inactive or all."
          },
          "activeOnly": {
            "title": "Active ads only",
            "type": "boolean",
            "description": "Shortcut for Ad status: active.",
            "default": false
          },
          "ages": {
            "title": "Audience ages",
            "type": "array",
            "description": "Any of 13-17, 18-24, 25-34, 35-44, 45-54, 55+.",
            "items": {
              "type": "string"
            }
          },
          "adReach": {
            "title": "Audience reach",
            "type": "array",
            "description": "Any of 0-10K, 10K-100K, 100K+ unique viewers.",
            "items": {
              "type": "string"
            }
          },
          "gender": {
            "title": "Audience gender",
            "enum": [
              "ALL",
              "FEMALE",
              "MALE"
            ],
            "type": "string",
            "description": "Gender targeted by the ad."
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "last_shown",
              "newest",
              "oldest",
              "impressions",
              "longest_running",
              "last_shown_date,desc",
              "last_shown_date,asc",
              "create_time,desc",
              "create_time,asc",
              "impression,desc",
              "impression,asc"
            ],
            "type": "string",
            "description": "Order of the ads. With keywords, orders other than last shown are applied to the first 600 matches."
          },
          "includeKeywords": {
            "title": "Must contain",
            "type": "array",
            "description": "Keep only ads whose text, advertiser or landing page has one of these words.",
            "items": {
              "type": "string"
            }
          },
          "excludeKeywords": {
            "title": "Must not contain",
            "type": "array",
            "description": "Drop ads with any of these words.",
            "items": {
              "type": "string"
            }
          },
          "minDaysRunning": {
            "title": "Minimum days running",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only ads shown for at least this many days."
          },
          "removeDuplicates": {
            "title": "Remove duplicates",
            "type": "boolean",
            "description": "Deliver each ad once per run.",
            "default": true
          },
          "maxItems": {
            "title": "Maximum ads in the run",
            "minimum": 0,
            "type": "integer",
            "description": "Total cap for the run. 0 means no cap."
          },
          "maxAds": {
            "title": "Maximum ads (other name)",
            "minimum": 0,
            "type": "integer",
            "description": "Same as above."
          },
          "maxResults": {
            "title": "Maximum results",
            "minimum": 0,
            "type": "integer",
            "description": "Same as above."
          },
          "maxAdsPerSearch": {
            "title": "Maximum ads per search",
            "minimum": 0,
            "type": "integer",
            "description": "Cap for each search. 0 means every ad. Default: 20 when no other cap is given."
          },
          "resultsLimit": {
            "title": "Results limit",
            "minimum": 0,
            "type": "integer",
            "description": "Same as Maximum ads per search."
          },
          "maxPages": {
            "title": "Maximum pages",
            "minimum": 0,
            "type": "integer",
            "description": "Pages of 12 ads per search."
          },
          "quickSearch": {
            "title": "Quick search",
            "type": "boolean",
            "description": "Only the first page of each search.",
            "default": false
          },
          "includeDetails": {
            "title": "Ad details",
            "type": "boolean",
            "description": "Landing page, call to action, advertiser, payer, targeting and viewers by country. Charged per ad with details.",
            "default": true
          },
          "fetchDetails": {
            "title": "Fetch details",
            "type": "boolean",
            "description": "Same as Ad details."
          },
          "skipDetails": {
            "title": "Skip details",
            "type": "boolean",
            "description": "Faster and cheaper: list data only.",
            "default": false
          },
          "resultType": {
            "title": "Result type",
            "enum": [
              "ads",
              "advertisers",
              "keyword_ideas"
            ],
            "type": "string",
            "description": "Ads, advertiser names for a text, or keyword ideas for a text.",
            "default": "ads"
          },
          "analyzeAds": {
            "title": "AI marketing analysis",
            "type": "boolean",
            "description": "Hook, offer, audience and tone of each ad. Charged per ad analysed.",
            "default": false
          },
          "ocrImageAds": {
            "title": "Read text on the picture",
            "type": "boolean",
            "description": "Text written on the image or video cover. Charged per ad read.",
            "default": false
          },
          "transcribeVideos": {
            "title": "Transcribe videos",
            "type": "boolean",
            "description": "Speech of the ad video as text. Charged per video transcribed.",
            "default": false
          },
          "downloadMedia": {
            "title": "Download media",
            "type": "boolean",
            "description": "Save videos, images and covers with your results.",
            "default": false
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "all",
              "new-only"
            ],
            "type": "string",
            "description": "All ads, or only ads not delivered to you before.",
            "default": "all"
          },
          "onlyNewAds": {
            "title": "Only new ads",
            "type": "boolean",
            "description": "Same as Mode: only new ads."
          },
          "monitorName": {
            "title": "Monitor name",
            "type": "string",
            "description": "Name of a monitor: runs with the same name remember what they delivered."
          },
          "webhookUrl": {
            "title": "Webhook address",
            "type": "string",
            "description": "Address that receives the results when the run ends."
          },
          "webhookHeaders": {
            "title": "Webhook headers",
            "type": "object",
            "description": "Extra headers sent to the webhook."
          },
          "compact": {
            "title": "Compact output",
            "type": "boolean",
            "description": "Leave out long fields such as targeting tables.",
            "default": false
          },
          "excludeEmptyFields": {
            "title": "Exclude empty fields",
            "type": "boolean",
            "description": "Drop fields without a value.",
            "default": true
          },
          "concurrency": {
            "title": "Concurrency",
            "minimum": 0,
            "maximum": 8,
            "type": "integer",
            "description": "Ads processed at the same time by the AI extras.",
            "default": 3
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}