How to upload to TikTok from code
There are two kinds of TikTok upload API. TikTok’s official Content Posting API lets an app post to the accounts of users who sign in to it, after the app passes TikTok’s review. Unofficial upload APIs, like Tikultra’s, post to accounts you own or manage, through the same upload flow the TikTok app uses, with no app review. Which one fits depends on whose accounts you are posting to.
| Official Content Posting API | Tikultra upload API | |
|---|---|---|
| Whose accounts | Any TikTok user who authorizes your app | Accounts you own or manage |
| Setup | Developer app, OAuth, scopes, then a TikTok audit | Connect each account once with an email code |
| Before the audit | Posts are private, only visible to the creator | No audit; posts are public right away |
| Photo carousels | Yes | Yes |
| Scheduling | Your own queue | Native schedule_time, or your own queue |
| Shop products, locations, sounds | Limited | shop_product_ids, poi_id, music_id |
| Comments, DMs, LIVE on the same account | No | Yes, with the same account_id |
If you are building a public app where any creator logs in with TikTok, use the official API and plan for the audit. If you are a brand, agency, creator or tool posting to your own or your clients’ accounts, the rest of this guide is for you.
How the official Content Posting API works
It helps to know what the official route involves, because it explains why many teams use something else for their own accounts.
- Register an app on TikTok for Developers and add the Content Posting API product.
- Request scopes:
video.uploadsends videos to the creator’s inbox as drafts they finish in the app;video.publishposts directly. - Sign users in with OAuth to get an access token per creator, and refresh it before it expires.
- Query creator info before each post to learn the account’s privacy options and maximum video length, and show them in your UI as TikTok’s guidelines require.
- Upload by sending the file in chunks, or by giving TikTok a URL on a domain you have verified.
- Pass the audit. Until TikTok approves the app, everything it posts is restricted to private viewing.
The audit asks for a working product, a privacy policy and a demo of your posting flow, and it can take a while. For a public app that is a reasonable bar. For posting to your own five brand accounts, it is a lot of process for no benefit.
Upload a video in one call
- 1Connect the account
Connect it once as a managed account, with the email code TikTok sends or by importing a session. You get an
account_id. - 2Check limits (optional)
GET
/v1/account/upload/prechecktells you whether the account can post, its maximum video length and how many direct posts it has left today. - 3Upload
POST
/v1/account/upload/videowith the file (multipart) or avideo_url, and the caption. - 4Get the post
The response has the new
aweme_id,share_urland visibility. Failed uploads are not billed.
POST /v1/account/upload/video · 25 reqs per call| Parameter | Type | Required | What it does |
|---|---|---|---|
account_id | string | Yes | A connected account, from /dash/sessions or POST /v1/account/import. e.g. acc_7Hq2 |
file | file | file, video_url or video_base64 | The .mp4 or .mov file (multipart only). |
video_url | string | file, video_url or video_base64 | Or a URL to fetch the video from. e.g. https://cdn.example.com/media/clip-1080p60.mp4 |
video_base64 | string | file, video_url or video_base64 | Or the video as base64. |
caption | string | No | The caption. e.g. Mechanical keyboard sound test |
hashtags | string[] | No | Hashtags, without the #. |
mentions | string[] | No | Usernames to mention. |
visibility | string | No | Who can see it. e.g. public |
allow_comment | boolean | No | Allow comments. e.g. true |
allow_duet | boolean | No | Allow duets. e.g. true |
allow_stitch | boolean | No | Allow stitches. e.g. true |
allow_download | boolean | No | Allow downloads. e.g. false |
cover_timestamp_ms | integer | No | Frame to use as the cover. e.g. 1200 |
poi_id | string | No | Tag a place. |
music_id | string | No | Use a sound. |
schedule_time | integer | No | Publish later, as Unix seconds. |
aigc_generated | boolean | No | Label the post as AI-generated. e.g. false |
shop_product_ids | string[] | No | Products to anchor. |
from tikultra import TikUltra
client = TikUltra()
post = client.account.upload_video(
"acc_7Hq2",
file="./launch.mp4",
caption="Unboxing the new 75% board #desksetup #mechanicalkeyboard",
visibility="public",
cover_timestamp_ms=1200, # cover frame at 1.2 s
)
print(post["aweme_id"], post["share_url"])import { readFile } from 'node:fs/promises'
import { TikUltra } from 'tikultra'
const client = new TikUltra({ apiKey: process.env.TIKULTRA_KEY })
const res = await client.account.uploadVideo({
account_id: 'acc_7Hq2',
file: await readFile('./launch.mp4'),
filename: 'launch.mp4',
caption: 'Unboxing the new 75% board #desksetup',
visibility: 'public',
})
console.log(res.data.aweme_id, res.data.share_url)curl -X POST https://api.tikultra.com/v1/account/upload/video \
-H "x-api-key: $TIKULTRA_KEY" \
-F account_id=acc_7Hq2 \
-F file=@launch.mp4 \
-F "caption=Unboxing the new 75% board #desksetup" \
-F visibility=public{
"status_code": 0,
"account_id": "acc_7Hq2",
"aweme_id": "7693184538704416031",
"status": "published",
"visibility": "public",
"share_url": "https://www.tiktok.com/@tiktok/video/7693184538704416031",
"steps": {
"authorize_ms": 182,
"transfer_ms": 2840,
"precheck_ms": 410,
"create_ms": 366
},
"log_pb": {
"impr_id": "202611120200419F8E7D6C5B4A3210"
}
}The steps object shows how long each stage of TikTok’s upload took: authorizing the upload, transferring the file, TikTok’s precheck and creating the post. Behind the one call, Tikultra runs the same sequence the TikTok app runs, on the account’s own dedicated device, so the post looks like it came from the creator’s phone.
Video requirements
| Item | What works | Notes |
|---|---|---|
| Format | MP4 or MOV | H.264 video and AAC audio are the safest choice |
| Aspect ratio | 9:16 vertical, 1080×1920 | Other ratios upload but show with bars |
| Length | Up to the account’s limit | max_video_duration_sec from the precheck, often 600 seconds |
| Frame rate | 30 or 60 fps | Keep the source frame rate |
| File source | Multipart file, video_url or video_base64 | Use video_url when your renders already live in cloud storage |
| Caption | Up to 4,000 characters | Hashtags and @mentions can be in the caption or in hashtags and mentions |
{
"status_code": 0,
"account_id": "acc_7Hq2",
"can_post": true,
"max_video_duration_sec": 600,
"direct_post_quota_remaining": 15,
"infringement_status": "clear",
"log_pb": {
"impr_id": "202611120200419F8E7D6C5B4A3210"
}
}Photo carousels
Photo posts (TikTok’s photo mode) often get more reach than videos for tutorials, lists and product shots. Send the images in order to /v1/account/upload/slideshow, as files or as URLs, with an optional sound.
post = client.account.upload_slideshow(
"acc_7Hq2",
images=[
"https://cdn.example.com/slides/1.jpg",
"https://cdn.example.com/slides/2.jpg",
"https://cdn.example.com/slides/3.jpg",
],
title="3 desk setups under $500",
caption="Which one would you pick? #desksetup",
music_id="7693184700604599071",
)Use 1080×1920 or 1080×1350 images. To pick a sound that is rising, check /v1/music/charts or the sounds on top posts in your niche with /v1/music, and pass its music_id.
Schedule posts
Pass schedule_time as a Unix timestamp and TikTok schedules the post on its side, so nothing of yours needs to be running at publish time. TikTok only accepts schedules inside a limited window, from a few minutes to a number of days ahead. For anything further out, or when you want to change content until the last minute, keep posts in your own queue and upload them when they are due.
from datetime import datetime, timezone
when = datetime(2026, 12, 1, 17, 30, tzinfo=timezone.utc)
client.account.upload_video(
"acc_7Hq2",
video_url="https://cdn.example.com/renders/dec-01.mp4",
caption="Advent day 1 #desksetup",
schedule_time=int(when.timestamp()),
)The scheduler guide has a full queue with retries and per-account time slots.
Products, places, sounds and AI labels
| Parameter | What it does | Where to get the value |
|---|---|---|
shop_product_ids | Tags TikTok Shop products, making the video shoppable | Your Shop catalog, or /v1/shop/search |
poi_id | Tags a location | /v1/account/upload/places?keyword=… |
music_id | Uses a TikTok sound | /v1/music, /v1/music/charts or a video’s music_id |
aigc_generated | Labels the post as AI-generated, as TikTok asks creators to | Set it to true for AI-made content |
allow_comment, allow_duet, allow_stitch, allow_download | Interaction settings for the post | Booleans |
visibility | public, friends or private | Change it later with /v1/account/post/visibility |
{
"status_code": 0,
"keyword": "miami beach",
"items": [
{
"poi_id": "21568226331721891",
"name": "Wynwood Walls",
"address": "2516 NW 2nd Ave, Miami, FL",
"city": "Miami"
},
{
"poi_id": "22535865203049850",
"name": "South Pointe Park Pier",
"address": "1 Washington Ave, Miami Beach, FL",
"city": "Miami Beach"
}
],
"log_pb": {
"impr_id": "202611120200419F8E7D6C5B4A3210"
}
}After the post goes up
- Change visibility with
/v1/account/post/visibility, for example to publish a private test post later. - Delete a post with
/v1/account/upload/delete. - Track performance by reading the post with
/v1/video?aweme_id=…: plays, likes, comments, shares and saves. Creator Studio numbers for the whole account come from/v1/account/studio/overview. - Answer comments on it with
/v1/account/comment, from the same account. See the auto reply guide.
Posting to many accounts
Agencies and brands with regional accounts post the same campaign to several accounts, or different content to each. Each connected account has its own account_id and its own device, so uploads to different accounts never share an identity. Plans include 3 accounts on Starter, 15 on Growth and 60 on Scale.
campaign = [
("acc_us", "./us.mp4", "New drop, US store link in bio #desksetup"),
("acc_uk", "./uk.mp4", "New drop, UK store link in bio #desksetup"),
("acc_de", "./de.mp4", "Neu im Shop, Link in der Bio #desksetup"),
]
for account_id, path, caption in campaign:
post = client.account.upload_video(account_id, file=path, caption=caption, visibility="public")
print(account_id, post["share_url"])Post different, localized videos rather than the identical file everywhere, and spread uploads out over the day. The bulk upload guide and multiple accounts guide go further.
What uploading costs
An upload is 25 reqs, a precheck 1 req. Sixty uploads a month with a precheck each is 1,560 requests, $1.91 at Starter’s rate. An agency posting twice a day to 15 accounts uses 22,500 requests a month, $20.44 at Growth’s rate. Failed uploads are never billed.
| Plan | Monthly price | Requests included | Per 1,000 calls | Rate limit |
|---|---|---|---|---|
| Starter | $49 | 40,000 | $30.63 | 20 req/s |
| Growth | $159 | 175,000 | $22.71 | 75 req/s |
| Scale | $499 | 750,000 | $16.63 | 250 req/s |
Retries without double posts
Uploads are the one place where a blind retry can hurt. If a request times out on your side after TikTok already created the post, retrying publishes the same video twice, and duplicate posts look like spam. Failed calls that return an error are safe to retry; for timeouts, check first.
import time
from tikultra import TikUltra, UpstreamError
client = TikUltra()
def already_posted(username, caption, since):
recent = client.user.posts(username, count=10)["items"]
return next((p for p in recent if p["desc"].strip() == caption.strip() and p["create_time"] >= since), None)
def safe_upload(account_id, username, path, caption, tries=3):
started = int(time.time()) - 60
for attempt in range(tries):
try:
return client.account.upload_video(account_id, file=path, caption=caption, visibility="public")
except UpstreamError: # timeouts and network errors land here
time.sleep(20 * (attempt + 1))
post = already_posted(username, caption, started)
if post:
return post # it went through; do not post again
raise RuntimeError("upload failed after retries")Give each post a caption that is unique to it, even by one word or hashtag, so the check can tell posts apart. The same idea applies to scheduled posts: record the aweme_id you got back and never re-send a job that already has one.
Captions and hashtags that help
TikTok is a search engine now: many users search it the way they search Google, and captions are part of what TikTok indexes. A few habits make API-posted videos perform like hand-posted ones:
- Lead with the hook and the keyword. The first line shows under the video; put the phrase people search for in it.
- Use a few specific hashtags, three to five, rather than twenty generic ones.
- Vary captions across accounts. The same caption on ten accounts at the same minute is a pattern TikTok notices.
- Post when your audience is on. Creator Studio data from
/v1/account/studio/overviewshows when your followers are active; schedule into those hours. - Use sounds that are rising, from
/v1/music/charts, when the video works with one.
Errors
Upload-specific problems come back as clear errors: a video longer than the account’s limit, a format TikTok rejects, the daily post limit reached, or session_expired when the account needs to sign in again. None of them are billed.
| Status | Code | Meaning | Retry? |
|---|---|---|---|
| 400 | invalid_request | A parameter is missing or malformed. | No. Fix the request. |
| 401 | unauthorized | The key is missing, wrong or revoked. | No. |
| 402 | out_of_credits | Your balance can’t cover this call. | After a top-up. |
| 403 | forbidden | Your plan doesn’t include this endpoint. | No. Upgrade. |
| 404 | not_found | The video, profile or product doesn’t exist or isn’t visible. | No. |
| 409 | session_expired | A connected account needs to sign in again. | After re-connecting. |
| 429 | rate_limited | Over your plan’s requests per second. | Yes, after retry-after. |
| 502 | upstream_error | TikTok returned an error after our retries. | Yes, with backoff. |
| 504 | upstream_timeout | TikTok didn’t answer in time. | Yes, with backoff. |
Upload options compared
| Option | Posts to | Catch |
|---|---|---|
| Tikultra | Accounts you own or manage | Accounts you own only; per-request pricing |
| TikTok Content Posting API | Any user who authorizes your app | App review; private posts until audited |
| Social media suites (Buffer, Hootsuite, Later) | Accounts connected through the official API | Built on the official API; priced per seat or channel |
| Posting API resellers | Accounts connected through their OAuth | Same official limits, plus their markup |
| Browser automation | Accounts logged in to a browser | Fragile, slow, and easy for TikTok to flag |
| Capability | Tikultra | TikAPI | EnsembleData | ScrapeCreators |
|---|---|---|---|---|
| Publish videos & slideshows | 1-call native upload | — | — | — |
| Connect & register your accounts | Multi-account OTP, import & BYO-proxy reg | 1-account browser OAuth | — | — |
| Comments & replies (your accounts) | Publish, reply, heart, delete | Basic web comment | — | — |
Prices checked 19 Nov 2026 on each vendor’s public pricing page; capabilities from their public API docs. A dash means the vendor’s public docs don’t list it (checked 19 Nov 2026). Full comparison