YouTube API

Get YouTube data as clean JSON with one key: 44 endpoints, 1 to 72 credits per call, the same response shape as every other platform.

What you get#

Onekey exposes YouTube as 44 endpoints behind one API key: 14 endpoints return one record (data is an object) and 30 endpoints return a list (data is an array). Every answer uses the same envelope (success, data, metadata, error), the cost is reported in metadata.credits_charged, and fields are mapped onto the unified schema so the code you write for YouTube also works for the rest of the video & streaming category.

Endpoints#

EndpointWhat it doesParametersCreditsStatus
channelYouTube channel details and statistics by channel id.id*2beta may need a pack
channel_aboutA YouTube channel's public business contact: email (when the channel lists one) and country.handle, channel_id, url72beta needs a pack
channel_by_handleYouTube channel details by @handle.handle*2beta may need a pack
channel_playlistsPlaylists published by a YouTube channel (Playlists tab).channel_id*2stable may need a pack
channel_postsCommunity posts from a YouTube channel (Posts tab).channel_id*2stable may need a pack
channel_profileYouTube channel profile: title, handle, subscriber and video counts, description, avatar.channel_id*1stable may need a pack
channel_searchSearch YouTube channels by keyword.q*2stable may need a pack
channel_shortsShorts from a YouTube channel (Shorts tab).channel_id*2stable may need a pack
channel_streamsLive streams and past broadcasts from a YouTube channel (Live tab).channel_id*2stable may need a pack
channel_videosLatest uploads from a YouTube channel (Videos tab).channel_id*2stable may need a pack
channels_batchDetails and statistics for up to 10 YouTube channels in one call.ids*1beta
comment_repliesReplies to a YouTube comment (cursor from the parent comment's replies continuation).cursor*2beta may need a pack
commentsTop-level comments of a YouTube video (first 20).id*2beta may need a pack
community_postA YouTube community post: text, images, likes and channel.url*2beta needs a pack
playlistYouTube playlist details.id*1beta
playlist_infoYouTube playlist metadata: title, owner, video count, views, thumbnail.playlist_id*1stable may need a pack
playlist_itemsVideos in a YouTube playlist (first 25).id*2beta may need a pack
playlist_videosVideos inside a YouTube playlist (first page).playlist_id*2stable may need a pack
relatedRelated / up-next videos for a YouTube video.id*2stable may need a pack
resolveResolve a YouTube @handle or channel URL to its channel id.handle*1stable may need a pack
searchSearch YouTube videos (Data API v3; costs 100 quota units per call).q*3beta may need a pack
search_channelsSearch YouTube channels.q*3beta may need a pack
search_hashtagYouTube videos tagged with a hashtag.hashtag*, cursor2beta needs a pack
search_latestSearch YouTube videos by keyword, newest uploads first.q*2stable may need a pack
search_liveSearch currently live YouTube streams by keyword.q*2stable may need a pack
search_playlistsSearch YouTube playlists by keyword.q*2stable may need a pack
search_videosSearch YouTube videos by keyword.q*2stable may need a pack
shorts_trendingCurrently trending YouTube Shorts.-2beta needs a pack
suggestYouTube search autocomplete suggestions for a partial query.q*1stable
transcriptTimed transcript segments of a YouTube video (cursor from youtube.video_next).cursor*2beta may need a pack
trendingMost popular YouTube videos in a region.region2beta may need a pack
videoYouTube video title and channel via oEmbed (no stats: those need an API key).id*1stable
video_audioDownloadable audio stream formats of a YouTube video (signed urls).id*2beta needs a pack
video_categoriesYouTube video categories for a region.region2beta
video_commentsTop-level comments on a YouTube video (page of a continuation cursor).cursor*2beta may need a pack
video_detailsYouTube video details and statistics (Data API v3).id*2beta may need a pack
video_filesDownloadable video stream formats of a YouTube video (signed urls).id*2beta needs a pack
video_infoYouTube video details: title, description, channel, views, likes, duration, publish date.id*1stable may need a pack
video_nextYouTube watch page data and the continuation cursors needed for comments and transcript.id*1stable may need a pack
video_sponsorsSponsors a YouTube video appears to promote (paid-promotion badge, description links).url*2beta needs a pack
video_subtitlesSubtitle files (language, format, download url) of a YouTube video.id*2beta needs a pack
video_thumbnailsThumbnail image of a YouTube video (oEmbed): URL and pixel size, plus title and channel.id*1stable
video_transcriptTimed transcript (captions) of a YouTube video by video id.id*, lang2beta needs a pack
videos_batchDetails and statistics for up to 20 YouTube videos in one call.ids*1beta

A * marks a required parameter. Each endpoint name links to its reference page with the full parameter table, caching window and a recorded response.

Make a request#

This calls youtube.channel_profile (1 credit, stable). Replace YOUR_API_KEY with your key; sign up, no card. 1,000 free credits cover the open-platform endpoints. Hard-to-reach platforms (X, TikTok, Instagram, Reddit, and others marked on their page) need a verified email and a purchased pack.

curl "https://api.onekey.dev/v1/youtube/channel_profile?channel_id=UC_x5XG1OV2P6uZZ5FSM9Ttw" \
  -H "x-api-key: YOUR_API_KEY"

Fields you get back#

These unified fields come back from YouTube, with the same names as on every other platform. The count is how many of its 44 mapped endpoints return the field; a field the source lacks is null, never missing. 35 platform-specific fields (ext.<name>) come on top, documented on each endpoint page.

FieldTypeEndpoints
author.displayNamestring32
content.idstring24
author.idstring23
content.titlestring23
content.textstring20
media.thumbnailUrlURL20
content.createdAtISO 8601 date10
engagement.viewsinteger9
author.avatarUrlURL8
author.usernamestring8
engagement.commentsinteger7
engagement.likesinteger7
author.urlURL6
content.urlURL5
author.biostring4
media.durationSecondsnumber4
media.urlURL4
author.followersinteger3
entity.namestring3
media.mimeTypestring3
author.verifiedboolean2
entity.idstring2
media.heightinteger2
media.sizeBytesinteger2
media.widthinteger2
author.contentCountinteger1
author.countrystring1
author.createdAtISO 8601 date1
content.categorystring1
entity.descriptionstring1
entity.stats.itemCountinteger1
media.previewUrlURL1

The full schema is in Unified schema.

Pricing#

YouTube calls cost 1 to 72 credits, flat per endpoint. Free when served from cache (0.2 credit for a cached response over 100 KB). Invalid, failed or not-found calls are not charged. See pricing for credit packs.