YouTube Video Captions API
Get available YouTube caption links by video URL or ID. Each track includes its language, kind and URL. Videos without captions return an empty list. Empty results and failures are free.
Get available YouTube caption links by video URL or ID. Each track includes its language, kind and URL. Videos without captions return an empty list. Empty results and failures are free.
Open product page and API TesterEndpoint and authentication
POST https://api.goanyapi.com/api/v1/youtube/video/captionsSynchronous response, without tasks or polling. Use an API Key or supported OAuth Bearer credential. No Path or Query parameters.
Input parameters
| Parameter | Location | Type | Required | Default | Constraints and meaning |
|---|---|---|---|---|---|
| Authorization | Header | string | Yes | — | Bearer YOUR_API_KEY |
| Content-Type | Header | string | Yes | application/json | application/json |
| url | JSON body | string | Yes | — | YouTube HTTPS video URL or 11-character video ID. Supported URL forms include watch?v=, youtu.be/, /shorts/, /embed/, /live/ and /v/. pattern: ^(?:[A-Za-z0-9_-]{11}|https://(?:(?:www.|m.)?youtube.com/(?:watch?[^\s]v=[A-Za-z0-9_-]{11}[^\s]|(?:shorts|embed|live|v)/[A-Za-z0-9_-]{11}/?(?:[?#][^\s])?)|(?:www.)?youtu.be/[A-Za-z0-9_-]{11}/?(?:[?#][^\s])?))$ minLength: 1 |
Output fields
| Field | Type | Meaning |
|---|---|---|
| code | string | ok on success; public error code on failure |
| message | string | Status message |
| data.result | object / null | Public result; null, empty and absent values are preserved |
| data.creditsUsed | integer | Actual configured charge; zero for empty results |
| data.remainingCredits | number | Balance after settlement |
| data.result.videoId | string | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.captions | array | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.captions[].lang | string | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.captions[].kind | string | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.captions[].url | string | Actual business field; may be empty or absent; formatted counts are not exact integers |
If no captions are available the response is HTTP 200 with captions: [] and no charge. Each track includes lang (language code), kind (manual or asr for auto-generated captions), and url (the caption link).
This endpoint does not accept a cursor or support pagination. List length is the number returned by this request, not a total.
Request example
curl -X POST 'https://api.goanyapi.com/api/v1/youtube/video/captions' -H 'Authorization: Bearer YOUR_API_KEY' -H 'Content-Type: application/json' --data '{"url":"https://www.youtube.com/watch?v=Y334D183ofE"}'Real response example
This example uses the corresponding fields from a saved real response. Live data.creditsUsed and data.remainingCredits are omitted. The URL may have expired.
{
"code": "ok",
"message": "ok",
"data": {
"result": {
"videoId": "Y334D183ofE",
"captions": [
{
"lang": "en",
"kind": "asr",
"url": "https://www.youtube.com/api/timedtext?v=Y334D183ofE&ei=rdX_at2iHrL2sfIP94ywKQ&caps=asr&opi=112496729&xoaf=5&xowf=1&xospf=1&hl=en&ip=0.0.0.0&ipbits=0&expire=1795176477&sparams=ip,ipbits,expire,v,ei,caps,opi,xoaf&signature=BB86F81E8877C0B7C30C04F070DBA83A80A4A78A.4E067EDCE358551DADCBC240B5023454CE5B47&key=yt8&kind=asr&lang=en&variant=gemini"
}
]
}
}
}Billing and status codes
…
Only nonempty results use this endpoint’s configured rate. Empty results and failures are free.
| HTTP | Meaning |
|---|---|
| 200 | Query completed; may be empty |
| 400 | Invalid JSON or parameters |
| 401 | Authentication failed |
| 402 | Insufficient credits |
| 429 | Rate limited; honor Retry-After |
| 502 | Data request failed |
| 503 | API or pricing not configured |