Platform Guide9 min readApr 3, 2026

How to Post TikTok Videos via API — Developer Guide

TikTok's Content Posting API lets you publish videos programmatically — but wiring up the OAuth flow, handling token refresh, and mapping every privacy toggle takes real engineering effort. This guide shows you how to publish TikTok videos through CodivUpload's API with a single HTTP request: privacy controls, duet/stitch settings, branded content flags, scheduling, and cross-platform posting included.

TikTok's API landscape in 2026

TikTok launched its Content Posting API in late 2023, replacing the earlier Research API as the sanctioned way to publish content programmatically. Before the official API existed, every automation tool relied on browser automation scripts or reverse-engineered private endpoints — approaches that violated TikTok's Terms of Service and got accounts suspended without warning.

The Content Posting API supports two upload modes. Direct upload sends the video binary directly to TikTok's servers in chunks. URL-based upload tells TikTok to pull the video from a publicly accessible URL — CodivUpload uses this mode, serving your media from a CDN so TikTok's ingestion servers fetch it at maximum speed. Both modes support the full set of post parameters: privacy level, interaction toggles, brand content labels, and AI-generated content flags.

CodivUpload uses the official TikTok Content Posting API exclusively. No scraping, no headless browsers, no unofficial endpoints. Every video you publish through CodivUpload is sent through the same channel that TikTok designed and maintains for third-party developers.

Why this matters for your account

Unofficial automation is the fastest path to a shadowban or permanent suspension. TikTok actively detects browser automation fingerprints and rate-limits non-API traffic. Using the official API means your posts are treated identically to those published through the TikTok app itself — same distribution, same algorithm treatment, zero risk of TOS violations.

Publishing via the CodivUpload SDK

The TypeScript SDK wraps the REST API in a typed client. Install it with npm install codivupload, initialize with your API key, and you can publish a TikTok video in a single function call. The SDK handles serialization, error parsing, and retry logic internally.

tiktok-post.ts
import { CodivUpload } from "codivupload";

const codiv = new CodivUpload("YOUR_API_KEY");

const video = await codiv.posts.create({
  platforms: ["tiktok"],
  description: "New dance trend! #fyp #trending",
  media_urls: ["https://cdn.example.com/dance.mp4"],
  profile_name: "my_brand",
  tiktok_privacy_level: "PUBLIC_TO_EVERYONE",
  tiktok_disable_comment: false,
  tiktok_disable_duet: false,
  tiktok_disable_stitch: false,
  tiktok_brand_content_toggle: false,
  tiktok_auto_add_music: true,
});

// video.id → "post_8f3a2b1c"
// video.status → "processing"

The SDK validates every TikTok-specific field before sending the request. If you pass an invalid privacy level or a conflicting parameter combination, it throws a typed error locally instead of burning an API call. The response includes a post ID you can use to poll status or listen for webhook updates.

REST API: curl example

If you prefer raw HTTP over an SDK, the REST endpoint accepts the same payload. This is the full curl command with every TikTok-specific parameter included.

tiktok-post.sh
# POST a TikTok video via CodivUpload REST API
curl -X POST \
  https://api.codivupload.com/v1/posts \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "profile_name": "my_brand",
    "platforms": ["tiktok"],
    "post_type": "video",
    "description": "New dance trend! #fyp #trending",
    "media_urls": ["https://cdn.example.com/dance.mp4"],
    "tiktok_privacy_level": "PUBLIC_TO_EVERYONE",
    "tiktok_disable_duet": false,
    "tiktok_disable_stitch": false,
    "tiktok_disable_comment": false,
    "tiktok_brand_content_toggle": false,
    "tiktok_auto_add_music": true,
    "tiktok_post_mode": "DIRECT_POST"  }'

The API returns a JSON response with the post ID, current status, and a per-platform breakdown. If TikTok's servers are slow to ingest the video, the status will show processing— CodivUpload will fire a webhook to your configured endpoint once the video is live, or you can poll the GET /v1/posts/:id endpoint.

Dashboard: TikTok post creator

Not every workflow needs code. CodivUpload's dashboard exposes every TikTok parameter through a visual composer — the same fields the API accepts, presented as toggles and dropdowns.

TikTok Post

@my_brand

Connected

dance.mp4

1080 x 1920

Caption

New dance trend! #fyp #trending #dance

47 / 2,200 characters

Privacy

PublicFriendsPrivate

Interaction Controls

Allow Duet
Allow Stitch
Allow Comments
Brand Content
Auto Music
Schedule
Apr 4, 2026 — 7:00 PM

Every field in the mockup above maps directly to an API parameter. What you set in the dashboard is the same payload the API sends to TikTok — the dashboard is the visual equivalent of the curl command in the previous section.

TikTok video specifications

Before you upload, make sure your video meets TikTok's requirements. Videos that don't meet these specs will either be rejected by the API or re-encoded by TikTok — which can degrade quality and cause processing delays.

SpecValue
Aspect ratio9:16 (1080 x 1920)
Duration1 second - 10 minutes
File sizeMax 4 GB
FormatsMP4, WebM
Caption length2,200 characters
HashtagsCritical for discoverability (3-5 recommended)

Aspect ratio matters. TikTok is a vertical-first platform. Horizontal (16:9) videos will be letterboxed with black bars, which reduces watch time and signals the algorithm to deprioritize the content. Always shoot or export at 9:16 (1080 x 1920) for maximum reach.

Privacy controls explained

TikTok's Content Posting API requires a privacy level on every upload — there is no default. CodivUpload passes the value you set directly to TikTok. Here's what each level means in practice.

PUBLIC_TO_EVERYONE

Visible to all TikTok users. The video appears on your profile and is eligible for the For You page algorithm. This is the standard setting for content meant to grow your audience.

MUTUAL_FOLLOW_FRIENDS

Only visible to accounts that follow you and that you follow back. Useful for sharing behind-the-scenes content, previews, or drafts with a trusted inner circle before going public.

SELF_ONLY

Only you can see the video. The video does not appear on your profile, in search, or on the For You page. Use this for staging content — upload via the API, review it in the TikTok app, then change the privacy level to public when you're satisfied.

FOLLOWER_OF_CREATOR is also available — it allows anyone who follows you (regardless of whether you follow them back) to see the video. This is a less restrictive version of MUTUAL_FOLLOW_FRIENDS.

TikTok-specific API parameters

These parameters are prefixed with tiktok_ in the API payload. They only apply when TikTok is included in the platforms array. When cross-posting to other platforms, these fields are silently ignored by non-TikTok targets.

tiktok_privacy_level
stringRequired

Who can view the video. Required by TikTok's Content Posting API for every upload.

PUBLIC_TO_EVERYONE | MUTUAL_FOLLOW_FRIENDS | FOLLOWER_OF_CREATOR | SELF_ONLY

tiktok_disable_duet
boolean

Prevent other creators from creating Duets with your video.

true | false

tiktok_disable_stitch
boolean

Prevent other creators from stitching your video into theirs.

true | false

tiktok_disable_comment
boolean

Turn off comments entirely. Useful for brand safety in managed campaigns.

true | false

tiktok_brand_content_toggle
boolean

Flag the post as branded/sponsored content per TikTok's advertising policies.

true | false

tiktok_auto_add_music
boolean

Let TikTok's algorithm add background music if your video has no audio track.

true | false

tiktok_post_mode
string

DIRECT_POST publishes immediately. MEDIA_UPLOAD stages the video in TikTok's creator inbox for final editing.

DIRECT_POST | MEDIA_UPLOAD

tiktok_media_urls
string[]

Override media_urls specifically for TikTok when cross-posting different assets per platform.

Array of URLs

Full parameter reference: docs.codivupload.com

Cross-post: TikTok + Instagram Reels in one call

Short-form vertical video works on both TikTok and Instagram Reels. Instead of making two separate API calls with two sets of media uploads, you can publish to both platforms in a single request. Each platform gets its own override parameters — TikTok gets the tiktok_ fields, Instagram gets the instagram_ fields.

cross-post.ts
const post = await codiv.posts.create({
  platforms: ["tiktok", "instagram"],
  description: "Morning routine #vlog #grwm",
  media_urls: ["https://cdn.example.com/routine.mp4"],
  profile_name: "my_brand",

  // TikTok-specific
  tiktok_privacy_level: "PUBLIC_TO_EVERYONE",
  tiktok_disable_duet: false,
  tiktok_auto_add_music: true,

  // Instagram-specific
  instagram_media_type: "REELS",
  instagram_share_to_feed: true,
});

// One video → two platforms, each with native settings

CodivUpload processes each platform independently. If TikTok succeeds but Instagram fails due to a rate limit, you get per-platform status in the response — TikTok shows published, Instagram shows failed with the error code. No all-or-nothing behavior.

Brand content and AI-generated content labels

TikTok requires creators to disclose paid partnerships and AI-generated content. Failing to label sponsored posts correctly can result in content removal or account restrictions. CodivUpload exposes both flags as first-class API parameters.

Brand Content Toggle

Set tiktok_brand_content_toggle: true when the video is a paid partnership, sponsorship, or any form of commercial promotion. TikTok adds a "Paid partnership" label to the video.

Required by: TikTok Branded Content Policy

AI Content Label (AIGC)

Set tiktok_is_aigc: true when the video was generated or significantly modified by AI tools. TikTok displays an "AI-generated" watermark.

Required by: TikTok AI-Generated Content Policy (2024)

Both flags can be set together. An AI-generated video promoting a product should have both tiktok_brand_content_toggle: true and tiktok_is_aigc: true.

Scheduling TikTok posts

Add a scheduled_date field to your API payload and CodivUpload will queue the post for the exact timestamp you specify. The video is uploaded to CodivUpload's CDN immediately, then published to TikTok at the scheduled time. This means TikTok's processing happens in advance — the video goes live the moment the clock hits your scheduled time, not after a processing delay.

Best posting windows for TikTok

Tuesday - Thursday consistently show the highest engagement rates

10 AM - 12 PM and 7 PM - 9 PM in your audience's timezone

Batch-create a week's content on Monday, schedule each post for optimal times

Use ISO 8601 format: 2026-04-04T19:00:00Z

DIRECT_POST vs MEDIA_UPLOAD

The tiktok_post_mode parameter controls what happens after TikTok finishes processing your video.

DIRECT_POST

  • Video publishes immediately after processing
  • Appears on your profile and in the For You feed
  • Best for scheduled content with finalized edits
  • Most common mode for API-driven workflows

MEDIA_UPLOAD

  • Video lands in TikTok's creator inbox
  • You can add effects, filters, or sounds in-app
  • Requires manual publish from TikTok app
  • Good for content that needs final creative touches

Common errors and how to handle them

TikTok's API returns specific error codes when something goes wrong. CodivUpload surfaces these in the post status response so you can handle them programmatically.

privacy_level_required

Cause: Missing tiktok_privacy_level

Fix: Always include tiktok_privacy_level in every TikTok post. There is no default — TikTok rejects the upload without it.

video_too_long

Cause: Video exceeds 10 minutes

Fix: Trim the video before uploading. TikTok's maximum duration is 10 minutes for API uploads.

token_expired

Cause: OAuth refresh token expired

Fix: CodivUpload auto-refreshes tokens, but if the refresh token itself expires, you'll need to re-authorize from the dashboard.

rate_limit_exceeded

Cause: Too many uploads in a short window

Fix: TikTok limits the number of uploads per day based on your account age and follower count. Space out your posts or upgrade your TikTok developer app tier.

Hashtag strategy for API-published content

Hashtags on TikTok work differently than on Instagram or Twitter. TikTok's algorithm uses hashtags as topic signals to categorize your video and match it with interested viewers. Including them in the description field is the only way to add them via the API — there is no separate hashtag parameter.

Recommended approach

Use 3-5 hashtags per video. More than 5 dilutes the signal.

Mix one broad tag (#fyp, #foryou) with 2-3 niche tags specific to your content.

Check TikTok's Creative Center for current trending hashtags in your category.

Place hashtags at the end of the caption, not the beginning.

Don't reuse the exact same hashtag set on every video — TikTok may flag it as spam behavior.

Example caption with hashtags: "This recipe took 45 minutes to develop and 3 seconds to eat #cooking #quickmeals #recipe #foodtok"

Related guides

Start publishing TikTok videos via API

Connect your TikTok account in 30 seconds. Full privacy controls, scheduling, and cross-platform posting from day one.