YouTube Video Download API
Get time-limited YouTube download links by URL or video ID. Use dual="true" for separate video[] and audio[] tracks that require merging, or omit dual for a combined audio/video file. No resolution is guaranteed. Empty results and failures are free.
Get time-limited YouTube download links by URL or video ID. Use dual="true" for separate video[] and audio[] tracks that require merging, or omit dual for a combined audio/video file. No resolution is guaranteed. Empty results and failures are free.
Open product page and API TesterEndpoint and authentication
POST https://api.goanyapi.com/api/v1/youtube/video/downloadSynchronous 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 |
| dual | JSON body | string | No | false | String true returns separate video and audio tracks in video[] and audio[]; merge them for playback with sound. String false (default) returns a combined audio/video file. Available formats are returned as provided; no resolution is guaranteed. URLs expire at the returned expireAt. Both modes use the same configured request price. enum: true, false |
dual must be the string "true" or "false", not a JSON boolean. Omit it or pass "false" for a combined audio/video file. Use "true" for separate video[] and audio[] tracks. Video tracks have no sound; merge video and audio for playback with sound. Available formats are returned as provided; no resolution is guaranteed. URL expiry is given by expireAt. Expired URLs require an explicit new query; there is no automatic retry.
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.title | string | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.duration | number | Video duration in seconds |
| data.result.expireAt | number | Media URL expiry, Unix seconds |
| data.result.video | array | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.video[].itag | number | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.video[].quality | string | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.video[].mime | string | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.video[].codec | string | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.video[].width | number | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.video[].height | number | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.video[].fps | number | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.video[].bitrate | number | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.video[].sizeBytes | number | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.video[].url | string | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.video[].expireAt | number (optional) | Media URL expiry, Unix seconds |
| data.result.audio | array | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.audio[].itag | number | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.audio[].quality | string | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.audio[].mime | string | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.audio[].codec | string | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.audio[].width | number / null | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.audio[].height | number / null | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.audio[].fps | number / null | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.audio[].bitrate | number | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.audio[].sizeBytes | number | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.audio[].url | string | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.audio[].expireAt | number (optional) | Media URL expiry, Unix seconds |
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/download' -H 'Authorization: Bearer YOUR_API_KEY' -H 'Content-Type: application/json' --data '{"url":"https://www.youtube.com/watch?v=Y334D183ofE"}'Separate-track request example
curl -X POST 'https://api.goanyapi.com/api/v1/youtube/video/download' -H 'Authorization: Bearer YOUR_API_KEY' -H 'Content-Type: application/json' --data '{"url":"https://www.youtube.com/watch?v=Y334D183ofE","dual":"true"}'Separate-track mode returns video[] and audio[]. Each record preserves returned format, codec, bitrate, size and url. Audio width, height and fps may be null. The historical response below is standard mode, not a separate-track response. Missing and empty fields are preserved as returned.
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",
"title": "Jensen Huang: The Man Behind NVIDIA (April 2026)",
"duration": 5239,
"expireAt": 1795172877,
"video": [
{
"itag": 18,
"quality": "360p",
"mime": "video/mp4",
"codec": "avc1.42001E, mp4a.40.2",
"width": 640,
"height": 360,
"fps": 30,
"bitrate": 361641,
"sizeBytes": 236817689,
"url": "https://rr1---sn-gjo-w43l.googlevideo.com/videoplayback?expire=1795172877&ei=rNX_at_QOZaDkucPl6yskA0&ip=78.105.172.125&id=o-AJvaVOurJJAA8ruC7Nh_Js7MPkXqZLv-7HO1UAwtjxIR&itag=18&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&met=1795151276%2C&mh=4g&mm=18%2C29&mn=sn-gjo-w43l%2Csn-qjp5q5-54&ms=aub%2Crdu&mv=u&mvi=1&pl=24&rms=aub%2Caub&pcm2=no&bui=AZFAFb86opTl9L9p8NkTc6r0cib9GMkdXQLpm_bCDYNAJvubLYQMH3IvtFOddEV5P78g775O3WgnOsIV&spc=nfZ8ZrhSJH3LDj1ecQSUUQmQoVJHu3JUZKp8NJg8X8xtZGD5bdHRSCn8WqMZ3sU&vprv=1&svpuc=1&mime=video%2Fmp4&rqh=1&gir=yes&clen=236817689&ratebypass=yes&dur=5238.793&lmt=1795020263137765&mt=1795150443&fvip=4&epbp=1&fexp=51565115&c=ANDROID&txp=5538234&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cxpc%2Cpcm2%2Cbui%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Crqh%2Cgir%2Cclen%2Cratebypass%2Cdur%2Clmt&sig=AE0s2JYwRAIgJUIlFrMPToBg1Jn3eyEG3NmoM7x6qmcLT4pOO_QgfyICIDCnX4HdKuKURHgMkhuA2EgQfrGX3YH_inxuwBUQgmKa&lsparams=met%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Crms&lsig=APaTxxMwRAIgEzX417EXg2YElvHKpui9ZMqdbF0exqapkRT-4Ws-ZkMCIDBzgDlf5PnCikwVvFYyVH1ap8MTNT3cuO3mao_eqssh"
}
]
}
}
}Billing and status codes
…
Combined and separate-track modes use the same administrator-configured price for balance checks and settlement. A result is free when neither video nor audio contains a valid link. Audio-only results are nonempty.
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 |