Skip to main content
Platforms

TikTok

Publish TikTok videos, photos, and photo carousels via the PostPeer API.

Overview

Publish TikTok videos, photos, and photo carousels programmatically. PostPeer handles TikTok's multi-step upload process, content policies, and OAuth.

Quick Start

1. Connect a TikTok Account

curl https://api.postpeer.dev/v1/connect/tiktok \
  -H "x-access-key: YOUR_API_KEY"

Returns a TikTok OAuth URL. The user authorizes video upload permissions. See Connect Accounts for the full OAuth flow.

2. Publish a Video

curl -X POST "https://api.postpeer.dev/v1/posts" \
  -H "x-access-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Quick tutorial! #coding #devtips",
    "platforms": [
      { "platform": "tiktok", "accountId": "tt_321" }
    ],
    "mediaItems": [
      { "type": "video", "url": "https://cdn.example.com/video.mp4" }
    ],
    "publishNow": true
  }'
import PostPeer from '@postpeer/node';

const client = new PostPeer();
const { data } = await client.posts.create({
	body: {
		content: 'Quick tutorial! #coding #devtips',
		platforms: [{ platform: 'tiktok', accountId: 'tt_321' }],
		mediaItems: [{ type: 'video', url: 'https://cdn.example.com/video.mp4' }],
		publishNow: true,
	},
});
from postpeer import PostPeer

with PostPeer() as client:
    post = client.posts.create(
        content="Quick tutorial! #coding #devtips",
        platforms=[{"platform": "tiktok", "accountId": "tt_321"}],
        media_items=[
            {"type": "video", "url": "https://cdn.example.com/video.mp4"},
        ],
        publish_now=True,
    )

Response:

{
	"success": true,
	"status": "published",
	"postId": "post_pqr678",
	"platforms": [
		{
			"platform": "tiktok",
			"success": true,
			"platformPostUrl": "https://www.tiktok.com/@user/video/7123456789"
		}
	]
}

Pass two or more image items to create a carousel. For photo posts, content becomes the title. Use platformSpecificData.description for the longer description.

curl -X POST "https://api.postpeer.dev/v1/posts" \
  -H "x-access-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Summer road trip",
    "platforms": [
      {
        "platform": "tiktok",
        "accountId": "tt_321",
        "platformSpecificData": {
          "description": "Five stops worth adding to your next road trip. Save this route for later! #roadtrip #travel",
          "privacyLevel": "PUBLIC_TO_EVERYONE",
          "autoAddMusic": true,
          "photoCoverIndex": 0
        }
      }
    ],
    "mediaItems": [
      { "type": "image", "url": "https://cdn.example.com/stop-1.jpg" },
      { "type": "image", "url": "https://cdn.example.com/stop-2.jpg" },
      { "type": "image", "url": "https://cdn.example.com/stop-3.jpg" }
    ],
    "publishNow": true
  }'

Photo metadata uses these limits:

Request fieldTikTok fieldLimit
contenttitle90 characters
platformSpecificData.descriptiondescription4,000 characters

The description is optional. When omitted, PostPeer also uses content as the description for backward compatibility. TikTok does not support the separate description field for video posts.

Platform-Specific Data

Pass TikTok options in platformSpecificData for the TikTok platform entry:

{
	"platform": "tiktok",
	"accountId": "tt_321",
	"platformSpecificData": {
		"privacyLevel": "PUBLIC_TO_EVERYONE",
		"disableComment": false,
		"disableDuet": false,
		"disableStitch": false,
		"draft": false
	}
}

Pass this object in platformSpecificData when posting to TikTok.

FieldTypeRequiredValues and constraintsDescription
privacyLevelstringNoPUBLIC_TO_EVERYONE, MUTUAL_FOLLOW_FRIENDS, FOLLOWER_OF_CREATOR, SELF_ONLYWho can see this post. Defaults to "PUBLIC_TO_EVERYONE".
disableCommentbooleanNoDisable comments on this post. Defaults to false.
disableDuetbooleanNoDisable duet for this video. Videos only. Defaults to false.
disableStitchbooleanNoDisable stitch for this video. Videos only. Defaults to false.
brandContentTogglebooleanNoMark as branded content (paid partnership). Defaults to false.
brandOrganicTogglebooleanNoMark as organic brand promotion. Defaults to false.
isAigcbooleanNoAI-generated content disclosure. Videos only. Defaults to false.
videoCoverTimestampMsnumberNoRange: 0–unboundedTimestamp in milliseconds to use as the video cover frame. Videos only.
autoAddMusicbooleanNoAutomatically add background music to photo carousels. Photo posts only. Defaults to true.
photoCoverIndexnumberNoRange: 0–unbounded0-indexed position of the cover image in a photo carousel. Photo posts only. Defaults to 0.
descriptionstringNoLength: 0–4000Separate description for a TikTok photo or carousel post. Max 4,000 characters. When omitted, the post content is also used as the description. Photo posts only.
draftbooleanNoWhen true, sends content to the creator's TikTok inbox as a draft. Defaults to false (publishes immediately via DIRECT_POST).

Creator Info

Before showing a custom TikTok publishing UI, fetch the connected creator's current posting options:

curl "https://api.postpeer.dev/v1/tiktok/creator-info?accountId=tt_321" \
  -H "x-access-key: YOUR_API_KEY"

Use the returned privacyLevelOptions, commentDisabled, duetDisabled, stitchDisabled, and maxVideoPostDurationSec to restrict the form before upload.

Media Requirements

Videos

SpecificationTikTok requirement
ContainerMP4 recommended; MOV and WebM supported
Video codecH.264 recommended; H.265, VP8, and VP9 supported
Frame rate23-60 FPS
DimensionsWidth and height must each be 360-4,096 px
DurationCreator-specific; maximum API upload length is 10 minutes
File size4 GB maximum

TikTok requires the video's duration to fit the connected creator's maxVideoPostDurationSec. Fetch Creator Info before publishing. See TikTok's official media transfer guide for current restrictions.

Photos and carousels

RequirementPostPeer support
Images per post1-32; two or more images create a carousel
Media typeImages only; TikTok carousels cannot mix images and videos
Aspect ratioBetween 1:2.13 and 2.13:1
Matching slidesEvery carousel image must use the same aspect ratio
Delivery formatPostPeer normalizes images to TikTok-compatible JPEG files
Cover imageSet photoCoverIndex; indexes start at 0

Each image URL must be publicly reachable. PostPeer downloads, normalizes, and rehosts the images before TikTok fetches them. See TikTok's official Photo Post API for the underlying title, description, and photo fields.

Cross-Post

Upload one vertical video to TikTok, YouTube Shorts, and Instagram Reels in a single request:

curl -X POST "https://api.postpeer.dev/v1/posts" \
  -H "x-access-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "New tutorial out now!",
    "platforms": [
      { "platform": "tiktok", "accountId": "tt_321" },
      { "platform": "youtube", "accountId": "yt_789", "platformSpecificData": { "title": "New Tutorial", "visibility": "public" } },
      { "platform": "instagram", "accountId": "ig_456" }
    ],
    "mediaItems": [
      { "type": "video", "url": "https://cdn.example.com/vertical.mp4" }
    ],
    "publishNow": true
  }'

On this page