{
  "openapi": "3.0.1",
  "info": {
    "title": "TikTok Ads Library Scraper | Export & Changes",
    "description": "Export TikTok Commercial Content Library ads by keyword or advertiser, with available media, reach and targeting. Compare full exports with disappearance safeguards.",
    "version": "0.1",
    "x-build-id": "6Jj9HscWp8CftHTgx"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/danthedataman~tiktok-commercial-ads-change-feed/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-danthedataman-tiktok-commercial-ads-change-feed",
        "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/danthedataman~tiktok-commercial-ads-change-feed/runs": {
      "post": {
        "operationId": "runs-sync-danthedataman-tiktok-commercial-ads-change-feed",
        "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/danthedataman~tiktok-commercial-ads-change-feed/run-sync": {
      "post": {
        "operationId": "run-sync-danthedataman-tiktok-commercial-ads-change-feed",
        "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": {
          "advertisers": {
            "title": "Advertisers",
            "type": "array",
            "description": "Exact advertiser suggestion names with an optional matching businessId. A business ID alone cannot resolve a name. A blank name explicitly browses advertiser mode and cannot carry an ID. With fetchDetails false, name-only requests verify card names; supplying businessId forces details and verifies each ad ID/name. Omitted/null/empty arrays request no advertiser queries.",
            "items": {
              "type": "object",
              "required": [
                "name"
              ],
              "properties": {
                "name": {
                  "title": "Advertiser name",
                  "type": "string",
                  "editor": "textfield",
                  "description": "Exact name from the Library's advertiser suggestions, case insensitive. An explicit blank name browses the source's advertiser mode."
                },
                "businessId": {
                  "title": "Business ID",
                  "type": "string",
                  "editor": "textfield",
                  "nullable": true,
                  "description": "Optional numeric string, verified against the resolved name and every returned ad. Supplying it forces details even with fetchDetails false. Cannot accompany a blank name."
                }
              }
            }
          },
          "searchTerms": {
            "title": "Keywords",
            "type": "array",
            "description": "Keyword searches across advertisers. An explicit blank string browses the source's keyword mode. Empty/omitted/null arrays request no keyword queries.",
            "items": {
              "type": "string"
            }
          },
          "regions": {
            "title": "Regions",
            "type": "array",
            "description": "Proven Library regions: 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. Include all (case insensitive) to select every supported region once. Each is a separate query. Empty/omitted/null selects no advertiser or keyword queries; adUrls carry their own region.",
            "items": {
              "type": "string"
            }
          },
          "startDate": {
            "title": "First date",
            "type": "string",
            "description": "Optional inclusive UTC YYYY-MM-DD search boundary. Omitted/null is 30 days before endDate (or today's UTC date). Use an explicit fixed range when comparing campaign membership over time."
          },
          "endDate": {
            "title": "Last date",
            "type": "string",
            "description": "Optional inclusive UTC YYYY-MM-DD search boundary. Omitted/null is today's UTC date."
          },
          "maxItems": {
            "title": "Maximum ads per query",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum distinct ads scanned for each advertiser/keyword and region, including unchanged ads. Omitted/null uses 100; 0 requests no work. A cap prevents ended inference unless the entire query is read."
          },
          "fetchDetails": {
            "title": "Fetch ad details",
            "type": "boolean",
            "description": "Omitted/null uses true. False exports only list-card fields, without per-ad detail calls; advertiser business ID and other detail-only fields are null/empty. Named advertisers are checked against each card. A supplied businessId forces details for that request, and direct URLs always use their detail endpoint. Baselines must match the effective basic/detail mode for every query."
          },
          "baselineDatasetId": {
            "title": "Baseline dataset",
            "type": "string",
            "description": "Optional read-only full export dataset from this Actor with the same advertiser/keyword, region, date and effective basic/detail mode inputs. Switches to new/changed/ended rows. Unchanged ads are omitted. Change-feed datasets, malformed rows and mismatched query contexts or modes are refused."
          },
          "adUrls": {
            "title": "Library URLs",
            "type": "array",
            "description": "Optional full https://library.tiktok.com/ads search URLs with one supported region, or /ads/detail/?ad_id=ID URLs. Search URL query, exact second-resolution dates and ad type are retained. Each omitted URL date inherits its top-level startDate/endDate; a URL-supplied date wins. Non-default audience/status/sort filters are refused. Detail URLs select one ad independently of region/date filters. Empty/omitted/null requests no URL queries.",
            "items": {
              "type": "string"
            }
          },
          "adType": {
            "title": "Ad type",
            "enum": [
              "ALL",
              "VIDEO",
              "IMAGE",
              "TEXT"
            ],
            "type": "string",
            "description": "Keyword/advertiser filter; omitted/null uses ALL. Search URLs can supply ad_type. Direct detail URLs ignore this filter."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}