POST

API health

24h health
Normal
  • Healthy / normal
  • Available
Normal

Last 24 hours

Last 30 days

Get the playback URL of one format of a YouTube video, from the video link and the format's itag (taken from video_formats or media_links). Returns the URL, MIME type, quality and size, and when the URL expires. A video without that format returns an empty result.

Send POST https://api.everyinfra.com/api/v1/social with platform set to youtube and action set to stream_url. 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 Format stream URL endpoint (youtube/stream_url).

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 stream_url, and put the parameters inside params.
- Required parameters:
  - url: A YouTube video link (watch?v=, youtu.be, shorts and live links work).
  - itag: Which format: YouTube's format number, an integer from 1 to 9999, taken from the itag of video_formats or media_links (140 is m4a audio). A video without that format returns an empty result.
- Returns one object. Main fields: id, itag (YouTube format ID), url, mime_type (File type and codec, e.g), quality_label (Resolution label, e.g), content_length (File size in bytes), expires_at (When the playback URLs expire (ISO 8601…), expires_in_seconds (Seconds left until the playback URLs ex…).
- Example request body:
{
  "platform": "youtube",
  "action": "stream_url",
  "params": {
    "url": "https://www.youtube.com/watch?v=aqz-KE-bpKQ",
    "itag": 140
  }
}
- 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

#
NameInTypeRequiredDefaultDescription
AuthorizationheaderstringYes-Bearer followed by your API key. Create it in the console; never put it in a URL or a code repository.
platformbodystringYesyoutubePlatform identifier, fixed value.
actionbodystringYesstream_urlCapability identifier, fixed value.
urlbody.paramsstringYes-A YouTube video link (watch?v=, youtu.be, shorts and live links work).
itagbody.paramsintegerYes-Which format: YouTube's format number, an integer from 1 to 9999, taken from the itag of video_formats or media_links (140 is m4a audio). A video without that format returns an empty result. A value that is not recognized returns 422 and is not charged.

Code samples

#
bash
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": "stream_url",
  "params": {
    "url": "https://www.youtube.com/watch?v=aqz-KE-bpKQ",
    "itag": 140
  }
}'

OpenAPI definition (JSON)Samples read the key from the EVERYINFRA_API_KEY environment variable; copied code never contains your key.

Response example

#
Captured November 21, 2026 at 07:24 (UTC) by calling this API with the parameters in the code sample above. results and count are that call's real response with personal information (names, handles, avatars, profile links, contact details) removed. id, billing and quota differ on every call, so only their shape is shown.
json
{  "id": "req_…",  "platform": "youtube",  "action": "stream_url",  "results": {    "id": "aqz-KE-bpKQ",    "itag": 140,    "url": "https://rr3---sn-a5mlrnll.googlevideo.com/videoplayback?expire=1795267486&ei=PkcBa5HjJICYsfIPpPrFgAQ&ip=189.105.112.160&id=o-AKzweXFGKFKKShSKTD0ht1qQzT4IlKQB_0u_qwlpFEe3&itag=140&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&cps=847&met=1795245886%2C&mh=aP&mm=18%2C29&mn=sn-a…",    "mime_type": "audio/mp4; codecs=\"mp4a.40.2\"",    "content_length": 10271496,    "expires_at": "2026-11-21T13:24:46+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.

FieldMeaning
idThe record's unique ID on the platform. Unique only within one platform; IDs can repeat across platforms.
itagYouTube format ID.
urlLink to the record on the platform.
mime_typeFile type and codec, e.g. audio/mp4; codecs="mp4a.40.2".
quality_labelResolution label, e.g. 720p; null for audio-only formats.
content_lengthFile size in bytes.
expires_atWhen the playback URLs expire (ISO 8601, UTC), about 6 hours after they are issued.
expires_in_secondsSeconds left until the playback URLs expire.
platformSource 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.

Errors

Google Analytics needs consent. Privacy