API Documentation

Base URL: https://yt2txt.com — Authenticate via Bearer JWT or X-API-Key header.

Quick Start

1

Get API Key

Register an account and create an API key from your dashboard or via the API.

2

Make Requests

Authenticate with Bearer token or X-API-Key header on every request.

3

Transcribe Videos

POST a YouTube URL to /v1/transcribe and get a full transcript back.

Authentication

All API endpoints require authentication via one of two methods:

Bearer Token (JWT)

Obtain a JWT by logging in via POST /auth/login. Include it in the Authorization header.

bash
curl -X POST https://yt2txt.com/v1/transcribe \
  -H "Authorization: Bearer <your-jwt-token>" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://youtube.com/watch?v=dQw4w9WgXcQ"}'

API Key

Create an API key via POST /keys. Include it in the X-API-Key header.

bash
curl -X POST https://yt2txt.com/v1/transcribe \
  -H "X-API-Key: yt2_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://youtube.com/watch?v=dQw4w9WgXcQ"}'

Rate Limits

Rate limits depend on your subscription plan. Exceeding limits returns HTTP 429.

Plan Requests/hour Daily minutes Monthly minutes
Free 5 10 300
Starter 30 100 5,000
Pro 120 300 15,000
Max 300 500 Unlimited

Endpoints

POST /v1/transcribe

Submit a YouTube video for transcription. Returns a job immediately (async) or waits for the result (sync).

Request Body

Field Type Required Description
url string Yes YouTube video URL
async_mode boolean No If true, returns immediately with a job_id for polling. Default: false

Example

bash
curl -X POST https://yt2txt.com/v1/transcribe \
  -H "X-API-Key: yt2_your_key" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://youtube.com/watch?v=dQw4w9WgXcQ"}'

Response (sync)

json
{
  "job_id": "abc123",
  "status": "completed",
  "video_title": "Rick Astley - Never Gonna Give You Up",
  "duration_seconds": 213,
  "segments": [
    {"start": 0.0, "end": 4.5, "text": "We're no strangers to love..."}
  ],
  "full_text": "We're no strangers to love..."
}

Response (async_mode: true)

json
{
  "job_id": "abc123",
  "status": "processing"
}

Error Handling

All errors follow a consistent JSON format:

json
{
  "detail": "Description of what went wrong"
}
Status Code Description
400 Bad Request — invalid parameters or missing required fields
401 Unauthorized — missing or invalid authentication
403 Forbidden — insufficient permissions or quota exceeded
404 Not Found — resource does not exist
422 Unprocessable Entity — validation error in request body
429 Too Many Requests — rate limit exceeded
500 Internal Server Error — unexpected failure

Interactive Explorer

Try out the API directly from your browser using Swagger UI. Authenticate with your token to make live requests.

Scroll down or click to load the API Explorer