{
  "openapi": "3.0.1",
  "info": {
    "title": "TikTok Live Comments & Events Scraper — Unlimited",
    "description": "Capture every real-time event from any TikTok LIVE: comments, gifts, likes, joins, follows, shares, subscriptions, Q&A, polls, host & co-host tracking — zero message limits, truly unlimited. Cookies required for full access. Set duration to 0 for non-stop capture.",
    "version": "1.0",
    "x-build-id": "t3dGc0ePEBmfzogeM"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ben-belaouedj~tiktok-live-comments/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ben-belaouedj-tiktok-live-comments",
        "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/ben-belaouedj~tiktok-live-comments/runs": {
      "post": {
        "operationId": "runs-sync-ben-belaouedj-tiktok-live-comments",
        "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/ben-belaouedj~tiktok-live-comments/run-sync": {
      "post": {
        "operationId": "run-sync-ben-belaouedj-tiktok-live-comments",
        "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": [
          "username"
        ],
        "properties": {
          "username": {
            "title": "TikTok Username",
            "type": "string",
            "description": "The TikTok creator's username whose live stream you want to scrape (without the @ prefix). Example: cristiano"
          },
          "cookies": {
            "title": "TikTok Cookies (JSON array) — Required for unlimited access",
            "type": "array",
            "description": "Your TikTok session cookies exported as a JSON array from your browser. Required to avoid rate-limits, access private/restricted streams, and unlock full user metadata.\n\nHow to get your cookies:\n1. Log in to TikTok in Chrome or Firefox\n2. Install the 'Cookie-Editor' browser extension\n3. On tiktok.com, open Cookie-Editor and click Export → JSON\n4. Copy the full JSON array and paste it here\n\nThe cookies are stored locally and never shared. Key cookies: sessionid, sid_tt, odin_tt, ttwid."
          },
          "sign_api_key": {
            "title": "TikTok Sign API Key (optional)",
            "type": "string",
            "description": "Optional API key to sign TikTok WebSocket requests. Leave empty to use the default built-in key."
          },
          "max_duration_seconds": {
            "title": "Max Collection Duration — seconds (0 = unlimited)",
            "minimum": 0,
            "type": "integer",
            "description": "Stop collecting events after this many seconds. Set to 0 to run until the live stream ends naturally — truly unlimited.",
            "default": 0
          },
          "fetch_country": {
            "title": "Fetch User Country (slower)",
            "type": "boolean",
            "description": "Resolve the country of each commenter via an external lookup. Adds latency per event. Disable for maximum speed.",
            "default": false
          },
          "collect_comments": {
            "title": "Comments & @mention replies",
            "type": "boolean",
            "description": "Capture all live chat messages including @mention reply threads and input type metadata.",
            "default": true
          },
          "collect_gifts": {
            "title": "Gifts (diamonds, streaks)",
            "type": "boolean",
            "description": "Capture gifts sent during the stream: gift name, diamond value, repeat/streak count, and recipient.",
            "default": true
          },
          "collect_joins": {
            "title": "Viewer Joins",
            "type": "boolean",
            "description": "Capture events when viewers enter the live room, including their member count rank.",
            "default": true
          },
          "collect_likes": {
            "title": "Likes",
            "type": "boolean",
            "description": "Capture like events with per-event count and running total.",
            "default": true
          },
          "collect_follows": {
            "title": "New Follows",
            "type": "boolean",
            "description": "Capture follow events triggered during the live stream.",
            "default": true
          },
          "collect_shares": {
            "title": "Shares",
            "type": "boolean",
            "description": "Capture share events when viewers share the stream.",
            "default": true
          },
          "collect_subscriptions": {
            "title": "Subscriptions",
            "type": "boolean",
            "description": "Capture subscription events including subscription month and status.",
            "default": true
          },
          "collect_questions": {
            "title": "Q&A Questions",
            "type": "boolean",
            "description": "Capture questions submitted through the live Q&A feature.",
            "default": true
          },
          "collect_battles": {
            "title": "LinkMic Battles",
            "type": "boolean",
            "description": "Capture LinkMic battle events between the streamer and co-hosts.",
            "default": true
          },
          "collect_polls": {
            "title": "Polls",
            "type": "boolean",
            "description": "Capture poll creation and result events.",
            "default": true
          },
          "collect_pins": {
            "title": "Pinned Messages",
            "type": "boolean",
            "description": "Capture pinned message events in the live room.",
            "default": true
          },
          "collect_viewers": {
            "title": "Viewer Count Updates",
            "type": "boolean",
            "description": "Capture real-time viewer count, total user count, and popularity score updates.",
            "default": true
          },
          "collect_hosts": {
            "title": "Hosts & Co-hosts",
            "type": "boolean",
            "description": "Poll the TikTok LinkMic API every 15 seconds to detect who is currently host or co-host on the stream. Each new host/co-host detected is emitted as a 'host' event with role (host/co-host), user_id, unique_id, and nickname.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}