2026-11-14 · 5 min read
How to add captions to TikTok videos with an API
TikTok is a sound-on platform, but captions still do the heavy lifting: they make the hook readable in the first second, keep viewers with you through fast cuts, and travel with the video into shares and downloads. The captioned-word style that dominates the For You feed is a stylistic choice as much as an accessibility one. caption.sh generates it with an API call.
The caption.sh workflow
import requests, time
API = "https://api.caption.sh/v1"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}
job = requests.post(
f"{API}/videos",
headers=HEADERS,
json={
"source_url": "https://your-cdn.example/tiktok.mp4",
"options": {
"position": "center",
"max_words": 3,
"max_lines": 2,
"caps": True,
"highlight": True,
"highlight_color": "#22D3EE",
"outline_width": 2,
"max_tilt": 3,
},
},
).json()
job_id = job["job_id"]
for _ in range(120):
job = requests.get(f"{API}/jobs/{job_id}", headers=HEADERS).json()
if job["status"] in ("done", "error"):
break
time.sleep(5)
if job["status"] == "done":
r = requests.get(f"{API}/jobs/{job_id}/result", headers=HEADERS,
allow_redirects=False)
video_url = r.headers["Location"]Jobs run queued, awaiting_upload, running, then done or error; poll until a terminal status. The result endpoint answers 302, so read the Location header with redirects disabled. Results are stored for 24 hours, then deleted. A 429 means the transcription throughput ceiling is reached; wait and retry rather than submitting duplicates.
Fit for TikTok
- Export the edit at 1080x1920 before captioning so text lands where you designed it.
- Center position, caps on, three words per line, a bright highlight, and a small max_tilt is the house style of the For You feed.
- Keep text out of the right-side action rail and the bottom caption zone where TikTok draws its UI.
- TikTok's own auto-captions are optional per viewer. Burned-in captions are always on, which is the point for the hook, and they survive downloads and re-uploads.
Tradeoffs and cost
- Burned-in captions cannot be toggled, resized, or translated by viewers. Leave TikTok's captions enabled for viewers who need adjustable text.
- Each job covers up to 10 minutes, well past any TikTok.
- At $0.10 per minute prepaid, captioning a 45-second TikTok costs about $0.08.