# TikTok Video Uploader (`dami_studio/tiktok-video-uploader`) Actor

Upload a video to your own TikTok account from a URL, with a caption, hashtags, and privacy setting. You bring your own exported session cookies (Cookie-Editor), so your login stays yours and nothing is shared. For creators automating their own posting.

- **URL**: https://apify.com/dami\_studio/tiktok-video-uploader.md
- **Developed by:** [Dami's Studio](https://apify.com/dami_studio) (community)
- **Categories:** Social media, For creators, Automation
- **Stats:** 3 total users, 1 monthly users, 70.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## TikTok Video Uploader

Posts a video to your own TikTok account from a URL. You give it the video, a caption, and your own exported session cookies, and it drives a headless browser through TikTok's Studio upload page to publish the post. It's meant to be the publish step of a faceless-content or scheduling pipeline.

> **Best-effort browser automation.** There is no official TikTok posting API for this, so the actor automates the real TikTok Studio web UI with your session cookies. TikTok actively detects automation and may show a captcha / "verify it's you" wall, or rate-limit / restrict / ban the account. Run it only on your own account, at your own discretion. When TikTok throws a wall the actor stops with a clear error and a debug screenshot — it does not silently hang.

### How it works

It downloads your video, launches a headless Chromium routed through a residential proxy, loads your exported TikTok cookies into the session, opens the TikTok Studio upload page, sets the file, fills the caption, picks (and verifies) the privacy, clicks Post, and **waits for TikTok's real "uploaded / published" confirmation** before reporting success. There is no shared login — you bring your own session each run.

### Try it with no login (demo mode)

Run it with **no `cookies`** (or set `demoMode: true`) and it returns one clearly-labeled SAMPLE row and uploads nothing. Use this to see the output shape before wiring up your session.

### Input

| Field | Required | Notes |
|---|---|---|
| `videoUrl` | for real uploads | Public direct, non-expired URL to the `.mp4`. You host it (S3, CDN, key-value store). |
| `cookies` | for real uploads | Your TikTok session, exported as Cookie-Editor JSON. Leave blank for a demo run. Stored as a secret. |
| `caption` | no | The caption. Put your `#hashtags` here. |
| `privacy` | no | `public`, `friends`, or `private`. If `private`/`friends` can't be confirmed, the actor refuses to post (so it never publishes Public by accident). |
| `proxyConfiguration` | no | A residential proxy **in the same country as your account** is strongly recommended; datacenter IPs and country mismatches trigger captcha walls. |
| `demoMode` | no | Force a no-upload sample run even with cookies. |

### How to export your TikTok cookies

1. Log into **tiktok.com** in Chrome/Edge as the account you want to post from.
2. Install the **Cookie-Editor** extension and open it on a tiktok.com tab.
3. Click **Export → Export as JSON** (this copies the whole cookie set to your clipboard).
4. Paste that JSON into the `cookies` field.

The export must include `sessionid` (and ideally `sid_tt`, `tt_csrf_token`, `msToken`) for `.tiktok.com` — `sessionid` alone is often not enough. **Export from the same country your proxy uses.** Cookies expire; re-export when you see a "not logged in" error.

### Output

One dataset record. On a confirmed upload: `{ ok: true, platform, videoUrl, videoId, caption, privacy, privacyApplied, postedAt, runId }`, where `videoUrl`/`videoId` point at the published post (resolved from the content manager; may be `null` if TikTok didn't surface it). On failure: `{ ok: false, error }`, plus a debug screenshot + page HTML in the run's key-value store. Demo runs carry `_demo: true` and a `_notice`.

### Example

```json
{
  "videoUrl": "https://cdn.example.com/clip.mp4",
  "caption": "new drop today #fyp",
  "privacy": "public",
  "cookies": "[{\"name\":\"sessionid\",\"value\":\"...\",\"domain\":\".tiktok.com\",\"path\":\"/\"}]"
}
````

### Pricing

$0.10 per **confirmed** upload (charged only after TikTok's published confirmation). Failed/unconfirmed runs and demo runs are free. You supply your own cookies and proxy.

### Notes

This automates your logged-in TikTok session, which TikTok's terms discourage — see the warning at the top. Because it drives TikTok's actual web UI, a layout change on their side can break a selector and need an update; when that happens the actor fails with an actionable message and saves a screenshot rather than reporting a false success.

# Actor input Schema

## `videoUrl` (type: `string`):

Public direct URL to the video file (.mp4) to upload. Must be a non-expired direct link (S3/CDN/key-value store). Required for a real upload; leave it blank for a keyless demo run.

## `caption` (type: `string`):

The TikTok caption (include #hashtags here).

## `privacy` (type: `string`):

Who can watch the video.

## `cookies` (type: `string`):

Your TikTok session cookies, from a browser where YOU are logged in. Paste either a Cookie-Editor JSON export (recommended) or the raw 'Cookie:' header string from DevTools. Must include sessionid (and ideally sid\_tt) for .tiktok.com, and should match your proxy country. Automates your own session — kept private. Leave blank to run a keyless DEMO that uploads nothing.

## `proxyConfiguration` (type: `object`):

Apify proxy. A RESIDENTIAL proxy in the SAME country as your account is strongly recommended — datacenter IPs and country mismatches trigger TikTok captcha walls.

## `demoMode` (type: `boolean`):

Force a labeled SAMPLE run that uploads nothing, even if cookies are provided. A keyless run (no cookies) is automatically demo mode.

## Actor input object example

```json
{
  "privacy": "public",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "demoMode": false
}
```

# Actor output Schema

## `results` (type: `string`):

Result rows / metadata are stored in the default dataset (one row per item).

## `files` (type: `string`):

Generated media/files (video, audio, images, captions) are stored in the default key-value store.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("dami_studio/tiktok-video-uploader").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("dami_studio/tiktok-video-uploader").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{}' |
apify call dami_studio/tiktok-video-uploader --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=dami_studio/tiktok-video-uploader",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "TikTok Video Uploader",
        "description": "Upload a video to your own TikTok account from a URL, with a caption, hashtags, and privacy setting. You bring your own exported session cookies (Cookie-Editor), so your login stays yours and nothing is shared. For creators automating their own posting.",
        "version": "0.1",
        "x-build-id": "qNVJGc5hzg7ekey5b"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/dami_studio~tiktok-video-uploader/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-dami_studio-tiktok-video-uploader",
                "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/dami_studio~tiktok-video-uploader/runs": {
            "post": {
                "operationId": "runs-sync-dami_studio-tiktok-video-uploader",
                "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/dami_studio~tiktok-video-uploader/run-sync": {
            "post": {
                "operationId": "run-sync-dami_studio-tiktok-video-uploader",
                "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": {
                    "videoUrl": {
                        "title": "Video URL",
                        "type": "string",
                        "description": "Public direct URL to the video file (.mp4) to upload. Must be a non-expired direct link (S3/CDN/key-value store). Required for a real upload; leave it blank for a keyless demo run."
                    },
                    "caption": {
                        "title": "Caption",
                        "type": "string",
                        "description": "The TikTok caption (include #hashtags here)."
                    },
                    "privacy": {
                        "title": "Privacy",
                        "enum": [
                            "public",
                            "friends",
                            "private"
                        ],
                        "type": "string",
                        "description": "Who can watch the video.",
                        "default": "public"
                    },
                    "cookies": {
                        "title": "TikTok session cookies (BYO)",
                        "type": "string",
                        "description": "Your TikTok session cookies, from a browser where YOU are logged in. Paste either a Cookie-Editor JSON export (recommended) or the raw 'Cookie:' header string from DevTools. Must include sessionid (and ideally sid_tt) for .tiktok.com, and should match your proxy country. Automates your own session — kept private. Leave blank to run a keyless DEMO that uploads nothing."
                    },
                    "proxyConfiguration": {
                        "title": "Proxy",
                        "type": "object",
                        "description": "Apify proxy. A RESIDENTIAL proxy in the SAME country as your account is strongly recommended — datacenter IPs and country mismatches trigger TikTok captcha walls.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ]
                        }
                    },
                    "demoMode": {
                        "title": "Demo mode (no upload)",
                        "type": "boolean",
                        "description": "Force a labeled SAMPLE run that uploads nothing, even if cookies are provided. A keyless run (no cookies) is automatically demo mode.",
                        "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
