{
  "openapi": "3.0.1",
  "info": {
    "title": "Douyin Scraper — TikTok China API & Video Downloader",
    "description": "Douyin scraper for TikTok China — extract video data, user profiles, comments, reply threads, and keyword search. KOL discovery, view counts, engagement metrics, China market research. Seven operations, one clean dataset per run. No API key.",
    "version": "1.0",
    "x-build-id": "oh07LukyrqUvkqEqR"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/sian.agency~douyin-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-sian.agency-douyin-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/sian.agency~douyin-scraper/runs": {
      "post": {
        "operationId": "runs-sync-sian.agency-douyin-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/sian.agency~douyin-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-sian.agency-douyin-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",
        "required": [
          "operation"
        ],
        "properties": {
          "operation": {
            "title": "🎯 Operation — what do you want to scrape?",
            "enum": [
              "videoDetail",
              "userDetail",
              "userVideos",
              "videoComments",
              "videoSubComments",
              "searchVideo",
              "searchUser"
            ],
            "type": "string",
            "description": "🎯 **PICK ONE OPERATION PER RUN.** Each run produces one clean dataset matching the chosen mode.\n\n- **🎥 Video Detail** — deep scrape of a single Douyin video by ID (caption, play/like/share/comment counts, video URLs, cover, music, creator info)\n- **👤 User Profile** — full profile by Sec UID (followers, total likes, post count, bio, verification, location, avatars)\n- **📹 User Videos** — paginated list of a creator's full video history (~20 videos/page)\n- **💬 Video Comments** — paginated top-level comments on a single video (~20 comments/page)\n- **🧵 Video Sub-Comments** — paginated reply threads under a specific comment (~10 replies/page)\n- **🔍 Search Videos** — keyword search across Douyin videos, paginated (~12 results/page)\n- **🔎 Search Users** — keyword search across Douyin creators, paginated (~19 results/page)\n\n💡 **TIP:** To combine operations (e.g. search → drill into top creators), run the actor multiple times with different configurations.",
            "default": "searchVideo"
          },
          "videoId": {
            "title": "🎥 Video ID (for Video Detail / Comments / Sub-Comments)",
            "type": "string",
            "description": "🎥 **Required for `Video Detail`, `Video Comments`, and `Video Sub-Comments` operations.**\n\nThe numeric Douyin video ID (also called `aweme_id`). You can find it:\n- In any Douyin video URL: `https://www.douyin.com/video/{ID}` → the trailing segment\n- In the `videoId` / `aweme_id` field of any search or user-videos result row\n\n💡 **TIP:** To analyze a batch of videos, run a `Search Videos` operation first, copy the `videoId` values, then run `Video Detail` or `Video Comments` per ID.\n\n⚠️ **Ignored** for User Profile, User Videos, and Search operations."
          },
          "commentId": {
            "title": "💬 Comment ID (for Video Sub-Comments)",
            "type": "string",
            "description": "💬 **Required for `Video Sub-Comments` operation only.**\n\nThe numeric comment ID (also called `cid`) whose reply thread you want to extract. You can find it:\n- In the `commentId` / `cid` field of any `Video Comments` result row\n- Only comments with `replyCount > 0` will return reply data\n\n💡 **TIP:** Run `Video Comments` first to identify high-engagement comments, then run `Video Sub-Comments` with those comment IDs to pull the full conversation tree.\n\n⚠️ **Ignored** for all other operations."
          },
          "secUid": {
            "title": "👤 Sec UID (for User Profile / User Videos)",
            "type": "string",
            "description": "👤 **Required for `User Profile` and `User Videos` operations.**\n\nThe Douyin `sec_uid` — an encrypted user handle starting with `MS4wLjAB...`. You can find it:\n- In the `secUid` / `sec_uid` field of any video, search, or comment result row\n- In a creator's profile URL: `https://www.douyin.com/user/{SEC_UID}`\n\n💡 **TIP:** To build a list of creators in a niche, run `Search Users` with a keyword first, then use the top `secUid` values to drill into individual profiles or video catalogs.\n\n⚠️ **Ignored** for Video Detail, Comments, and Search operations."
          },
          "keyword": {
            "title": "🔍 Search Keyword (for Search Videos / Search Users)",
            "type": "string",
            "description": "🔍 **Required for `Search Videos` and `Search Users` operations.**\n\nAny Douyin search query. Supports Chinese, English, and mixed queries:\n- `美食` (food)\n- `搞笑视频` (funny videos)\n- `dance`\n- `fashion`\n\n💡 **TIP:** Chinese-language queries surface the most relevant native Douyin creators. Specific niches return higher-quality results than broad terms."
          },
          "maxPages": {
            "title": "📄 Max pages to fetch",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "📄 **Applies to paginated operations** (User Videos, Video Comments, Video Sub-Comments, Search Videos, Search Users). Ignored for single-record operations (Video Detail, User Profile).\n\n- **User Videos:** ~20 videos per page\n- **Video Comments:** ~20 comments per page\n- **Video Sub-Comments:** ~10 replies per page\n- **Search Videos:** ~12 results per page\n- **Search Users:** ~19 results per page\n\n💡 **TIP:** Start small (1–3 pages) to preview results before scaling up.\n\n⚠️ Hard cap: 50 pages to prevent runaway runs.",
            "default": 5
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}