Tutorial: Using the banner.yt API
Learn how to integrate YouTube banners, avatars, and channel data into your website or application.
Quick Start
The simplest way to use banner.yt is to embed a banner image directly using the channel ID:
HTML
<!-- Default banner in WebP -->
<img src="https://banner.yt/api/banner/UCX6OQ3DkcsbYNE6H8uQQuVA" alt="MrBeast Banner" />
<!-- Avatar in WebP -->
<img src="https://banner.yt/api/banner/UCX6OQ3DkcsbYNE6H8uQQuVA?type=avatar" alt="MrBeast Avatar" />
<!-- Mobile banner in JPEG -->
<img src="https://banner.yt/api/banner/UCX6OQ3DkcsbYNE6H8uQQuVA?type=mobile&format=jpeg" />Step 1: Find the Channel ID
Every YouTube channel has a unique ID starting with "UC". You can find it by:
- Going to the channel page on YouTube
- Looking at the URL — it may contain the channel ID (e.g.,
youtube.com/channel/UCX6OQ3DkcsbYNE6H8uQQuVA) - Or use our search feature to find channels by name
- Or use our search API:
/api/search?q=MrBeast
Step 2: Choose Your Format
banner.yt supports multiple output formats. The default is WebP for the best balance of quality and file size.
| Format | Parameter | Best For | File Size |
|---|---|---|---|
| WebP | format=webp | Default, best compression | Smallest |
| AVIF | format=avif | Next-gen compression | Smallest |
| JPEG | format=jpeg | Universal compatibility | Medium |
| PNG | format=png | Lossless quality | Largest |
Step 3: Choose Your Size
Use presets or specify custom dimensions:
URL Examples
# Desktop (default, 2560×1440)
/api/banner/CHANNEL_ID
# TV (2560×1440)
/api/banner/CHANNEL_ID?type=tv
# Tablet (1855×423)
/api/banner/CHANNEL_ID?type=tablet
# Mobile (1280×720)
/api/banner/CHANNEL_ID?type=mobile
# Avatar (500×500)
/api/banner/CHANNEL_ID?type=avatar
# Custom dimensions
/api/banner/CHANNEL_ID?width=800&height=200
# Custom with format and quality
/api/banner/CHANNEL_ID?width=1200&height=300&format=webp&quality=90Code Examples
JavaScript (Fetch)
// Get channel data as JSON
const response = await fetch('/api/channel/UCX6OQ3DkcsbYNE6H8uQQuVA');
const data = await response.json();
console.log(data.name, data.subscribers);
// Download banner as blob
const bannerResponse = await fetch('/api/banner/UCX6OQ3DkcsbYNE6H8uQQuVA?format=webp');
const blob = await bannerResponse.blob();
const url = URL.createObjectURL(blob);Python (requests)
import requests
# Get channel data
data = requests.get('https://banner.yt/api/channel/UCX6OQ3DkcsbYNE6H8uQQuVA').json()
print(f"{data['name']}: {data['subscribers']} subs")
# Download banner
banner = requests.get('https://banner.yt/api/banner/UCX6OQ3DkcsbYNE6H8uQQuVA?format=webp')
with open('banner.webp', 'wb') as f:
f.write(banner.content)cURL
# Download banner
curl -o banner.webp "https://banner.yt/api/banner/UCX6OQ3DkcsbYNE6H8uQQuVA"
# Get channel data
curl "https://banner.yt/api/channel/UCX6OQ3DkcsbYNE6H8uQQuVA" | jq .
# Download avatar in AVIF format
curl -o avatar.avif "https://banner.yt/api/banner/UCX6OQ3DkcsbYNE6H8uQQuVA?type=avatar&format=avif"Rate Limits & Caching
The API has a generous rate limit of 10 requests per 30 seconds per IP. Banners are cached for 24 hours. Responses include cache headers so your browser and CDN will cache the images automatically.
Response Headers
Cache-Control: public, max-age=86400— Cached for 24hX-Cache: HIT/MISS— Whether the response was served from cacheVary: Accept— Content negotiation for format