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
}
}| Field | Type | Description |
|---|---|---|
privacyLevel | string | Who can see the post. One of "PUBLIC_TO_EVERYONE", "MUTUAL_FOLLOW_FRIENDS", "FOLLOWER_OF_CREATOR", or "SELF_ONLY". |
disableComment | boolean | Disable comments on the post. Defaults to false. |
disableDuet | boolean | Disable duets for video posts. Defaults to false. |
disableStitch | boolean | Disable stitches for video posts. Defaults to false. |
brandContentToggle | boolean | Mark as branded content, such as a paid partnership. Defaults to false. |
brandOrganicToggle | boolean | Mark as organic brand promotion. Defaults to false. |
isAigc | boolean | Disclose AI-generated content. Defaults to false. |
videoCoverTimestampMs | number | Timestamp in milliseconds to use as the video cover frame. Defaults to 1000. |
autoAddMusic | boolean | Automatically add background music to photo carousels. Defaults to true. |
photoCoverIndex | number | 0-indexed position of the cover image in a photo carousel. Defaults to 0. |
draft | boolean | Send 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
| Type | Formats | Aspect Ratio | Duration |
|---|---|---|---|
| Video | MP4, WebM | 9: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
}'