Subtitle API code examples

Copy-paste subtitle API examples for Python, Node.js, PHP, Go, Ruby, Rust, JavaScript and cURL — plus every conversion direction (SRT, VTT, ASS, TXT). v1 · stable

Working code for every supported language and conversion, all hitting the same endpoint — POST /api/v1/convert with multipart/form-data, authenticated via Authorization: Bearer <key>. Copy, paste, convert.

Every language example converts movie.srt and writes the result to disk. Pick your language below, or try the free subtitle tester on the homepage first — no signup required.

Language examples

Language Page What it shows
Python Convert SRT to VTT with Python requests, reads response headers, writes output file
Node.js Convert SRT to VTT with Node.js Native fetch + FormData
PHP Convert SRT to VTT with PHP cURL + CURLFile
Go Convert SRT to VTT with Go net/http + multipart
Ruby Convert SRT to VTT with Ruby net/http, manual multipart boundary
Rust Convert SRT to VTT with Rust reqwest blocking
JavaScript Convert SRT to VTT in the browser Browser fetch + FormData + download
cURL Convert SRT to VTT with cURL One-liner for bash, CI, scripts

Conversion examples

Conversion Page Why
SRT → VTT Convert SRT to VTT WebVTT for browsers and streaming platforms
VTT → SRT Convert VTT to SRT Universal interchange format
ASS → SRT Convert ASS to SRT Drop styling for maximum compatibility
SRT → ASS Convert SRT to ASS Add styling and positioning
ASS → VTT Convert ASS to VTT Styled captions to browser-native WebVTT
VTT → ASS Convert VTT to ASS Add styling and positioning to WebVTT
SRT → TXT Convert SRT to TXT Plain transcript, no timestamps

Minimal cURL

curl -X POST https://api.example.com/api/v1/convert \
  -H "Authorization: Bearer your_api_key" \
  -F "[email protected]" \
  -F "from=srt" \
  -F "to=vtt" \
  -o movie.vtt

Need a key? Create one to get 100 free credits. Need to test right now? Use the free subtitle tester on the homepage — no signup required.

Next

↑ Back to top