YouTube API
Video Details
Get full metadata for any YouTube video including title, views, likes, and formats.
POST
$0.02/call/v1/youtube/videoUsage
const res = await fetch('https://api.yepapi.com/v1/youtube/video', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({ id: 'dQw4w9WgXcQ' }),
});
const { data } = await res.json();
console.log(data.title, data.viewCount);curl -X POST https://api.yepapi.com/v1/youtube/video \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"id": "dQw4w9WgXcQ"}'Request Body
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
id | string | Yes | YouTube video ID | — |
geo | string | No | Country code for geo-specific results | — |
Response
{
"ok": true,
"data": {
"status": "OK",
"id": "dQw4w9WgXcQ",
"title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
"lengthSeconds": 213,
"keywords": ["rick astley", "Never Gonna Give You Up", "rickroll"],
"channelTitle": "Rick Astley",
"channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
"description": "The official video for \"Never Gonna Give You Up\" by Rick Astley...",
"viewCount": 1762255485,
"allowRatings": true,
"isLiveContent": false,
"isPrivate": false,
"thumbnail": [
{ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/default.jpg", "width": 120, "height": 90 },
{ "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg", "width": 1920, "height": 1080 }
],
"formats": [
{
"itag": 18,
"mimeType": "video/mp4",
"quality": "medium",
"qualityLabel": "360p",
"width": 640,
"height": 360,
"url": "https://redirector.googlevideo.com/videoplayback?..."
}
],
"adaptiveFormats": [
{
"itag": 313,
"mimeType": "video/webm; codecs=\"vp9\"",
"quality": "hd2160",
"qualityLabel": "2160p",
"width": 3840,
"height": 2160,
"fps": 25,
"bitrate": 18076636,
"contentLength": "358608461",
"url": "https://redirector.googlevideo.com/videoplayback?..."
}
],
"captions": {
"captionTracks": [
{ "languageCode": "en", "kind": "asr" }
]
},
"storyboards": [
{ "url": "https://...", "width": 48, "height": 27 }
]
}
}Response Fields
| Field | Type | Description |
|---|---|---|
ok | boolean | Whether the request succeeded |
data.status | string | Video status (e.g. OK, ERROR) |
data.id | string | YouTube video identifier |
data.title | string | Full video title |
data.lengthSeconds | number | Video duration in seconds |
data.keywords | string[] | Tags and keywords associated with the video |
data.channelTitle | string | Name of the channel that uploaded the video |
data.channelId | string | Unique identifier for the channel |
data.description | string | Full video description text |
data.viewCount | number | Total number of views |
data.allowRatings | boolean | Whether likes/dislikes are enabled |
data.isLiveContent | boolean | Whether this is a livestream |
data.isPrivate | boolean | Whether the video is private |
data.thumbnail | object[] | Thumbnail images at various resolutions |
data.formats | object[] | Muxed (audio+video) streaming formats |
data.formats[].itag | number | YouTube format identifier |
data.formats[].mimeType | string | MIME type and codec info |
data.formats[].quality | string | Quality level (e.g. medium, hd720) |
data.formats[].qualityLabel | string | Human-readable quality (e.g. 360p) |
data.formats[].url | string | Direct streaming URL |
data.adaptiveFormats | object[] | Separate audio/video adaptive streaming formats |
data.adaptiveFormats[].itag | number | YouTube format identifier |
data.adaptiveFormats[].mimeType | string | MIME type and codec info |
data.adaptiveFormats[].quality | string | Quality level (e.g. hd2160) |
data.adaptiveFormats[].qualityLabel | string | Human-readable quality (e.g. 2160p) |
data.adaptiveFormats[].width | number | Video width in pixels |
data.adaptiveFormats[].height | number | Video height in pixels |
data.adaptiveFormats[].fps | number | Frames per second |
data.adaptiveFormats[].bitrate | number | Peak bitrate in bits per second |
data.adaptiveFormats[].contentLength | string | File size in bytes |
data.adaptiveFormats[].url | string | Direct streaming URL |
data.captions | object | Caption/subtitle track information |
data.storyboards | object[] | Storyboard sprite sheet images for seek preview |
This endpoint costs 2¢ per call (6 quota units upstream) because it returns comprehensive video metadata including available formats.