{
  "openapi": "3.0.1",
  "info": {
    "title": "TikTok Commercial Content Library Ads Scraper",
    "description": "Scrape public TikTok ads from the Commercial Content Library without login or an API key. Search by country, keyword, advertiser, dates, ad type, status, reach and audience, then extract advertiser, targeting, captions, CTAs, landing pages and media URLs.",
    "version": "0.1",
    "x-build-id": "PDFeThaHgiJzmB6tF"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/datascraperes~tiktok-ads-commercial-library/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-datascraperes-tiktok-ads-commercial-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/datascraperes~tiktok-ads-commercial-library/runs": {
      "post": {
        "operationId": "runs-sync-datascraperes-tiktok-ads-commercial-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/datascraperes~tiktok-ads-commercial-library/run-sync": {
      "post": {
        "operationId": "run-sync-datascraperes-tiktok-ads-commercial-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": {
          "regions": {
            "title": "Countries where to search",
            "minItems": 1,
            "maxItems": 20,
            "uniqueItems": true,
            "type": "array",
            "description": "Select one or more countries. The actor searches ads from each selected market; the technical country codes are handled automatically.",
            "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",
                "TR"
              ],
              "enumTitles": [
                "Austria",
                "Belgium",
                "Bulgaria",
                "Switzerland",
                "Cyprus",
                "Czech Republic",
                "Germany",
                "Denmark",
                "Estonia",
                "Spain",
                "Finland",
                "France",
                "United Kingdom",
                "Greece",
                "Croatia",
                "Hungary",
                "Ireland",
                "Iceland",
                "Italy",
                "Liechtenstein",
                "Lithuania",
                "Luxembourg",
                "Latvia",
                "Malta",
                "Netherlands",
                "Norway",
                "Poland",
                "Portugal",
                "Romania",
                "Sweden",
                "Slovenia",
                "Slovakia",
                "Turkey"
              ]
            },
            "default": [
              "ES"
            ]
          },
          "searchTerms": {
            "title": "Keywords, brand or advertiser names",
            "maxItems": 50,
            "type": "array",
            "description": "Optional public search terms. The CCL search box accepts brand, product and advertiser keywords. One search is run per term and region. Leave empty to browse the latest ads for the selected region.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "default": []
          },
          "advertiserBusinessIds": {
            "title": "Advertiser business IDs",
            "maxItems": 100,
            "type": "array",
            "description": "Optional advertiser business IDs exposed by the CCL advertiser link. This is an advanced exact filter and can be combined with the search term.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "default": []
          },
          "queryType": {
            "title": "Search query type",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "Internal public CCL query type. 1 is the current keyword/advertiser search used by the website. Other values are accepted for future CCL changes but are less validated.",
            "default": 1
          },
          "startDate": {
            "title": "First shown date",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "Inclusive UTC date in YYYY-MM-DD. Defaults to 30 days before endDate."
          },
          "endDate": {
            "title": "Last shown date",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "Inclusive UTC date in YYYY-MM-DD. Defaults to today."
          },
          "sortType": {
            "title": "Sort order",
            "enum": [
              "create_time,desc",
              "last_shown_time,desc",
              "reach,desc"
            ],
            "type": "string",
            "description": "Public CCL ordering: newest published, most recently shown or largest audience first.",
            "default": "create_time,desc"
          },
          "adType": {
            "title": "Ad type",
            "minimum": 0,
            "maximum": 20,
            "type": "integer",
            "description": "Public CCL ad_type value: 0 = all types, 1 = video, 2 = image, 3 = text. The numeric field remains open for future library values.",
            "default": 0
          },
          "adStatus": {
            "title": "Ad status",
            "minimum": 0,
            "maximum": 20,
            "type": "integer",
            "description": "Public CCL ad_status value: 0 = all statuses, 1 = active, 2 = inactive. The numeric field remains open for future library values.",
            "default": 1
          },
          "ageRanges": {
            "title": "Audience age ranges",
            "maxItems": 20,
            "type": "array",
            "description": "Optional age targeting values exposed by the library. Use all, or 13-17, 18-24, 25-34, 35-44, 45-54 and 55+. The actor converts these labels to the public values used by CCL.",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "default": [
              "all"
            ]
          },
          "reachRanges": {
            "title": "Audience reach ranges",
            "maxItems": 20,
            "type": "array",
            "description": "Optional reach bands exposed by the library. Use all, or exact public labels such as 0-1K, 1K-10K, 10K-100K, 100K-200K, 200K-300K, 300K-400K, 400K-500K and 500K-600K. New bands are passed through unchanged.",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "default": [
              "all"
            ]
          },
          "gender": {
            "title": "Audience gender",
            "enum": [
              "ALL",
              "MALE",
              "FEMALE"
            ],
            "type": "string",
            "description": "Audience gender filter exposed by CCL.",
            "default": "ALL"
          },
          "locale": {
            "title": "Response language",
            "enum": [
              "auto",
              "es",
              "en",
              "de",
              "fr",
              "it",
              "pt",
              "nl",
              "pl",
              "sv",
              "da",
              "fi",
              "no",
              "cs",
              "el",
              "ro",
              "hu",
              "tr"
            ],
            "type": "string",
            "description": "Automatic selects the natural language for each country. You can override it when you want all details in one language. This does not translate the original ad creative.",
            "default": "auto"
          },
          "maxAds": {
            "title": "Maximum ads",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Hard total limit across all selected regions and search terms.",
            "default": 100
          },
          "maxPages": {
            "title": "Maximum pages per search",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Pagination safety limit. The public CCL currently returns up to 12 results per search request/page.",
            "default": 10
          },
          "includeDetails": {
            "title": "Fetch ad details",
            "type": "boolean",
            "description": "Enrich each result with advertiser, dates, objective, reach, targeting, caption, CTA, landing page and public TikTok profile fields.",
            "default": true
          },
          "saveErrors": {
            "title": "Save diagnostic rows",
            "type": "boolean",
            "description": "Save one compact diagnostic record when a query or detail cannot be collected.",
            "default": 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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}