← All documentation
Networks

TikTok

Publish a video to TikTok (Content Posting API, Direct Post).

Connect

OAuth:

curl -X POST https://api.herald.leiritech.com/v1/accounts/connect \
  -H "Authorization: Bearer hld_…" -H "Content-Type: application/json" \
  -d '{"network":"tiktok","redirect_url":"https://your-app.example/connected"}'

Prerequisites (owner) — gated: a TikTok developer app with video.publish; its Client Key/Secret in admin → Platform apps; redirect https://herald.leiritech.com/api/oauth/tiktok/callback registered; the media domain (Herald's R2 host) verified in the TikTok portal (required for URL delivery); and app audit for public Direct Post — unaudited apps are limited to the creator's allowed privacy levels (often self-only).

Publish

Upload a video first (MP4/MOV), then publish — Herald hands TikTok the hosted video URL (PULL_FROM_URL), so no byte upload:

# 1) upload the video
curl -X POST https://api.herald.leiritech.com/v1/media \
  -H "Authorization: Bearer hld_…" -F "file=@clip.mp4"
# → { "id":"v1…", "public_url":"https://cdn…/clip.mp4", "kind":"video" }

# 2) publish
curl -X POST https://api.herald.leiritech.com/v1/posts \
  -H "Authorization: Bearer hld_…" -H "Content-Type: application/json" \
  -d '{"targets":["<tiktok-uuid>"],"text":"my clip","media_ids":["v1…"],"mode":"now"}'
{ "id":"…","status":"published","targets":[{"network":"tiktok","status":"published","platform_post_id":"<publish_id>"}] }

Rules & gotchas

  • A video is required (media_ids must include an MP4/MOV) — the request is rejected otherwise.
  • text becomes the caption. Herald negotiates a privacy level the creator allows.
  • No permalink is returned by the API; the post lands on the creator's profile.