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.

GET /api/v1/transcript

Fetch the transcript for a YouTube video. Requires authentication.

Query Parameters

ParameterTypeRequiredDescription
video_idstring*YouTube video ID (11 characters). Required if url is not provided.
urlstring*Full YouTube URL. Required if video_id is not provided.
langstringNoLanguage code (e.g. en, es, ja). Defaults to en.

* Provide either video_id or url, not both.

Response Fields

FieldTypeDescription
video_idstringThe YouTube video ID
titlestringVideo title
languagestringLanguage code of the returned transcript
is_generatedbooleanWhether the captions are auto-generated
segmentsarrayArray of transcript segments
segments[].textstringSegment text content
segments[].startnumberStart time in seconds
segments[].durationnumberDuration in seconds

Example

Request
$ curl -H "Authorization: Bearer 2yt_..." \
  "https://2outube.com/api/v1/transcript?video_id=dQw4w9WgXcQ&lang=en"
POST /api/v1/chat

Ask AI questions about any YouTube video. Supports multi-turn conversations. 1 credit per message. Requires authentication.

Request Body

FieldTypeRequiredDescription
video_idstringYesYouTube video ID (11 characters)
messagestringYesYour question about the video (max 2,000 characters)
conversation_historyarrayNoPrior 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

Request
$ 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"
Multi-turn: Pass previous messages in conversation_history to maintain context across questions. The AI references the video transcript with timestamps.
POST /api/v1/register

Create a new account. Sends a verification email. No authentication required.

Request Body

FieldTypeRequiredDescription
emailstringYesValid email address

Response

{
  "success": true,
  "message": "Verification email sent. Check your inbox."
}
GET /api/v1/verify

Verify email and receive API key. Called by clicking the link in the verification email.

Query Parameters

ParameterTypeRequiredDescription
tokenstringYesVerification token from the email link

Response

{
  "success": true,
  "api_key": "2yt_abc123...",
  "credits": 200,
  "plan": "free"
}
GET /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"
}
POST /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..."
}
Warning: Your old API key stops working immediately. Update all integrations before rotating.
POST /api/v1/subscribe

Upgrade or change your subscription plan. Redirects to Stripe checkout. Requires authentication.

Request Body

FieldTypeRequiredDescription
planstringYesOne of: starter, pro, scale

Response

{
  "success": true,
  "checkout_url": "https://checkout.stripe.com/..."
}
POST /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

FieldTypeRequiredDescription
packstringYesOne of: 1k, 2k, 5k, 10k, 25k, 50k

Credit Packs

PackCreditsPricePer 1K
1k1,000$12$12.00
2k2,000$20$10.00
5k5,000$40$8.00
10k10,000$70$7.00
25k25,000$150$6.00
50k50,000$250$5.00

Response

{
  "checkout_url": "https://checkout.stripe.com/...",
  "pack": "5k",
  "credits": 5000,
  "price_usd": 40
}

Example

Request
$ curl -X POST -H "Authorization: Bearer 2yt_..." \
  -H "Content-Type: application/json" \
  -d '{"pack": "5k"}' \
  "https://2outube.com/api/v1/buy-credits"

Error Codes

StatusMeaningDescription
400Bad RequestMissing or invalid parameters (e.g. no video_id or malformed URL)
401UnauthorizedMissing or invalid API key
402Payment RequiredCredits exhausted — upgrade your plan
404Not FoundNo transcript available for this video (disabled captions, private, etc.)
405Method Not AllowedWrong HTTP method for this endpoint
429Too Many RequestsRate limit exceeded. Check Retry-After header.
500Internal Server ErrorSomething 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

PlanRequests/min
Free10
Starter / Pro / Scale100

When rate limited, the response includes a Retry-After header (in seconds).

Response Headers

HeaderDescription
X-Credits-RemainingNumber of credits left in your current billing period
X-CacheHIT or MISS — indicates whether the response was served from cache
Retry-AfterSeconds to wait before retrying (only present on 429 responses)

Ready to integrate?

Copy-paste code examples in Python, JavaScript, and more