{
  "openapi": "3.0.1",
  "info": {
    "title": "TikTok Ads Scraper",
    "description": "TikTok Ads Scraper: ads from the TikTok Ad Library (EU/EEA/UK) by keyword or advertiser - ad id, advertiser, ad text, format, first and last shown dates, days running, reach, impressions, spend range, video and image links.",
    "version": "1.0",
    "x-build-id": "NvjucXpoe3W6PK30I"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/neuro-scraper~tiktok-ads-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-neuro-scraper-tiktok-ads-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/neuro-scraper~tiktok-ads-scraper/runs": {
      "post": {
        "operationId": "runs-sync-neuro-scraper-tiktok-ads-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/neuro-scraper~tiktok-ads-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-neuro-scraper-tiktok-ads-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": {
          "searchTerms": {
            "title": "Search terms",
            "type": "array",
            "description": "Advertiser names or keywords, one per line (e.g. \"nike\", \"temu\"). Each term is searched in every country.",
            "items": {
              "type": "string"
            }
          },
          "query": {
            "title": "Search query (single)",
            "type": "string",
            "description": "One search term as a single text. Added to Search terms."
          },
          "keyword": {
            "title": "Keyword (alias)",
            "type": "string",
            "description": "Same as Search query - kept so inputs from other tools work."
          },
          "advertiserName": {
            "title": "Advertiser name",
            "type": "string",
            "description": "Optional advertiser name to search for. Added to Search terms."
          },
          "adIds": {
            "title": "Ad ids",
            "type": "array",
            "description": "Optional TikTok ad ids or Ad Library ad links. The run searches the ad library of each country for the id and returns the matching ad.",
            "items": {
              "type": "string"
            }
          },
          "countries": {
            "title": "Countries",
            "type": "array",
            "description": "Two-letter codes of EU/EEA/UK countries (FR, DE, IT, ES, NL, PL, SE, GB...). Every term is searched in every country. The list of supported countries is read from the library at run time.",
            "items": {
              "type": "string"
            }
          },
          "country": {
            "title": "Country (single)",
            "type": "string",
            "description": "One country code as a single text. Added to Countries. \"all\" = every supported country in one search."
          },
          "startDate": {
            "title": "Start date",
            "type": "string",
            "description": "Ads shown on or after this date (YYYY-MM-DD). Default: the period below."
          },
          "endDate": {
            "title": "End date",
            "type": "string",
            "description": "Ads shown on or before this date (YYYY-MM-DD). Default: today."
          },
          "period": {
            "title": "Period (days)",
            "minimum": 1,
            "maximum": 365,
            "type": "integer",
            "description": "Used when Start date is empty: ads shown in the last N days.",
            "default": 30
          },
          "timezone": {
            "title": "Time zone",
            "type": "string",
            "description": "Time zone of Start date and End date (e.g. \"Europe/Paris\", \"America/New_York\"). Default UTC.",
            "default": "UTC"
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "last_shown_date,desc",
              "last_shown_date,asc",
              "impression,desc",
              "impression,asc",
              "create_time,desc",
              "create_time,asc"
            ],
            "type": "string",
            "description": "Order of the ads, as in the library: last shown date or impressions, newest/highest first or last.",
            "default": "last_shown_date,desc"
          },
          "searchType": {
            "title": "Search by",
            "enum": [
              "advertiser",
              "keyword"
            ],
            "type": "string",
            "description": "advertiser = the term is matched against advertiser names (default); keyword = against the ad text.",
            "default": "advertiser"
          },
          "adType": {
            "title": "Ad format",
            "enum": [
              "ALL",
              "VIDEO",
              "IMAGE"
            ],
            "type": "string",
            "description": "Keep all ads, only video ads or only image ads.",
            "default": "ALL"
          },
          "adLanguage": {
            "title": "Interface language",
            "type": "string",
            "description": "Language code for texts the library translates (en, fr, de...).",
            "default": "en"
          },
          "resolveAdDetails": {
            "title": "Include ad details",
            "type": "boolean",
            "description": "Also ask the library for each ad's detail record (targeting, paid-for-by, reach per country). When the library does not answer it, the row keeps the search data and `detailFetched` is false.",
            "default": false
          },
          "includeAudienceBreakdown": {
            "title": "Include reach breakdown",
            "type": "boolean",
            "description": "Adds `audienceBreakdown`: reach per country x age group x gender for each ad (one list entry per combination). Turns on Include ad details.",
            "default": false
          },
          "maxItems": {
            "title": "Max ads per term and country",
            "minimum": 1,
            "maximum": 3600,
            "type": "integer",
            "description": "How many ads to collect per search term and country. The library pages 12 ads at a time and follows its own next-page cursor.",
            "default": 50
          },
          "maxPages": {
            "title": "Max pages per term",
            "minimum": 0,
            "type": "integer",
            "description": "Upper limit of library pages (12 ads each) per term and country. 0 = no page limit (Max ads decides).",
            "default": 0
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "How many term + country searches run in parallel.",
            "default": 5
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Proxy for the requests. Default: Apify residential.",
            "default": {
              "useApifyProxy": true,
              "apifyProxyGroups": [
                "RESIDENTIAL"
              ]
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}