MarkdownCopies this page as Markdown, ready to paste into an AI assistant.
YouTube API
21 YouTube endpoints behind one key, priced in credits per call and routed to the cheapest healthy source.
On this page
Social · 21 endpoints · from 1 credit per call
Endpoints
- POSTYouTube Channel
/v1/run/youtube.channelYouTube channel profile and stats by handle or channel id: subscribers, video and view counts, description and links.1 creditper call - POSTYouTube Channel Live Streams
/v1/run/youtube.channel_livesLive and past live streams from a YouTube channel’s Live tab: title, views, length and publish label, with cursor pages.2 creditsper call - POSTYouTube Channel Public Email
/v1/run/youtube.channel_public_emailEmail address a creator wrote in a YouTube channel's public description or About links (never the hidden View email address button).1 creditper call - POSTYouTube Channel Search
/v1/run/youtube.search_channelsKeyword search returning YouTube channels (handle, name, description snippet, subscriber count, URL, avatar) with cursor pagination.2 creditsper call - POSTYouTube Channel Shorts
/v1/run/youtube.channel_shortsShorts published by a YouTube channel (title, views, likes, duration, publish time), newest or most popular first, with cursor pagination.2 creditsper call - POSTYouTube Channel Videos
/v1/run/youtube.channel_videosLong-form videos uploaded by a YouTube channel (title, views, length, publish time), newest or most popular first, with cursor pagination.1 creditper call - POSTYouTube Hashtag Search
/v1/run/youtube.search_hashtagVideos tagged with a YouTube hashtag (title, channel, views, length, publish time), with cursor pagination.2 creditsper call - POSTYouTube Search
/v1/run/youtube.searchKeyword search over YouTube videos with relevance or popularity sorting, upload-date filters and cursor pagination.2 creditsper call - POSTYouTube Shorts Search
/v1/run/youtube.search_shortsKeyword search restricted to YouTube Shorts (title, views, channel, URL) with sorting, upload-date filters and cursor pagination.2 creditsper call - POSTYouTube Video
/v1/run/youtube.videoMetadata for one YouTube video or Short by URL or ID: title, description, channel, views, likes, comment count, duration, publish date, tags and category.2 creditsper call - POSTYouTube Video Comments
/v1/run/youtube.video_commentsTop-level comments on a YouTube video or Short (text, author, likes, reply count, publish time), top or newest first, with cursor pagination.2 creditsper call - POSTYouTube Video Transcript
/v1/run/youtube.video_transcriptExisting captions of a YouTube video or Short as plain text plus timed segments, by URL or ID (no speech-to-text; videos without captions are a free miss).2 creditsper call - POSTYouTube Video Transcript (Provenance)
/v1/run/youtube.video_transcript_fullTranscript of a YouTube video or Short with timed segments, whether the captions are creator-written or speech recognition, and the video metadata in one response.3 creditsper call - POSTYouTube Channel Community PostsPlanned
/v1/run/youtube.channel_community_postsPosts from a YouTube channel's Posts (community) tab: text, images, like count and publish time, with cursor pagination.Planned - POSTYouTube Channel Contact EmailPlanned
/v1/run/youtube.channel_contactBusiness inquiry email a creator publishes behind the signed-in, CAPTCHA-gated "View email address" button on the About page.Planned - POSTYouTube Channel PlaylistsPlanned
/v1/run/youtube.channel_playlistsPlaylists on a YouTube channel's Playlists tab (ID, title, video count, thumbnail) with cursor pagination.Planned - POSTYouTube Comment RepliesPlanned
/v1/run/youtube.comment_repliesReplies to one YouTube comment, fetched with the replies token from youtube.video_comments, with cursor pagination.Planned - POSTYouTube Community PostPlanned
/v1/run/youtube.community_postOne YouTube community post by URL: text, images, likes, publish time, channel and any attached video.Planned - POSTYouTube PlaylistPlanned
/v1/run/youtube.playlistVideos in a YouTube playlist (title, length, channel per video) plus the playlist title, owner and total video count.Planned - POSTYouTube Trending ShortsPlanned
/v1/run/youtube.trending_shortsAbout 48 currently trending YouTube Shorts per call (title, channel, views, likes, duration); every call returns a fresh batch.Planned - POSTYouTube Video SponsorsPlanned
/v1/run/youtube.video_sponsorsPaid-promotion flag of a YouTube video plus inferred sponsors (name, website, confidence) from its description, links and transcript.Planned
Calling them
Every endpoint on this page is one POST to https://api.primaryapi.com/v1/run/{sku} with your API key and a JSON body. Responses share one envelope, so code written for one endpoint handles the others. For example, youtube.channel:
curl -sS -X POST "https://api.primaryapi.com/v1/run/youtube.channel" \
-H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"handle":"ThePatMcAfeeShow"}'const res = await fetch('https://api.primaryapi.com/v1/run/youtube.channel', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.PRIMARYAPI_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
handle: 'ThePatMcAfeeShow',
}),
});
const body = await res.json();
if (!res.ok) throw new Error(`${body.code}: ${body.error}`);
// found:false is a successful answer ("does not exist"), not an error
console.log(body.output.found ? body.output.data : body.output.reason, body.credits);import os
import requests
res = requests.post(
"https://api.primaryapi.com/v1/run/youtube.channel",
headers={"Authorization": f"Bearer {os.environ['PRIMARYAPI_API_KEY']}"},
json={
"handle": "ThePatMcAfeeShow",
},
timeout=60,
)
body = res.json()
if not res.ok:
raise RuntimeError(f"{body['code']}: {body['error']}")
# found=False is a successful answer ("does not exist"), not an error
print(body["output"]["data"] if body["output"]["found"] else body["output"]["reason"], body["credits"])New to PrimaryAPI? Start with the Quickstart, then read Making requests.