API v2

Transcriptly API v2 extracts video metadata, retrieves existing closed captions, and generates AI-powered transcripts across YouTube, TikTok, Instagram, and X.

  • Multi-Platform Coverage: Process public video links from YouTube, TikTok, Instagram Reels & posts, and X (Twitter).
  • Smart Fallback Architecture: Fetch published captions in milliseconds for 1 credit, or generate accurate transcripts with AI when captions are missing.

Last updated: December 2, 2026

Getting started

All requests are sent over HTTPS with standard JSON payloads. Authenticate every call using the X-API-Key header.

https://transcriptly.org/api/v2
X-API-Key: your_api_key_here

Credit Pricing & Quotas

  • /media: Costs 1 credit per successful request.
  • /transcripts: Costs 1 credit when captions are returned, or 1 credit when confirming no captions exist (HTTP 404).
  • /ai-transcripts: Charged at 2 credits per minute of video duration (rounded up to nearest minute, minimum 1 minute). Charged only upon successful completion.
  • GET /ai-transcripts/:id: Free. Polling does not consume credits or count toward rate limits.
  • Rate Limit: 120 requests per hour per account, shared across v1 and v2 endpoints. Rate-limited endpoints include X-RateLimit-* headers. GET /ai-transcripts/:id is exempt.

Recommended workflow

To achieve the lowest latency and minimize credit consumption, we recommend the following fallback pattern:

  1. Try existing captions first: Call POST /transcripts. If the creator or platform already provided captions, you receive them instantly for just 1 credit.
  2. Inspect the 404 response: If no captions exist, the endpoint returns HTTP 404 along with durationSeconds and estimatedCredits.
  3. Fall back to AI transcription: If needed, call POST /ai-transcripts with the video URL.
  4. Handle sync vs. async results: Short clips may return the transcript immediately (HTTP 200). Longer videos return a job ID (HTTP 202), which you can poll via GET /ai-transcripts/:id until completed.

Get media metadata

POST/media

Extracts video metadata including title, author, thumbnail, duration, and whether caption tracks were detected in the source data.

Supported URL Formats

  • YouTube: youtube.com/watch?v=..., youtu.be/...
  • TikTok: tiktok.com/@username/video/...
  • Instagram: Reels and video posts (/reel/, /reels/, /tv/, /p/)
  • X (Twitter): Video status posts (x.com/.../status/..., twitter.com/...)

Request

{
  "url": "https://www.youtube.com/watch?v=VIDEO_ID"
}
FieldTypeRequirementDescription
urlstringRequiredVideo URL from any supported platform.

Response

{
  "code": 200,
  "message": "success",
  "data": {
    "platform": "youtube",
    "title": "Introduction to AI",
    "description": "A quick overview of artificial intelligence.",
    "author": "Tech Channel",
    "authorUsername": "techchannel",
    "thumbnailUrl": "https://img.youtube.com/vi/VIDEO_ID/maxresdefault.jpg",
    "durationSeconds": 180,
    "publishedAt": "2024-01-15T10:30:00Z",
    "availableLanguages": [
      { "code": "en", "name": "English" }
    ],
    "hasCaptions": true
  }
}
FieldTypeDescription
data.platformstringIdentified platform: youtube, tiktok, instagram, or x.
data.titlestringVideo title or headline.
data.descriptionstring | nullPost description or caption text, if available.
data.authorstringChannel or account display name.
data.authorUsernamestring | nullHandle or username without @, if available.
data.thumbnailUrlstringThumbnail image URL.
data.publishedAtstring | nullPublication timestamp in ISO 8601 format.
data.durationSecondsnumberTotal video duration in seconds. Useful for estimating AI credit usage.
data.availableLanguagesarrayCaption languages listed in platform metadata. Hint only — an empty list does not mean captions are missing.
data.hasCaptionstrue | nulltrue if metadata lists caption languages. null means inconclusive. Call /transcripts to confirm.

Metadata language hints are not authoritative. To confirm whether captions exist, call POST /transcripts. A definitive "no captions" result is HTTP 404 with body code 404 (and usually includes estimatedCredits for AI fallback).

Get existing transcript

POST/transcripts

Retrieves published closed captions from the platform. This is fast and costs 1 credit. It does not perform AI speech recognition.

Request

{
  "url": "https://www.youtube.com/watch?v=VIDEO_ID",
  "language": "en"
}
FieldTypeRequirementDescription
urlstringRequiredVideo URL from any supported platform.
languagestringOptionalOptional ISO language code (e.g. en, es). If omitted, the default or first available caption track is returned.

Response: Captions Available (HTTP 200)

{
  "code": 200,
  "message": "success",
  "data": {
    "platform": "youtube",
    "language": "en",
    "languageName": "English",
    "segments": [
      {
        "id": 0,
        "text": "Welcome to the video.",
        "startMs": 0,
        "endMs": 1200,
        "startTimeText": "0:00"
      }
    ],
    "availableLanguages": [
      { "code": "en", "name": "English", "isGenerated": false }
    ]
  }
}
FieldTypeDescription
data.platformstringSource platform identifier.
data.languagestringLanguage code of the returned captions.
data.languageNamestringReadable name of the language.
data.segments[].textstringTranscript line content.
data.segments[].startMsnumberStart time offset in milliseconds.
data.segments[].endMsnumberEnd time offset in milliseconds.
data.segments[].startTimeTextstringFormatted timestamp string (e.g. '0:00').
data.availableLanguagesarrayList of other available caption tracks.

Response: No Captions (HTTP 404)

This is the definitive "no captions" signal: HTTP 404 with body code 404. The response includes duration and an AI cost estimate. Do not treat an empty availableLanguages list from /media as proof that captions are missing. A missing video instead returns body code 4007 and does not consume credits.

{
  "code": 404,
  "message": "This video has no captions.",
  "data": {
    "platform": "tiktok",
    "durationSeconds": 42,
    "estimatedCredits": 2,
    "availableLanguages": []
  }
}

AI audio transcription

Transcribe the spoken audio of any supported video when closed captions are missing or incomplete.

POST/ai-transcripts

Initiates AI audio transcription. Charged at 2 credits per minute of video duration upon completion.

Request

{
  "url": "https://www.tiktok.com/@user/video/7123456789012345678"
}
FieldTypeRequirementDescription
urlstringRequiredVideo URL from any supported platform.

Response: Processing (HTTP 202)

Returned when transcription runs asynchronously. Save the id and poll GET /ai-transcripts/:id.

{
  "code": 202,
  "message": "AI transcription is processing",
  "data": {
    "id": "job_id_here",
    "status": "processing",
    "estimatedCredits": 2
  }
}

Response: Immediate Completion (HTTP 200)

Short videos may finish in the same request and return the full transcript payload immediately.

{
  "code": 200,
  "message": "success",
  "data": {
    "id": "job_id_here",
    "status": "completed",
    "platform": "youtube",
    "language": "en",
    "languageName": "English",
    "segments": [
      {
        "id": 0,
        "text": "Here is the spoken audio transcribed by AI.",
        "startMs": 0,
        "endMs": 2400,
        "startTimeText": "0:00"
      }
    ],
    "estimatedCredits": 2
  }
}
GET/ai-transcripts/:id

Polls the status of an asynchronous transcription job. This request is free and is not counted against your hourly rate limit.

Response: While Processing

{
  "code": 200,
  "message": "AI transcription is processing",
  "data": {
    "id": "job_id_here",
    "status": "processing",
    "estimatedCredits": 2
  }
}

Response: When Completed

{
  "code": 200,
  "message": "success",
  "data": {
    "id": "job_id_here",
    "status": "completed",
    "platform": "tiktok",
    "language": "en",
    "languageName": "English",
    "segments": [
      {
        "id": 0,
        "text": "Here is the spoken audio transcribed by AI.",
        "startMs": 0,
        "endMs": 2400,
        "startTimeText": "0:00"
      }
    ],
    "estimatedCredits": 2
  }
}
FieldTypeDescription
data.idstringUnique transcription job identifier.
data.statusstringCurrent job status: processing, completed, or failed.
data.platformstringSource platform identifier.
data.languagestringLanguage code of the transcribed audio.
data.languageNamestringReadable name of the transcribed language.
data.segmentsarrayTimestamped transcript segments (present when status is completed).
data.estimatedCreditsnumberActual credits consumed for this transcription.

Code examples

cURL

# 1. Try fetching existing captions (1 credit)
curl -X POST https://transcriptly.org/api/v2/transcripts \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key_here" \
  -d '{"url":"https://www.youtube.com/watch?v=VIDEO_ID"}'

# 2. Fall back to AI transcription if no captions exist (2 credits/min)
curl -X POST https://transcriptly.org/api/v2/ai-transcripts \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key_here" \
  -d '{"url":"https://www.tiktok.com/@user/video/VIDEO_ID"}'

# 3. Poll job status if a job ID was returned (Free, no rate limit impact)
curl https://transcriptly.org/api/v2/ai-transcripts/job_id_here \
  -H "X-API-Key: your_api_key_here"

JavaScript / TypeScript

const API_KEY = "your_api_key_here"
const VIDEO_URL = "https://www.tiktok.com/@user/video/7123456789012345678"

async function getOrGenerateTranscript(url) {
  // Step 1: Check for existing captions (1 credit)
  const res = await fetch("https://transcriptly.org/api/v2/transcripts", {
    method: "POST",
    headers: { "Content-Type": "application/json", "X-API-Key": API_KEY },
    body: JSON.stringify({ url }),
  })
  const json = await res.json()

  if (res.ok) {
    return json.data.segments
  }

  // Step 2: If no captions (body code 404), request AI transcription (2 credits/min)
  if (res.status === 404 && json.code === 404) {
    console.log(`No captions found. Estimated credits: ${json.data.estimatedCredits}`)

    const aiRes = await fetch("https://transcriptly.org/api/v2/ai-transcripts", {
      method: "POST",
      headers: { "Content-Type": "application/json", "X-API-Key": API_KEY },
      body: JSON.stringify({ url }),
    })
    const aiJson = await aiRes.json()

    // Completed immediately (synchronous short video)
    if (aiRes.ok && aiJson.data.status === "completed") {
      return aiJson.data.segments
    }

    // Processing asynchronously -> poll until ready
    if (aiRes.status === 202) {
      const jobId = aiJson.data.id
      return await pollJob(jobId)
    }
  }

  throw new Error(json.message || "Failed to fetch transcript")
}

async function pollJob(jobId) {
  while (true) {
    await new Promise((resolve) => setTimeout(resolve, 3000))
    const res = await fetch(`https://transcriptly.org/api/v2/ai-transcripts/${jobId}`, {
      headers: { "X-API-Key": API_KEY },
    })
    const json = await res.json()

    if (json.data.status === "completed") {
      return json.data.segments
    }
    if (json.data.status === "failed") {
      throw new Error("AI transcription failed")
    }
  }
}

Python

import time
import requests

API_KEY = "your_api_key_here"
HEADERS = {"X-API-Key": API_KEY, "Content-Type": "application/json"}
URL = "https://www.tiktok.com/@user/video/7123456789012345678"

# 1. Attempt to fetch pre-existing captions (1 credit)
res = requests.post(
    "https://transcriptly.org/api/v2/transcripts",
    headers=HEADERS,
    json={"url": URL},
)

payload = res.json()
if res.status_code == 200:
    segments = payload["data"]["segments"]
    print("Found existing captions:", segments)
elif res.status_code == 404 and payload.get("code") == 404:
    # 2. No captions available -> fall back to AI transcription (2 credits/min)
    ai_res = requests.post(
        "https://transcriptly.org/api/v2/ai-transcripts",
        headers=HEADERS,
        json={"url": URL},
    )
    job_data = ai_res.json()["data"]

    if job_data.get("status") == "completed":
        segments = job_data["segments"]
    elif ai_res.status_code == 202:
        job_id = job_data["id"]
        # 3. Poll job status until complete (free, does not consume rate limit)
        while True:
            time.sleep(3)
            poll_res = requests.get(
                f"https://transcriptly.org/api/v2/ai-transcripts/{job_id}",
                headers={"X-API-Key": API_KEY},
            )
            poll_data = poll_res.json()["data"]
            if poll_data["status"] == "completed":
                segments = poll_data["segments"]
                break
            if poll_data["status"] == "failed":
                raise RuntimeError("AI transcription failed")
    else:
        raise RuntimeError(ai_res.json().get("message", "AI transcription failed"))

    print("AI Transcript segments:", segments)
else:
    raise RuntimeError(payload.get("message", "Failed to fetch transcript"))

Errors

All error responses return a standardized JSON envelope with an HTTP status code, an application error code, and a descriptive message.

HTTPBody codeMeaning
400400Invalid JSON body, missing URL, or unable to determine video duration.
4004001Unsupported URL or media link contains no playable video. No credits consumed.
401401Missing or invalid API key in X-API-Key header.
4024005Free plan accounts cannot fetch YouTube captions for videos exceeding 60 minutes. No credits consumed.
4034003Insufficient account credits to complete the request. The response includes required credits.
404404Video has no closed captions. 1 credit consumed; response includes AI cost estimate.
4044007Video was deleted, private, or not found. No credits consumed.
429429Hourly rate limit exceeded (120 requests/hour). Inspect Retry-After header.
5005001Upstream platform extraction failed. No credits consumed.