{
  "openapi": "3.0.1",
  "info": {
    "title": "TikTok Ad Library Scraper 🔥 $0.5/1K",
    "description": "From 💰 $0.5/1K - Scrape TikTok Ad Library and Commercial Content from library.tiktok.com. Paste a URL or use search filters. Export JSON, CSV or Excel with paid ads, branded creator posts, creatives, reach, audience demographics and advertiser data.",
    "version": "0.0",
    "x-build-id": "wTEcZ7MBAJ3f1Nft6"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/azzouzana~tiktok-ads-library/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-azzouzana-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/azzouzana~tiktok-ads-library/runs": {
      "post": {
        "operationId": "runs-sync-azzouzana-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/azzouzana~tiktok-ads-library/run-sync": {
      "post": {
        "operationId": "run-sync-azzouzana-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",
        "properties": {
          "startUrl": {
            "title": "🔗 Library URL",
            "type": "string",
            "description": "Paste a URL from `library.tiktok.com/ads` or `library.tiktok.com/other-commercial-content`. Website filters are kept, including multi-country (`region=FR,IT`), ages, unique reach, ad status, ad type, and gender. The actor auto-detects the mode, strips pagination params, and restarts from the first page. ✨"
          },
          "sourceType": {
            "title": "🎬 Mode",
            "enum": [
              "ad_library",
              "other_commercial_content"
            ],
            "type": "string",
            "description": "Choose which TikTok library section to scrape when no URL is provided.",
            "default": "ad_library"
          },
          "region": {
            "title": "🌍 Country / region",
            "uniqueItems": true,
            "type": "array",
            "description": "Ad Library: ad target countries. Other commercial content: creator countries. Select several, same as the website.",
            "items": {
              "type": "string",
              "enum": [
                "all",
                "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",
                "TR"
              ],
              "enumTitles": [
                "All countries",
                "AT — Austria",
                "BE — Belgium",
                "BG — Bulgaria",
                "CH — Switzerland",
                "CY — Cyprus",
                "CZ — Czech Republic",
                "DE — Germany",
                "DK — Denmark",
                "EE — Estonia",
                "ES — Spain",
                "FI — Finland",
                "FR — France",
                "GB — United Kingdom",
                "GR — Greece",
                "HR — Croatia",
                "HU — Hungary",
                "IE — Ireland",
                "IS — Iceland",
                "IT — Italy",
                "LI — Liechtenstein",
                "LT — Lithuania",
                "LU — Luxembourg",
                "LV — Latvia",
                "MT — Malta",
                "NL — Netherlands",
                "NO — Norway",
                "PL — Poland",
                "PT — Portugal",
                "RO — Romania",
                "SE — Sweden",
                "SI — Slovenia",
                "SK — Slovakia",
                "TR — Turkey"
              ]
            }
          },
          "ages": {
            "title": "🎂 Age intervals (Ad Library only)",
            "uniqueItems": true,
            "type": "array",
            "description": "Ad Library only — ignored for Other commercial content and when a Library URL is provided. Same age buckets as the website.",
            "items": {
              "type": "string",
              "enum": [
                "all",
                "13,17",
                "18,24",
                "25,34",
                "35,44",
                "45,54",
                "55,100"
              ],
              "enumTitles": [
                "All ages",
                "13–17",
                "18–24",
                "25–34",
                "35–44",
                "45–54",
                "55+"
              ]
            },
            "default": [
              "all"
            ]
          },
          "adReach": {
            "title": "📈 Unique reach (Ad Library only)",
            "uniqueItems": true,
            "type": "array",
            "description": "Ad Library only — ignored for Other commercial content and when a Library URL is provided. Same unique-reach buckets as the website.",
            "items": {
              "type": "string",
              "enum": [
                "all",
                "0-10K",
                "10K-100K",
                "100K+"
              ],
              "enumTitles": [
                "All reach",
                "Under 10K",
                "10K–100K",
                "Over 100K"
              ]
            },
            "default": [
              "all"
            ]
          },
          "adStatus": {
            "title": "📌 Ad status (Ad Library only)",
            "enum": [
              "0",
              "1",
              "2"
            ],
            "type": "string",
            "description": "Ad Library only — ignored for Other commercial content and when a Library URL is provided. Same Active / Inactive filter as the website.",
            "default": "0"
          },
          "adType": {
            "title": "🖼️ Ad type (Ad Library only)",
            "enum": [
              "0",
              "1",
              "2",
              "3"
            ],
            "type": "string",
            "description": "Ad Library only — ignored for Other commercial content and when a Library URL is provided. Creative format filter from the website.",
            "default": "0"
          },
          "gender": {
            "title": "👤 Gender (Ad Library only)",
            "enum": [
              "ALL",
              "FEMALE",
              "MALE"
            ],
            "type": "string",
            "description": "Ad Library only — ignored for Other commercial content and when a Library URL is provided.",
            "default": "ALL"
          },
          "dateFrom": {
            "title": "📅 Date from",
            "type": "string",
            "description": "Publication date / posted date start (`YYYY-MM-DD`).",
            "default": "2025-01-01"
          },
          "dateTo": {
            "title": "📅 Date to",
            "type": "string",
            "description": "Publication date / posted date end (`YYYY-MM-DD`). Leave empty to use today."
          },
          "searchQuery": {
            "title": "🔎 Search query",
            "type": "string",
            "description": "Ad Library: advertiser name or keyword. Other commercial content: creator username. Leave empty in Advanced mode to browse by country and date range only."
          },
          "sortBy": {
            "title": "↕️ Sort by",
            "enum": [
              "last_shown_newest",
              "last_shown_oldest",
              "publish_date_newest",
              "publish_date_oldest",
              "reach_low",
              "reach_high",
              "views_low",
              "views_high"
            ],
            "type": "string",
            "description": "One list for both modes. Publication / posted date is shared. Last shown and unique users seen are Ad Library only. Video views is Other commercial content only. Ignored when a Library URL is provided.",
            "default": "last_shown_newest"
          },
          "maxItems": {
            "title": "📊 Max items",
            "minimum": 10,
            "maximum": 3600,
            "type": "integer",
            "description": "Maximum results to scrape. Effective limit also respects run budget and free-tier cap (5 for free users). 💰",
            "default": 100
          },
          "extractDetails": {
            "title": "🎯 Extract ad details (Ad Library only)",
            "type": "boolean",
            "description": "Ad Library only — ignored for Other commercial content. Fetches extra targeting and reach fields per ad (+$0.50 / 1K when enabled). 🔍",
            "default": false
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}