Google

YouTube Data API v3

Search YouTube, read videos and channels, manage playlists, comments and subscriptions, and upload videos with the Data API v3.

Media & contentGuided#youtube#video#oauth2#api-key#playlists#uploads#google

Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.

Overview

The YouTube Data API v3 gives programmatic access to YouTube: search, video and channel details, playlists, comments, subscriptions, ratings, uploads, thumbnails and captions. Use it to show videos and statistics in your site or app, build channel dashboards, manage playlists, moderate comments, or upload videos on behalf of a signed-in creator. (Analytics and reporting are separate APIs.)

Two ways to authenticate

  • API key (?key=): enough for public data such as search, public videos, channels, playlists and comment threads. Create one under APIs & Services > Credentials and restrict it to the YouTube Data API v3.
  • OAuth 2.0 (Authorization: Bearer): needed for anything about the signed-in user (their channel with mine=true, private playlists, subscribing, rating, commenting, uploading).

Set up

  1. In the Google Cloud console create a project and enable YouTube Data API v3.
  2. Create an API key (for folder 2) and restrict it.
  3. Configure the OAuth consent screen (External, Testing, add yourself as a test user) and add the YouTube scopes.
  4. Create an OAuth client (Web application) with your redirect URI; put its ID and secret in this collection.
  5. Run 1. Get an access token, or use the OAuth 2.0 Playground.

Scopes

ScopeUse
youtube.readonlyread the user's account
youtubemanage the account
youtube.force-sslmanage, including comments and captions
youtube.uploadupload videos and thumbnails

All start with https://www.googleapis.com/auth/. See Authorization.

Quota

The API is free but quota-limited. Each project gets a default of 10,000 units per day shared by most methods, resetting at midnight Pacific Time. Reads (list) cost 1 unit; writes (insert, update, delete, rate) cost 50; captions.list costs 50. Since June 2026 search.list and videos.insert have their own buckets: 1 unit per call with a default of 100 calls per day each (search used to cost 100 units of the shared pool). Check the current numbers in the quota calculator and request more through the quota extension form in the quota and compliance docs.

How to use this collection

Fill in apiKey and run folder 2 (search saves videoId, the handle lookup saves channelId). For the OAuth folders, fill in clientId and clientSecret, run folder 1, then folders 3 to 6. For uploads, set videoFileSize to the file's exact byte size, run Start a resumable upload, then choose the file in Upload the video bytes.

Common errors

Status / reasonMeaningFix
400 invalidSearchFilter, invalidCategoryIdbad parameter combination or valueread error.errors[0].reason
401 authError / youtubeSignupRequiredtoken missing or expired; or the account has no channelrefresh the token; create a channel
403 quotaExceededdaily quota (or the search/upload bucket) used upwait for the reset or request more
403 insufficientPermissionstoken lacks the scopesign in again with the right scope
403 commentsDisabled, forbiddenaction not allowed on that resourcecheck ownership and settings
404 videoNotFound, playlistNotFoundwrong ID, or privatecheck the ID

Links

Endpoints 26

1. Get an access token

  • GETBuild the sign-in URL (open in a browser)https://accounts.google.com/o/oauth2/v2/authNot an API call: this request only builds Google's consent screen URL so you can copy it. Open it in a browser (sending it from here just returns the HTML…
  • POSTExchange the code for tokenshttps://oauth2.googleapis.com/tokenTrades the one-time code from the redirect for an access token and a refresh token. When: once, right after the browser sign-in. A code works once and expires…
  • POSTRefresh the access tokenhttps://oauth2.googleapis.com/tokenGets a new access token from the saved refresh token, without asking the user again. When: whenever a request returns 401 (access tokens last about an hour).…

2. Public data (API key)

  • GETSearch videos/searchSearches YouTube for videos, channels or playlists matching a query. Quota: search.list is charged to its own quota bucket (since June 2026), at 1 unit per…
  • GETGet videos by ID/videosReads full details for up to 50 videos (comma-separated id). Parts used here: snippet (title, description, tags, categoryId, channel), contentDetails…
  • GETMost popular videos (chart)/videosLists a region's most popular videos: chart=mostPopular, optionally narrowed with videoCategoryId (see videoCategories.list). Since July 2025 this chart is…
  • GETGet a channel by handle/channelsLooks up a channel by its handle (@name), the modern replacement for usernames. Use id for channel IDs (comma list, up to 50) instead. Parts: snippet (title,…
  • GETList a channel's public playlists/playlistsLists the public playlists of a channel (channelId). Query: part=snippet,contentDetails (contentDetails.itemCount), maxResults (up to 50), pageToken. Quota: 1…
  • GETList comment threads on a video/commentThreadsReads top-level comments on a public video, each with up to a few replies. Quota: 1 unit. What comes back: items[] with snippet.topLevelComment (textDisplay,…

3. Your channel (OAuth)

  • GETGet my channel/channelsReturns the signed-in user's channel (mine=true). Scope: youtube.readonly (or broader). Quota: 1 unit. What comes back: the channel with id (saved to…
  • GETList my uploads/playlistItemsLists every video on the signed-in user's channel by reading the channel's uploads playlist (uploadsPlaylistId), newest first. This is the cheap way to…
  • GETList my subscriptions/subscriptionsLists the channels the signed-in user is subscribed to. Query: mine=true, order (relevance, unread or alphabetical), maxResults (up to 50). Scope:…
  • POSTSubscribe to a channel/subscriptionsSubscribes the signed-in user to channelId. Scope: youtube or youtube.force-ssl. Quota: 50 units. Body: snippet.resourceId with kind: youtube#channel and…
  • POSTRate a video (like)/videos/rateLikes, dislikes or clears the signed-in user's rating on a video. Query: id (video) and rating: like, dislike or none (removes the rating). No body. Scope:…

4. Playlists

  • POSTCreate a playlist/playlistsCreates a playlist on the signed-in user's channel. Body: snippet.title (required), snippet.description, snippet.defaultLanguage, and status.privacyStatus…
  • GETList my playlists/playlistsLists the signed-in user's playlists, including private ones (mine=true). Quota: 1 unit. What comes back: items[] with snippet, status.privacyStatus and…
  • POSTAdd a video to a playlist/playlistItemsAdds videoId to playlistId. Body: snippet.playlistId and snippet.resourceId (kind: youtube#video, videoId). Optional snippet.position (zero-based) places it;…
  • GETList playlist items/playlistItemsLists the videos in playlistId, in playlist order. Query: part=snippet,contentDetails, maxResults (up to 50), pageToken; videoId filters to one video. Quota:…
  • DELETERemove a video from a playlist/playlistItemsDeletes one playlist item (playlistItemId, from Add a video to a playlist or List playlist items). The video itself is not affected. Quota: 50 units. What…

5. Comments

  • POSTPost a top-level comment/commentThreadsPosts a new comment on a video as the signed-in user. Body: snippet.videoId and snippet.topLevelComment.snippet.textOriginal (plain text). Quota: 50 units.…
  • POSTReply to a comment/commentsReplies to a top-level comment (commentId). Body: snippet.parentId (the top-level comment's ID) and snippet.textOriginal. Replies to replies are not…

6. Upload and edit videos

  • POSTStart a resumable upload{{uploadUrl}}/videosOpens an upload session for a new video on the signed-in user's channel and sends its metadata. No video bytes yet. URL:…
  • PUTUpload the video bytes{{uploadSessionUri}}Sends the video file to the session URL from Start a resumable upload. Body: choose the video file in the Body tab (binary). Content-Type must match…
  • PUTUpdate a video's title and description/videosChanges the metadata of a video on the signed-in user's channel (myVideoId). Important: videos.update replaces every mutable property in the parts you send.…
  • POSTSet a custom thumbnail{{uploadUrl}}/thumbnails/setUploads a custom thumbnail for myVideoId. Body: choose a JPEG or PNG image in the Body tab (binary), up to 50 MB; set Content-Type to match (image/png or…
  • GETList caption tracks/captionsLists the caption tracks of a video you own (myVideoId): language, name, kind (standard, ASR for automatic, forced) and status. Downloading the text uses…

API details

Base URL
https://www.googleapis.com/youtube/v3
https://www.googleapis.com/upload/youtube/v3
Authentication
An API key in the key query parameter
A bearer token in the Authorization header
OAuth 2.0 (authorization code flow) with 4 scopes
Operations
26 operations on 26 pathsGET 13POST 10PUT 2DELETE 1
Main resources
1. Get an access token 32. Public data (API key) 63. Your channel (OAuth) 54. Playlists 55. Comments 26. Upload and edit videos 5
Description format
Swastik Codes guided collection, API version checked against the docs on 2026-11-17

How to test the YouTube Data API v3 in Swastik Codes

  1. Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
  2. Fork it into your workspaceChoose a workspace. You get your own copy of the YouTube Data API v3 collection, without the publisher's secrets.
  3. Add your credentialsThis API uses an API key in the key query parameter. Add yours in the collection's variables or an environment; the requests already reference it.
  4. Send a requestPick an endpoint, for example “Build the sign-in URL (open in a browser)” (GET https://accounts.google.com/o/oauth2/v2/auth), and press Send. Check the response, add tests and run the whole collection with the runner.

Frequently asked questions

What is the YouTube Data API v3?

Search YouTube, read videos and channels, manage playlists, comments and subscriptions, and upload videos with the Data API v3. It is listed under Media & content and has 26 endpoints.

Who publishes the YouTube Data API v3?

It is listed from Google's public API description (an OpenAPI document), not published by Google on Swastik Codes. Anyone who controls googleapis.com can claim the profile by adding a DNS TXT record.

What is the base URL of the YouTube Data API v3?

Its description lists 2 base URLs: https://www.googleapis.com/youtube/v3, https://www.googleapis.com/upload/youtube/v3. The first is the usual one; the others are typically sandbox or regional servers.

How do I authenticate with the YouTube Data API v3?

It accepts 3 methods: an API key in the key query parameter; A bearer token in the Authorization header; OAuth 2.0 (authorization code flow) with 4 scopes.

How many endpoints does the YouTube Data API v3 have?

26 operations on 26 paths (13 GET, 10 POST, 2 PUT, 1 DELETE). The largest groups are 1. Get an access token, 2. Public data (API key), 3. Your channel (OAuth), 4. Playlists.

Is forking the YouTube Data API v3 free?

Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.

Suggest an API

Tell us which public API is missing. We check it, then add it here with its endpoints when it has an OpenAPI (Swagger) description.