# TikTok Public Media Downloader (`w3crawler/tiktok-downloader-api`) Actor

Resolve public TikTok post media through the TikWM public API, download verified HTTPS video and cover files into the default key-value store, and return metadata and file links.

- **URL**: https://apify.com/w3crawler/tiktok-downloader-api.md
- **Developed by:** [w3crawler](https://apify.com/w3crawler) (community)
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 1,000 media downloads

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### What does TikTok Public Media Downloader do?

**TikTok Public Media Downloader** resolves public TikTok post metadata through the configured public TikWM endpoint, validates that the response matches the requested video ID, and stores the requested public cover and/or video bytes in the run's default key-value store. It does not log in, access private accounts, solve CAPTCHAs, bypass DRM, or defeat access controls.

### Why use TikTok Public Media Downloader?

Use it when a lawful workflow needs durable run artifacts rather than an expiring CDN URL. Each successful dataset row links the resolved metadata and the stored artifact keys. A failing URL does not create a fake success row; it is summarized in `OUTPUT_SUMMARY` and can optionally produce a minimal diagnostic row.

### How to download public TikTok media

1. Enter one or more public `/video/<id>` URLs in the Input tab.
2. Choose whether to store the video, cover, or both.
3. Set the per-file size limit and conservative retry/timeout controls.
4. Run the Actor and open the dataset or key-value-store artifact links.

### What data can it extract?

| Group | Fields |
| --- | --- |
| Identity | `videoId`, `postUrl`, `resolverUrl` |
| Public metadata | `title`, `authorId`, `authorUsername`, `authorName`, `authorAvatarUrl`, duration, dimensions, counts, sound fields |
| Media | `thumbnailUrl`, `playbackUrl`, `videoContentType`, `coverContentType` |
| Artifacts | `videoKey`, `videoRecordUrl`, `videoSizeBytes`, `coverKey`, `coverRecordUrl`, `coverSizeBytes` |
| Provenance | `source`, `provenance`, `resolver`, `downloadedAt` |
| Diagnostics | Optional `{url,error,errorCode,scrapedAt}` only |

The resolver and CDN are external public dependencies. Returned playback URLs may expire; key-value-store files are the durable run artifacts. Content type, byte size, HTTPS URL, and video-ID association are checked before storage.

### Input

`videoUrls` is required and accepts 1–10 public HTTPS TikTok video URLs. `maxItems` defaults to 3 and is bounded to 1–10. `downloadVideo` and `downloadCover` default to true; at least one must remain enabled. `maxFileSizeMb` defaults to 100 and is bounded to 1–250. Developer controls are `requestTimeoutSecs` (10–120, default 60), `maxRequestRetries` (0–3, default 2), and `requestDelayMs` (0–5000, default 0). `includeDiagnostics` defaults to false. `fixturePath` is an explicit local QA JSON file below `test/fixtures` and never becomes a live fallback.

```json
{
  "videoUrls": ["https://www.tiktok.com/@creator/video/1234567890"],
  "maxItems": 1,
  "downloadVideo": true,
  "downloadCover": true,
  "maxFileSizeMb": 25
}
```

### Output

```json
{
  "source": "tiktok.com via tikwm.com public API",
  "provenance": "public_tiktok_media_resolver",
  "videoId": "1234567890",
  "postUrl": "https://www.tiktok.com/@creator/video/1234567890",
  "title": "Public caption",
  "authorUsername": "creator",
  "thumbnailUrl": "https://cdn.example/cover.jpg",
  "playbackUrl": "https://cdn.example/video.mp4",
  "coverKey": "cover_1234567890",
  "videoKey": "video_1234567890",
  "videoSizeBytes": 123456,
  "coverSizeBytes": 1234,
  "downloadedAt": "2026-08-18T00:00:00.000Z"
}
```

You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.

### Tips and advanced options

Start with one URL and a conservative file-size limit. Large videos consume more compute and key-value storage. The Actor processes URLs sequentially and uses bounded retries. Fixture QA validates the artifact-writing path but is not evidence that the live resolver or current CDN succeeded.

### FAQ, support, and responsible use

If a resolver or CDN is unavailable, inspect `OUTPUT_SUMMARY` for the failed URL and error code. This Actor is not affiliated with TikTok or TikWM. Download only media you are permitted to use, respect terms, rate limits, copyright, privacy obligations, and applicable law, and do not use it to bypass restrictions. Include the run ID and summary when reporting an issue.

# Changelog

This Actor's version history is a separate document: https://apify.com/w3crawler/tiktok-downloader-api/changelog.md

# Actor input Schema

## `videoUrls` (type: `array`):

One to ten public HTTPS TikTok post URLs containing /video/<id>.

## `maxItems` (type: `integer`):

Global maximum unique URLs processed.

## `downloadVideo` (type: `boolean`):

Download and store the public playback artifact.

## `downloadCover` (type: `boolean`):

Download and store the public cover artifact.

## `maxFileSizeMb` (type: `integer`):

Per-artifact maximum before storing.

## `includeDiagnostics` (type: `boolean`):

Emit minimal {url,error,errorCode,scrapedAt} rows for failed URLs.

## `requestTimeoutSecs` (type: `integer`):

Timeout for resolver and media requests.

## `maxRequestRetries` (type: `integer`):

Bounded retries for resolver and media requests.

## `requestDelayMs` (type: `integer`):

Respectful delay before each source.

## `fixturePath` (type: `string`):

Optional relative JSON file below test/fixtures. This explicitly tests artifact storage without live traffic.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.tiktok.com/@creator/video/1234567890"
  ],
  "maxItems": 3,
  "downloadVideo": true,
  "downloadCover": true,
  "maxFileSizeMb": 100,
  "includeDiagnostics": false,
  "requestTimeoutSecs": 60,
  "maxRequestRetries": 2,
  "requestDelayMs": 0
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `runSummary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "videoUrls": [
        "https://www.tiktok.com/@creator/video/1234567890"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("w3crawler/tiktok-downloader-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "videoUrls": ["https://www.tiktok.com/@creator/video/1234567890"] }

# Run the Actor and wait for it to finish
run = client.actor("w3crawler/tiktok-downloader-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "videoUrls": [
    "https://www.tiktok.com/@creator/video/1234567890"
  ]
}' |
apify call w3crawler/tiktok-downloader-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,w3crawler/tiktok-downloader-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/BaPfzwAk8ZYPZ8jDt/builds/pyToUKGOBI0gA60Ay/openapi.json
