English
Publishing Videos to TikTok
Endpoint POST /api/tiktok/upload publishes video content directly to connected TikTok accounts.
1. Specifications & Cost
- Endpoint:
POST /api/tiktok/upload - Credit Cost: 5 Credits per successful publish.
- Format:
application/json(Pure JSON).
Prerequisite: Connecting Your TikTok Channel Before Uploading
To publish videos via API, your workspace must have at least one active connected channel. You can link your TikTok account automatically in seconds using the open-source extension StackVid Connect or manually via Channel Management.
2. Payload Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
videoUrl | String | Yes | Direct video download URL (CDN/S3/cloud URL or from Presigned Upload endpoint) |
caption | String | No | Post caption, hashtags, and mentions |
targetChannel | String | No | Target channel name or handle (defaults to isDefault) |
coverUrl | String | No | Custom thumbnail URL |
privacyLevel | Number | No | 0 = Public (default), 1 = Friends, 2 = Private |
allowComment | Boolean | No | Allow user comments (default: true) |
allowDuet | Boolean | No | Allow Duet creation (default: true) |
allowStitch | Boolean | No | Allow Stitch creation (default: true) |
soundId | String | No | Official TikTok sound ID to attach |
productAnchors | Array | No | TikTok Shop showcase products to link |
3. Code Example
bash
curl -X POST https://api.stackvid.dev/api/tiktok/upload \
-H "X-API-Key: tk_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"videoUrl": "https://media.yourdomain.com/stackvid-uploads/video.mp4",
"caption": "New outfit review! #fashion #outfit",
"targetChannel": "US Fashion Channel",
"privacyLevel": 0,
"allowComment": true
}'typescript
import axios from 'axios';
const res = await axios.post(
'https://api.stackvid.dev/api/tiktok/upload',
{
videoUrl: 'https://media.yourdomain.com/stackvid-uploads/video.mp4',
caption: 'New outfit review! #fashion #outfit',
targetChannel: 'US Fashion Channel',
privacyLevel: 0,
},
{ headers: { 'X-API-Key': 'tk_live_YOUR_API_KEY' } }
);
console.log('Published:', res.data.shareUrl);4. Successful Response
json
{
"success": true,
"itemId": "7419827391823719283",
"shareUrl": "https://www.tiktok.com/@fashion_us/video/7419827391823719283",
"status": "PUBLISHED",
"creditDeducted": 5,
"remainingBalance": 45
}