Errors & Status Codes
Predictable shapes, sane retry semantics.
Error response shape
{
"detail": "Human-readable error message",
"code": "ERROR_CODE"
}Payment errors (402) have code: "insufficient_credits" too, but their detail is an object, so you can render an in-product upgrade prompt automatically. It has message, reason, required, available, action_label and action_url, plus plans with the current price and credits of each plan. Monthly subscribers also get alt_action_label and alt_action_url for the Annual upgrade.
The message gives the numbers when you have some credits left ("This call needs 20 credits; you have 5.") and says you've run out only at zero. It ends with the fix: a plan, a top-up, or an updated payment method, which is also where action_url leads.
Accounts without a plan also get checkout_url and checkout_plan: a link that opens checkout for that plan without signing in, so it works from a terminal, a log or an AI app's browser. It is valid for 7 days and only buys a plan for the account that made the call.
{
"detail": {
"message": "This call needs 20 credits; you have 5. Buy a top-up to keep going.",
"reason": "insufficient_credits",
"required": 20,
"available": 5,
"action_label": "Buy a top-up",
"action_url": "https://youtubetranscriptapi.com/dashboard/billing?from=402#top-up",
"alt_action_label": "Upgrade to Annual (15,000 credits now)",
"alt_action_url": "https://youtubetranscriptapi.com/dashboard/billing?from=402#upgrade",
"plans": {
"monthly": { "price_usd": 3, "interval": "month", "credits_per_interval": 1000, "topup_usd_per_1k": 2.5, "url": "…?plan=monthly" },
"annual": { "price_usd": 30, "interval": "year", "credits_per_interval": 15000, "topup_usd_per_1k": 2, "refund": "Refundable within 14 days if under 1,000 credits are used", "url": "…?plan=annual" }
}
},
"code": "insufficient_credits"
}Your balance is on every successful response in X-Credits-Remaining; see Rate Limits.
Status code reference
| Code | Meaning | Retry | Action |
|---|---|---|---|
| 200 | Success | — | Process the response. |
| 204 | No Content | — | Reply to a CORS preflight (OPTIONS) request. |
| 401 | Unauthorized | ❌ | Bearer token missing (missing_auth), or key invalid or revoked (invalid_auth). Verify your API key. |
| 402 | Payment Required | ❌ | Not enough credits. Top up credits or pick a plan. |
| 403 | Forbidden | ❌ | Account paused (payment dispute). Contact support. |
| 404 | Not Found | ❌ | Transcript, channel or playlist unavailable (transcript_not_found, channel_not_found, playlist_not_found), or an unknown path (route_not_found). |
| 405 | Method Not Allowed | ❌ | Every endpoint takes GET only. |
| 408 | Timeout | ✅ | upstream_timeout. Retry after Retry-After seconds (3). |
| 422 | Validation Error | ❌ | A parameter is missing or invalid (validation_error), or a listing continuation was sent (continuation_unavailable; first page only). |
| 429 | Rate Limited | ✅ | Respect the Retry-After header. |
| 500 | Server Error | ⚠️ | The request didn't reach the API, for example after a network failure; the body may not be JSON. Retry once, then contact support. |
| 503 | Unavailable | ✅ | upstream_error, config_missing or internal (account check failed). Retry after Retry-After seconds (3). |
Charging rules
- Successful (200) — transcript 1 credit, search 4, channel search 1, channel or playlist listing 20.
- Cached HIT (200) — same price as a fresh fetch. Speed is the benefit.
- Plan credits are spent first, then top-up credits.
- Free endpoints (200) — 0 credits, but require ≥1 active credit.
- 4xx and 5xx errors — never charged.
- 429 (rate limited) — never charged.