How to Auto-Post TikTok Videos via API
TikTok's Content Posting API requires a per-app review process and uses a strict OAuth scope model with separate permissions for upload-only versus direct publishing. Most developers hit a wall trying to navigate it: the Direct Post permission is gated, the chunked upload session is non-trivial, and TikTok's own documentation contradicts itself in places. CodivUpload manages the review-approved app, handles the upload session, and exposes a single POST /v1/posts endpoint that takes a profile_name and platforms array. This guide shows the exact request shape, the supported overrides for privacy, comments, duets, stitches, and brand content disclosure, and how to handle TikTok's draft-vs-published modes for client-approval workflows.
Prerequisites
- A TikTok account — Personal, Creator, or Business accounts are all supported by the API
- A CodivUpload account on any plan
- A profile with TikTok connected via Profiles → Connect → TikTok
- An API key from Dashboard → API Keys
- Video file accessible via HTTPS URL (R2, S3, GCS, or any public CDN)
Step-by-step
- 1
Connect TikTok inside a CodivUpload profile
Open Dashboard → Profiles, create or pick the profile that represents the TikTok account, then click Connect → TikTok. Approve the scopes when TikTok prompts: video.upload, video.publish, and user.info.basic. CodivUpload stores the encrypted OAuth tokens and refreshes them automatically — you'll never need to handle TikTok's 24-hour token rotation.
- 2
Generate an API key
Dashboard → API Keys → Create Key. Use a separate key per environment (production, staging) so you can revoke one without breaking the others. Each key inherits the workspace-level scopes and is rate-limited per-key.
- 3
Send a POST /v1/posts request with profile_name + platforms
Set post_type=video, profile_name to your profile's display name, and platforms=["tiktok"]. The video URL goes into media_urls (single element). Use the description for the visible caption — TikTok parses #hashtags and @mentions inside the description automatically. The title field is shown in the analytics dashboard but not on the public video page.
curl -X POST https://api.codivupload.com/v1/posts \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "post_type": "video", "profile_name": "my_brand", "platforms": ["tiktok"], "media_urls": ["https://your-cdn.example.com/clip.mp4"], "title": "How I automate my workflow", "description": "How I automate my workflow ✨ #productivity #automation", "tiktok_privacy_level": "PUBLIC_TO_EVERYONE", "tiktok_disable_comment": false, "tiktok_disable_duet": false, "tiktok_disable_stitch": false }' - 4
Choose Direct Post or Draft mode
By default CodivUpload uses TikTok's Direct Post path, which publishes the video immediately (or at scheduled_date). To send the upload to the user's TikTok inbox where they can finalize manually, set tiktok_post_mode=DRAFT. This is the right default for client-approval workflows: the agency uploads via API, the client gets a notification on their phone and posts when ready. The video sits in TikTok's inbox indefinitely until they take action.
- 5
Disclose branded content correctly
If the video is a paid promotion or sponsored content, TikTok requires you to set the brand-content toggle. Pass tiktok_brand_content_toggle=true to mark it as a paid partnership (the third-party advertiser case) or tiktok_brand_organic_toggle=true to mark it as your own brand promoting itself. Failing to disclose paid content can result in account-level penalties from TikTok's enforcement team.
- 6
Schedule for later
Add scheduled_date in ISO 8601 UTC format and CodivUpload's queue picks it up at that exact moment. Or use schedule_best_time=true to let CodivUpload pick the optimal time based on your last 90 days of TikTok analytics. The two options are mutually exclusive — passing both returns a 400 validation error.
Frequently asked
Can I post to multiple TikTok accounts in one call?+
Not in a single call — each TikTok account lives in its own profile. To fan out to multiple TikTok accounts, send one POST /v1/posts per profile_name. You can parallelize the calls; CodivUpload processes them independently and there's no shared rate-limit penalty.
What video formats does TikTok accept via API?+
MP4 or MOV with H.264 codec, max 287 MB file size, 3-180 seconds duration, max 1080p resolution, 9:16 aspect ratio recommended. The API rejects HEVC, ProRes, and other prosumer codecs. If your source is in an unsupported format, transcode with FFmpeg before passing the URL.
Why did my post end up as a draft when I didn't set DRAFT mode?+
TikTok requires Direct Post permission, which is granted only to apps that pass an additional review. CodivUpload's app is approved — but the permission is also account-scoped. New TikTok Business accounts sometimes spend 24-48 hours in TikTok's onboarding window where Direct Post is silently disabled. If every video lands in drafts during the first day or two, that's the cause and it self-resolves.
How do I add allowed comments / duets / stitches?+
Use the tiktok_disable_* boolean overrides. Default is false (allowed) for all three. Set tiktok_disable_comment=true to turn off comments on this specific video — useful for sensitive content or kids' content where you don't want the comment-section moderation overhead.
Can I post horizontal videos to TikTok?+
Technically yes — TikTok accepts 16:9 — but the platform pillarboxes it inside the vertical viewport, which kills engagement. Always crop to 9:16 portrait before uploading. CodivUpload doesn't transcode for you; the file you pass is the file TikTok shows.
What's the rate limit on TikTok's API?+
TikTok publishes 6 calls per minute per access token for the publish endpoint and 100 daily uploads per account. CodivUpload tracks both counters and surfaces them in the destinations array on each post — once you hit the daily cap, further posts are deferred to the next reset window automatically.
How do I disclose AI-generated content?+
Set tiktok_is_aigc=true. TikTok adds an automatic AI-generated label to the video and the metadata is visible in the platform's transparency tools. Failing to disclose AI content for content involving people is a TOS violation under TikTok's synthetic media policy.
Related guides
How to Schedule Instagram Posts via API
Schedule Instagram Reels, carousels, and feed posts via REST API using the CodivUpload profile + platforms model. Free tier, no Meta app review. Code samples in cURL, Python, JavaScript.
How to Bulk Upload YouTube Shorts via API
Upload dozens of YouTube Shorts per day via API. Both standard OAuth and BYOP (Bring Your Own Project) flows. Set thumbnails, captions, playlists, and tags programmatically.
How to Automate Cross-Posting with Python
Cross-post to TikTok, Instagram, YouTube, X, LinkedIn, and 4 more from a single Python script using the CodivUpload SDK. Production-ready code with error handling.
Ready to automate?
Free plan includes 30 posts/month across 11 platforms. No credit card required.
See pricing