YouTube Media download links API
API health
- 24h health
- Normal
- Healthy / normal
- Available
Last 24 hours
Last 30 days
Get every format of a YouTube video with its playback URL, from the video link. Each format has itag, quality, codec, bitrate and size; the URLs expire about 6 hours after you fetch them (expires_at), so fetch again after that.
Send POST https://api.everyinfra.com/api/v1/social with platform set to youtube and action set to media_links. Price $0.56 per 1,000 requests ($0.000556 per call). Failed calls and empty results are not charged. Synchronous. For slow jobs add "mode": "async" to the body, take the job_id and poll.
AI prompt
#Please help me write a data collection script with the EveryInfra YouTube Media download links endpoint (youtube/media_links).
How the endpoint works:
- Request: POST https://api.everyinfra.com/api/v1/social with the header Authorization: Bearer <API key>. Read the key from the EVERYINFRA_API_KEY environment variable and never hard-code it.
- In the request body, set platform to youtube and action to media_links, and put the parameters inside params.
- Required parameters:
- url: A YouTube video link (watch?v=, youtu.be, shorts and live links work). The URLs expire about 6 hours after the call.
- Returns one object. Main fields: id, title, author_name, author_id, duration, view_count, is_live (Whether the video is live now), thumbnail_url, available_qualities (Resolutions available for the video (e.g), formats (Formats that keep audio and video in on…), adaptive_formats (Formats that keep audio and video in se…), hls_manifest_url (HLS manifest URL, present for live stre…); 15 fields in total, full list at https://api.everyinfra.com/api/v1/social/catalog?platform=youtube.
- Example request body:
{
"platform": "youtube",
"action": "media_links",
"params": {
"url": "https://www.youtube.com/watch?v=aqz-KE-bpKQ"
}
}
- Price: $0.56 per 1,000 requests; failed and empty results are not charged.
- For dozens or hundreds of targets, add "mode": "async" to the body: you get a job_id at once and poll GET https://api.everyinfra.com/api/v1/jobs/{job_id} for the result.
- On 422, fix the request using the suggested parameter names and allowed values in the error; on 429 or 503, wait for Retry-After and try again.
Before writing code, ask me which targets I need, how many, which fields, and what output format I want; then confirm the plan and the rough cost with me.Request parameters
#| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
Authorization | header | string | Yes | - | Bearer followed by your API key. Create it in the console; never put it in a URL or a code repository. |
platform | body | string | Yes | youtube | Platform identifier, fixed value. |
action | body | string | Yes | media_links | Capability identifier, fixed value. |
url | body.params | string | Yes | - | A YouTube video link (watch?v=, youtu.be, shorts and live links work). The URLs expire about 6 hours after the call. |
Code samples
#curl -X POST 'https://api.everyinfra.com/api/v1/social' \
-H "Authorization: Bearer $EVERYINFRA_API_KEY" \
-H 'Content-Type: application/json' \
--data-raw '{
"platform": "youtube",
"action": "media_links",
"params": {
"url": "https://www.youtube.com/watch?v=aqz-KE-bpKQ"
}
}'OpenAPI definition (JSON)Samples read the key from the EVERYINFRA_API_KEY environment variable; copied code never contains your key.
Response example
#{ "id": "req_…", "platform": "youtube", "action": "media_links", "results": { "id": "aqz-KE-bpKQ", "title": "Big Buck Bunny 60fps 4K - Official Blender Foundation Short Film", "author_name": "B•••r", "author_id": "•••", "duration": "00:10:35", "view_count": 23573023, "is_live": false, "thumbnail_url": "https://i.ytimg.com/vi/aqz-KE-bpKQ/sddefault.jpg", "available_qualities": [ "2160p60", "1440p60", "1080p60" ], "adaptive_formats": [ { "itag": 315, "url": "https://rr2---sn-o097znsl.googlevideo.com/videoplayback?expire=1795267484&ei=PEcBa4biA82Xt7EPpLyZmAc&ip=23.132.180.66&id=o-ADhlDg2wJ_uvkAHxlqRbrJ7fISvLf89SyWlWX__cM369&itag=315&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&cps=853&met=1795245884%2C&mh=aP&mm=18%2C26&mn=sn-o09…", "type": "video", "mime_type": "video/webm; codecs=\"vp09.00.51.08\"", "container": "webm", "codecs": "vp09.00.51.08", "has_video": true, "has_audio": false, "quality": "hd2160", "quality_label": "2160p60", "width": 3840, "height": 2160, "fps": 60, "bitrate": 26523399, "average_bitrate": 17174188, "content_length": 1362269481, "duration_ms": 634566 }, { "itag": 401, "url": "https://rr2---sn-o097znsl.googlevideo.com/videoplayback?expire=1795267484&ei=PEcBa4biA82Xt7EPpLyZmAc&ip=23.132.180.66&id=o-ADhlDg2wJ_uvkAHxlqRbrJ7fISvLf89SyWlWX__cM369&itag=401&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&cps=853&met=1795245884%2C&mh=aP&mm=18%2C26&mn=sn-o09…", "type": "video", "mime_type": "video/mp4; codecs=\"av01.0.13M.08\"", "container": "mp4", "codecs": "av01.0.13M.08", "has_video": true, "has_audio": false, "quality": "hd2160", "quality_label": "2160p60", "width": 3840, "height": 2160, "fps": 60, "bitrate": 17443607, "average_bitrate": 8981827, "content_length": 712445280, "duration_ms": 634566 }, { "itag": 308, "url": "https://rr2---sn-o097znsl.googlevideo.com/videoplayback?expire=1795267484&ei=PEcBa4biA82Xt7EPpLyZmAc&ip=23.132.180.66&id=o-ADhlDg2wJ_uvkAHxlqRbrJ7fISvLf89SyWlWX__cM369&itag=308&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&cps=853&met=1795245884%2C&mh=aP&mm=18%2C26&mn=sn-o09…", "type": "video", "mime_type": "video/webm; codecs=\"vp09.00.50.08\"", "container": "webm", "codecs": "vp09.00.50.08", "has_video": true, "has_audio": false, "quality": "hd1440", "quality_label": "1440p60", "width": 2560, "height": 1440, "fps": 60, "bitrate": 13250294, "average_bitrate": 5967715, "content_length": 473363704, "duration_ms": 634566 } ], "expires_at": "2026-11-21T13:24:44+00:00", "expires_in_seconds": 21540, "platform": "youtube" }, "billing": { "charged": …, "charged_usd": …, "balance_after_usd": …, … }, "quota": { … }}
Response fields
#Business data is in results. The table lists the fields a record can contain. Values the platform does not show are never made up.
| Field | Meaning |
|---|---|
id | The record's unique ID on the platform. Unique only within one platform; IDs can repeat across platforms. |
title | Title. null when the platform has no titles (for example text-only posts). |
author_name | Author's display name. |
author_id | Author's unique ID on the platform. |
duration | Keeps the platform's own meaning |
view_count | Views or plays. null means not disclosed, not 0. |
is_live | Whether the video is live now. |
thumbnail_url | Thumbnail link, lower resolution than image_url. |
available_qualities | Resolutions available for the video (e.g. 1080p, 720p). |
formats | Formats that keep audio and video in one file, as an array. Each item has itag, mime_type, quality_label, bitrate, width, height, fps, content_length, audio_quality and more; in media_links each item also has a playback url, in video_formats it does not. |
adaptive_formats | Formats that keep audio and video in separate files, as an array; each item has the same keys as formats. has_audio is false for video-only items and has_video is false for audio-only items. |
hls_manifest_url | HLS manifest URL, present for live streams; otherwise null. |
dash_manifest_url | DASH manifest URL; null when there is none. |
expires_at | When the playback URLs expire (ISO 8601, UTC), about 6 hours after they are issued. |
expires_in_seconds | Seconds left until the playback URLs expire. |
platform | Source platform identifier, the same as platform in the request (for example xiaohongshu, tiktok). |
Errors and billing
#- 401
- Missing or invalid key.
- 402
- Insufficient balance. Top up first.
- 422
- Invalid parameter name or value. Fix it using the suggestions in the error. No charge.
- 429
- Per-minute request limit reached. Wait for Retry-After, then try again.
- 503
- Could not complete. The held charge is returned to your balance. If the outcome is unknown, verify it before you retry.
- 200 empty
- No data. No charge.