{
  "openapi": "3.0.1",
  "info": {
    "title": "TikTok Trending Videos Scraper & Hashtag Sound Extractor",
    "description": "TikTok Trending Videos Scraper: Discover trending videos and extract hashtags, sounds, captions, creators, views, likes, shares, comments, and engagement data. Track viral content, analyze trends, research creators, monitor competitors, and build structured datasets for TikTok analytics.",
    "version": "0.1",
    "x-build-id": "KzfMtH9aVWGKIpIGy"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapier~tiktok-trending-videos-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapier-tiktok-trending-videos-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/scrapier~tiktok-trending-videos-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapier-tiktok-trending-videos-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/scrapier~tiktok-trending-videos-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapier-tiktok-trending-videos-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": [
          "countryCode",
          "sortBy"
        ],
        "properties": {
          "countryCode": {
            "title": "🌐 Country Code",
            "enum": [
              "AU",
              "BR",
              "CA",
              "EG",
              "FR",
              "DE",
              "ID",
              "IL",
              "IT",
              "JP",
              "MY",
              "PH",
              "RU",
              "SA",
              "SG",
              "KR",
              "ES",
              "TW",
              "TH",
              "TR",
              "AE",
              "GB",
              "US",
              "VN"
            ],
            "type": "string",
            "description": "Country code to scrape trending videos for (used in discovery mode; ignored when videoUrls is supplied).",
            "default": "US"
          },
          "sortBy": {
            "title": "📊 Sort By",
            "enum": [
              "vv",
              "like",
              "comment",
              "repost"
            ],
            "type": "string",
            "description": "Sort discovery results by: hot/view→vv (views), like, share→repost, comment.",
            "default": "vv"
          },
          "period": {
            "title": "📅 Period Type",
            "enum": [
              "7",
              "30"
            ],
            "type": "string",
            "description": "Period to scrape (last 7 or 30 days) in discovery mode. Also used as the period for the aggregate hashtag trend cross-reference.",
            "default": "7"
          },
          "maxItems": {
            "title": "🔢 Max Items",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Maximum number of videos to scrape in discovery mode (or the maximum number of videoUrls to process in direct video-URL mode).",
            "default": 10
          },
          "videoUrls": {
            "title": "🔗 Direct Video URLs",
            "type": "array",
            "description": "Optional. One TikTok video URL per line. When supplied, discovery (countryCode/sortBy/period/maxItems) is skipped entirely and each URL's public page is parsed directly for hashtags + sound data. Example: https://www.tiktok.com/@username/video/7123456789012345678",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "includeHashtags": {
            "title": "#️⃣ Include Hashtag Data",
            "type": "boolean",
            "description": "When enabled, each video row includes a hashtags[] array (name, id, title, cover) parsed from the video's challenges[]/textExtra[] fields. Forces the detail-page fetch on even if 'Include Detailed Video Data' below is off.",
            "default": true
          },
          "includeSoundData": {
            "title": "🎵 Include Sound Data",
            "type": "boolean",
            "description": "When enabled, each video row includes a soundMeta{} object (musicId, musicName, musicAuthor, musicOriginal, playUrl, coverMediumUrl) parsed from the video's music{} field. Forces the detail-page fetch on even if 'Include Detailed Video Data' below is off.",
            "default": true
          },
          "onlyOriginalSounds": {
            "title": "🎼 Only Original Sounds",
            "type": "boolean",
            "description": "Only keep videos whose sound is an original creation (musicMeta.musicOriginal == true) — drops videos built on a trending/reused sound. Videos where sound data could not be parsed are kept (never dropped on missing data).",
            "default": false
          },
          "minHashtagUsage": {
            "title": "📈 Min Hashtag Usage",
            "minimum": 0,
            "type": "integer",
            "description": "Noise threshold (in publish count) for the aggregate hashtag trend cross-reference below: an aggregate trending hashtag is only considered a 'trending match' when its live publish count is at least this value. 0 = no threshold (any trending hashtag counts). Does not remove hashtags from a video's own hashtags[] list — it only controls which of them register as isTrending=true.",
            "default": 0
          },
          "includeHashtagTrendCrossReference": {
            "title": "🔥 Include Hashtag Trend Cross-Reference",
            "type": "boolean",
            "description": "When enabled (and 'Include Hashtag Data' is also on), fetches TikTok Creative Center's live aggregate trending-hashtag list once per run (via the public SSR page-loader, no signing/login needed) and cross-references each extracted hashtag against it, adding isTrending/trendRank/usageCount/viewCount to every hashtag entry.",
            "default": true
          },
          "includeDetailedVideoData": {
            "title": "⚙️ Include Detailed Video Data (legacy — hashtags/sound above force this on)",
            "type": "boolean",
            "description": "Legacy base-actor input, kept for backward compatibility (base superset). Enables engagement stats (likes/comments/bookmarks/shares) and the direct video link. Automatically forced on whenever hashtag or sound extraction is enabled above.",
            "default": false
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}