Skip to main content
Platforms

TikTok

Upload and publish TikTok posts via the PostPeer API.

Overview

Upload and publish TikTok posts 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
  }'

Response:

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

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
	}
}
FieldTypeDescription
privacyLevelstringWho can see the post. One of "PUBLIC_TO_EVERYONE", "MUTUAL_FOLLOW_FRIENDS", "FOLLOWER_OF_CREATOR", or "SELF_ONLY".
disableCommentbooleanDisable comments on the post. Defaults to false.
disableDuetbooleanDisable duets for video posts. Defaults to false.
disableStitchbooleanDisable stitches for video posts. Defaults to false.
brandContentTogglebooleanMark as branded content, such as a paid partnership. Defaults to false.
brandOrganicTogglebooleanMark as organic brand promotion. Defaults to false.
isAigcbooleanDisclose AI-generated content. Defaults to false.
videoCoverTimestampMsnumberTimestamp in milliseconds to use as the video cover frame. Defaults to 1000.
autoAddMusicbooleanAutomatically add background music to photo carousels. Defaults to true.
photoCoverIndexnumber0-indexed position of the cover image in a photo carousel. Defaults to 0.
draftbooleanSend the content to the creator's TikTok inbox as a draft. Defaults to false, which publishes immediately.

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

TypeFormatsAspect RatioDuration
VideoMP4, WebM9:16 (vertical)1s - 10 min

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", "privacyStatus": "public" } },
      { "platform": "instagram", "accountId": "ig_456" }
    ],
    "mediaItems": [
      { "type": "video", "url": "https://cdn.example.com/vertical.mp4" }
    ],
    "publishNow": true
  }'

On this page