API Reference
Complete endpoint documentation
Base URL
https://2outube.com/api/v1
Authentication
All authenticated endpoints require a Bearer token in the Authorization header:
Authorization: Bearer 2yt_your_api_key
API keys are prefixed with 2yt_. Keep your key secret — do not expose it in client-side code or public repositories.
/api/v1/transcript
Fetch the transcript for a YouTube video. Requires authentication.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
video_id | string | * | YouTube video ID (11 characters). Required if url is not provided. |
url | string | * | Full YouTube URL. Required if video_id is not provided. |
lang | string | No | Language code (e.g. en, es, ja). Defaults to en. |
* Provide either video_id or url, not both.
Response Fields
| Field | Type | Description |
|---|---|---|
video_id | string | The YouTube video ID |
title | string | Video title |
language | string | Language code of the returned transcript |
is_generated | boolean | Whether the captions are auto-generated |
segments | array | Array of transcript segments |
segments[].text | string | Segment text content |
segments[].start | number | Start time in seconds |
segments[].duration | number | Duration in seconds |
Example
$ curl -H "Authorization: Bearer 2yt_..." \
"https://2outube.com/api/v1/transcript?video_id=dQw4w9WgXcQ&lang=en"
/api/v1/chat
Ask AI questions about any YouTube video. Supports multi-turn conversations. 1 credit per message. Requires authentication.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
video_id | string | Yes | YouTube video ID (11 characters) |
message | string | Yes | Your question about the video (max 2,000 characters) |
conversation_history | array | No | Prior messages for multi-turn context (max 20). Each item: {"role": "user"|"assistant", "content": "..."} |
Response
{
"video_id": "dQw4w9WgXcQ",
"response": "At 5:30, the speaker mentions that...",
"credits": {
"used": 5,
"limit": 1000,
"remaining": 995
}
}
Example
$ curl -X POST -H "Authorization: Bearer 2yt_..." \
-H "Content-Type: application/json" \
-d '{"video_id": "dQw4w9WgXcQ", "message": "Summarize this video"}' \
"https://2outube.com/api/v1/chat"
conversation_history to maintain context across questions. The AI references the video transcript with timestamps.
/api/v1/register
Create a new account. Sends a verification email. No authentication required.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
email | string | Yes | Valid email address |
Response
{
"success": true,
"message": "Verification email sent. Check your inbox."
}
/api/v1/verify
Verify email and receive API key. Called by clicking the link in the verification email.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | Yes | Verification token from the email link |
Response
{
"success": true,
"api_key": "2yt_abc123...",
"credits": 200,
"plan": "free"
}
/api/v1/me
Get current account details including credit balance and plan. Requires authentication.
Response
{
"email": "you@example.com",
"plan": "pro",
"credits_remaining": 4832,
"credits_total": 5000,
"resets_at": "2026-03-01T00:00:00Z"
}
/api/v1/rotate-key
Generate a new API key and invalidate the old one. Requires authentication.
Response
{
"success": true,
"api_key": "2yt_new_key_here..."
}
/api/v1/subscribe
Upgrade or change your subscription plan. Redirects to Stripe checkout. Requires authentication.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
plan | string | Yes | One of: starter, pro, scale |
Response
{
"success": true,
"checkout_url": "https://checkout.stripe.com/..."
}
/api/v1/buy-credits
Buy a one-time credit pack. Credits are added to your balance immediately after payment. No expiry. Requires authentication.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
pack | string | Yes | One of: 1k, 2k, 5k, 10k, 25k, 50k |
Credit Packs
| Pack | Credits | Price | Per 1K |
|---|---|---|---|
1k | 1,000 | $12 | $12.00 |
2k | 2,000 | $20 | $10.00 |
5k | 5,000 | $40 | $8.00 |
10k | 10,000 | $70 | $7.00 |
25k | 25,000 | $150 | $6.00 |
50k | 50,000 | $250 | $5.00 |
Response
{
"checkout_url": "https://checkout.stripe.com/...",
"pack": "5k",
"credits": 5000,
"price_usd": 40
}
Example
$ curl -X POST -H "Authorization: Bearer 2yt_..." \
-H "Content-Type: application/json" \
-d '{"pack": "5k"}' \
"https://2outube.com/api/v1/buy-credits"
Error Codes
| Status | Meaning | Description |
|---|---|---|
400 | Bad Request | Missing or invalid parameters (e.g. no video_id or malformed URL) |
401 | Unauthorized | Missing or invalid API key |
402 | Payment Required | Credits exhausted — upgrade your plan |
404 | Not Found | No transcript available for this video (disabled captions, private, etc.) |
405 | Method Not Allowed | Wrong HTTP method for this endpoint |
429 | Too Many Requests | Rate limit exceeded. Check Retry-After header. |
500 | Internal Server Error | Something went wrong on our end. Retry or contact support. |
All error responses follow this format:
{
"error": "Error message describing what went wrong",
"code": 401
}
Rate Limits
| Plan | Requests/min |
|---|---|
| Free | 10 |
| Starter / Pro / Scale | 100 |
When rate limited, the response includes a Retry-After header (in seconds).
Response Headers
| Header | Description |
|---|---|
X-Credits-Remaining | Number of credits left in your current billing period |
X-Cache | HIT or MISS — indicates whether the response was served from cache |
Retry-After | Seconds to wait before retrying (only present on 429 responses) |
Ready to integrate?
Copy-paste code examples in Python, JavaScript, and more