Youtify logo Youtify

YouTube API

01

Blazing-fast YouTube API to search, stream, and analyze—built for scale, crafted for simplicity

Explore Docs Get Console

Features

Everything you need to search, stream, and manage YouTube content at scale

Ultra-fast search & play

Average response ~0.5s with optimized pipelines for quick metadata and stream retrieval.

Seamless streaming

Stable direct stream URLs; built-in compatibility for Telegram bot frameworks.

Live stream support

Access live content just like regular videos with consistent API responses.

Anti-bot protection

IP rotation, user-agent cycling, request jittering & custom headers help avoid detection.

API key management

Create, revoke & monitor API keys via a simple admin panel with usage stats & logs.

Telegram-ready

Optimized for Pyrogram & Telethon to power reliable media bots with minimal setup.

Docs

Authentication, endpoints, modes, errors, and examples

Authentication

  • Send API key via header: x-api-key: YOUR_KEY or query: ?api_key=YOUR_KEY.
  • Default UI key may exist; production clients must send their own.
  • Invalid/exceeded keys return 401/429.

GET /search

Resolve URL/ID/search term to canonical video + ready stream links.

GET /search?q=n_FCrCQ6-bA

GET /download/audio

Audio by ID. Modes: redirect | proxy | download.

GET /download/audio?video_id=n_FCrCQ6-bA&mode=proxy

GET /download/video

Video stream by ID (same modes).

GET /download/video?video_id=n_FCrCQ6-bA&mode=redirect

Modes & headers

  • redirect: 302 upstream.
  • proxy: passthrough (Range).
  • download: server fetch + attachment.
  • Stream URL cache TTL ~5m.

Errors

  • 401 invalid key
  • 429 limit
  • 404 not found
  • 410 cache miss
  • 423 processing
  • 500 internal

Admin APIs

  • GET /admin/metrics
  • GET /admin/list_api_keys
  • GET /admin/recent_logs
  • POST /admin/create_api_key
  • POST /admin/revoke_api_key

curl example

curl -H "x-api-key: YOUR_KEY" "https://your-api-host/search?q=rickroll"

Python (httpx)

import httpx\nBASE = "https://your-api-host"\nAPI_KEY = "YOUR_KEY"\n\nwith httpx.Client(timeout=20.0, headers={"x-api-key": API_KEY}) as client:\n    r = client.get(f"{BASE}/search", params={"q": "n_FCrCQ6-bA"})\n    r.raise_for_status()\n    data = r.json()\n    # Basic fields\n    print(data["video_id"], data["title"], data["duration"])

JavaScript fetch

const BASE = 'https://your-api-host';\nconst API_KEY = 'YOUR_KEY';\nasync function lookup(q){\n  const res = await fetch(`${BASE}/search?q=${encodeURIComponent(q)}`, {\n    headers: { 'x-api-key': API_KEY }\n  });\n  if(!res.ok) throw new Error('Request failed');\n  return await res.json();\n}\nlookup('n_FCrCQ6-bA').then(v=>console.log(v.video_id, v.title));

/search response

Typical abbreviated JSON response:

{\n  "video_id": "n_FCrCQ6-bA",\n  "title": "Song Title",\n  "duration": 213,\n  "is_live": false,\n  "thumb": "https://i.ytimg.com/...",\n  "streams": {\n    "audio": [{"itag": 251, "mime": "audio/webm", "abr": 160}],\n    "video": [{"itag": 22, "mime": "video/mp4", "quality": "720p"}]\n  }\n}

Rate limiting

  • Burst & sliding window strategy.
  • HTTP 429 when quota exceeded.
  • Headers: X-Rate-Remaining, X-Rate-Reset.
  • Rotate keys for higher throughput.

Caching

  • Stream URL cache (~5m) lowers extractor load.
  • Cold search path: yt -> parse -> hydrate.
  • Warm path: in-memory hit ~2-5ms.
  • Headers expose: X-Cache: HIT|MISS.
  • Invalidate by video age / TTL expiry.