YouTube API guide

YouTube API explained, and when you don't need it

Does YouTube have an API? Yes: the YouTube API is three APIs. The Data API reads videos and uploads them, the Analytics API reports on a channel, and the Reporting API exports bulk data. If you just want your business posting Shorts, Postdom is the simpler answer: it turns your website into ready-to-post videos in your brand and posts the ones you approve.

Does YouTube have an API?

A dashboard, an uploader and a data export each need a different starting point. Pick the smallest API that does the job.

Your taskUse this APIFirst decision
Read a video's title, public statistics or channel detailsYouTube Data APIUse a public-data request with an API key. If you already know the video ID, use videos.list instead of searching for it again.
Upload or manage a channel's videosYouTube Data APIUse owner-authorized OAuth and the required scope. An API key cannot grant permission to upload to someone's channel.
Answer a channel-performance questionYouTube Analytics APIRequest an authorized report for the owner, with the needed date range, metrics and dimensions. Public view counts are not a substitute for owner analytics.
Import bulk performance data into your own systemYouTube Reporting APICreate an authorized reporting job, then download the generated reports. Your application handles the bulk files and any further aggregation.

YouTube Data API

Public reads, such as a known video's title, can use an API key. Uploads and private channel data need the channel owner's authorization through OAuth. A key identifies your project; it never signs in as the owner.

A good first request reads the title of a public video you already know, with videos.list and part=snippet.

JavaScript example: read a known public video

Run this in your server-side application with its own key and the video ID from your chosen YouTube URL. Call readPublicVideo(videoId, apiKey). The function returns the matching video object or null, and throws on an API error. It makes no publishing request. The example was checked with mock responses, not your credentials or a live API call.

async function readPublicVideo(videoId, apiKey, fetcher = fetch) {
  if (typeof videoId !== "string" || !videoId.trim()
      || typeof apiKey !== "string" || !apiKey.trim()) {
    throw new Error("A video ID and API key are required");
  }
  const url = new URL("https://www.googleapis.com/youtube/v3/videos");
  url.searchParams.set("part", "snippet");
  url.searchParams.set("id", videoId);
  url.searchParams.set("fields", "items(id,snippet(title))");
  url.searchParams.set("key", apiKey);

  const response = await fetcher(url);
  const data = await response.json();
  if (!response.ok) {
    throw new Error(data?.error?.message ?? "YouTube request failed");
  }
  if (!Array.isArray(data?.items)) {
    throw new Error("Unexpected YouTube response");
  }
  return data.items.find(item => item?.id === videoId) ?? null;
}

A result exposes snippet.title; null means the request did not return that ID. Do not turn that into a made-up title or zero-valued analytics. See videos.list parameters.

Upload YouTube Shorts with the API

You can upload with videos.insert, but an upload, finished processing and public visibility are three different results. Check each before you announce anything.

Some unverified API projects can only upload privately until they pass YouTube's compliance audit. And whether an upload counts as a Short depends on YouTube's shape, length and channel rules.

Is the YouTube API free?

Google measures Data API use in quota units, not dollars. Each project gets an allocation, and more needs a request through Google's quota and compliance process. Check the current method costs before you scale. A Postdom plan is Postdom's price, not a Google quota.

Questions about the YouTube API

Do I need an API key or OAuth?

An API key for supported public reads. OAuth with the owner's permission for uploads, private data and owner analytics.

Can I upload YouTube Shorts through an API?

You can upload videos with the Data API. Whether YouTube treats one as a Short depends on its shape, length, upload date and channel rules.

Why did my API upload stay private?

Check the privacy setting your app sent and whether your project is restricted to private uploads until a compliance audit. A finished upload is not proof of a public video.

Can I get analytics for any channel?

No. Owner analytics need the channel owner's authorization. Public statistics are a different, smaller set.

Does Postdom have an API too?

Yes. Postdom's REST API and MCP server are included on every plan, for developers who post through their own AI agent. Postdom publishes finished videos; it does not expose YouTube's full Data, Analytics and Reporting APIs.

Free YouTube API alternative: post with Postdom

Postdom's Free plan has no card and makes 1 post a month on 2 accounts, on any platform, so a YouTube channel can be one of them. You skip OAuth, quota and upload checks: approve the video and Postdom posts it.

Post Shorts without building an integration

Postdom reads your brand from your website and fills your For You feed with ready-to-post videos. You approve, edit or skip each one, and Postdom posts what you approve to YouTube, TikTok, Instagram, Facebook and LinkedIn.

Nothing posts until you approve it. Start on Free with no card: 1 post a month on 2 accounts, on any platform, YouTube included.

Start free with Postdom

Paste your website and see your first video today.