
To get a YouTube API key, create a Google Cloud project, enable YouTube Data API v3, and select Create credentials > API key on the Credentials page. Restrict the key before using it in production. That key can retrieve public data, but uploading videos or accessing private account data requires OAuth 2.0 authorization from the channel owner.
TL;DR
- Use an API key for public video metadata, public channel information, and search results.
- Use an OAuth client and user consent for uploads, edits, deletes, and private data.
- Apply both API restrictions and appropriate application restrictions to your key.
- Google's current default allocation separates search and uploads from the general 10,000-unit daily pool.
- If you need uploading rather than public-data lookup, start with OAuth or a managed integration, not a public-data API key.
The distinction is documented in Google's YouTube application registration guide. An API key identifies your project. It does not identify a channel owner or prove that they authorized your application.
How to get a YouTube API key
You need a Google account and permission to create a project and manage its credentials. Keep the same project selected throughout these steps. Enabling the API in one project and generating a key in another is a common setup mistake.
The labels below follow Google's current project, credential, and restriction documentation. Organization policies can change which options are available to your account.
1. Create or select a Google Cloud project
Open Google Cloud Console. You can select an existing project from the project selector, or create a dedicated project for this integration.
For the documented creation route:
- Open Manage resources in Google Cloud Console.
- Click Create project.
- In the New project window, enter a descriptive project name.
- Choose the parent organization or folder where applicable. Select No organization if that option fits your account.
- Click Create, then select the new project.
Google's project creation instructions describe the required permissions and organization-specific fields. Record the project ID so your team can identify the right project when investigating quota or credentials later.
2. Enable YouTube Data API v3
- With the intended project selected, open APIs & Services > Library.
- Search for YouTube Data API v3.
- Open that API's result and click Enable.
- Confirm that it appears in the project's enabled APIs.
The API key does not enable the service automatically. Google's getting-started guide explicitly separates project registration from enabling YouTube Data API access.
3. Create the API key
- Open APIs & Services > Credentials.
- Select Create credentials > API key.
- Add restrictions if the creation form offers them, then click Create.
- Copy the key string from the API key created dialog into your secret storage.
Google's general credential interface can also offer service-account-bound keys for other products. That is not a replacement for YouTube channel authorization. For this public-data walkthrough, you want a standard API key.
Do not confuse the key string with its display name or administrative ID. The string is the credential sent with requests. Google's API key management guide documents these separate values and the current creation form.
4. Restrict the key
If the creation dialog shows Restrict key, use it. Otherwise, click the key's name on the Credentials page to edit it.
Under API restrictions, choose Restrict key, select YouTube Data API v3, and save. This prevents that credential from being used with unrelated APIs that accept Google API keys.
Under Application restrictions, select the restriction appropriate to the caller. For a backend with predictable public egress addresses, use IP addresses and enter those addresses. For website callers, Google provides Websites restrictions. Use the narrowest configuration that supports the actual application.
Click Save after editing. Test from the environment that will make the requests. A website-restricted credential is not a general-purpose terminal credential; an IP restriction must match the public address Google sees, not your server's private network address.
Test the key with a public-data request
Start with videos.list rather than a complex search workflow. It lets you verify access using a known public video ID.
Load YOUTUBE_API_KEY through your local secret-loading setup and set VIDEO_ID to the ID of an existing public video. Then run:
1curl --get 'https://www.googleapis.com/youtube/v3/videos' \
2 --header "x-goog-api-key: ${YOUTUBE_API_KEY}" \
3 --data-urlencode 'part=snippet,statistics' \
4 --data-urlencode "id=${VIDEO_ID}"The endpoint and parameters come from Google's videos.list reference. The snippet part requests metadata such as the title and channel; statistics requests available public statistics. The result contains an items array of matching video resources.
Google recommends sending keys in the x-goog-api-key header rather than query parameters because URLs can be captured by logging and scanning systems. Header values still need redaction in your own request logs.
An empty result is not necessarily an authentication failure. Confirm that you supplied the correct ID and that the video is publicly accessible. Also, an API key does not unlock owner-only parts such as video file details or processing information.
What an API key can and cannot do
The YouTube Data API provides public reads and authorized account operations through the same API family. The credential requirements depend on the operation, not just the endpoint name.
Task | API key alone? | What to use |
|---|---|---|
Retrieve public video metadata | Yes | API key and videos.list |
Retrieve public channel information | Yes | API key and channels.list |
Search public content | Yes | API key and search.list |
Upload a video | No | OAuth access token with an accepted upload scope |
Update or delete a video | No | OAuth authorization with appropriate scope and permissions |
Access private user data | No | OAuth authorization from the relevant user |
Request the authenticated user's channel with mine=true | No | OAuth authorization |
A key is therefore useful for a public video catalog or a metadata enrichment service. It is not a publishing credential. Creating additional API keys does not turn the project into a channel-authorized uploader.
Why uploads need OAuth 2.0
Uploading changes a user's channel. Google needs consent from someone authorized to make that change, not merely a project identifier.
For a direct integration, create an OAuth client ID rather than another API key. Configure the application's consent information, declare the scopes it needs, and register the redirect URI for your application type.
The normal server-side flow is:
- Send the channel owner to Google's authorization screen.
- Request the minimum necessary scopes, such as
https://www.googleapis.com/auth/youtube.uploadfor uploading. - Exchange the returned authorization code for tokens on your backend.
- Send an access token with the upload request.
- Store refresh tokens securely when offline access is needed, and handle revocation or reconnection.
Google's videos.insert documentation lists the accepted scopes. For the upload implementation itself, see our YouTube upload API guide.
Consent, verification, and audits are separate concerns
For a public application, plan for Google's OAuth production requirements. The current console uses pages such as Branding, Data Access, and Verification Center to manage app identity, requested scopes, and review status.
Apps requesting sensitive or restricted scopes generally need verification unless an exception applies. Personal-use, development, and internal applications have specific exceptions; they are not a blanket exemption for a customer-facing SaaS. Google's sensitive-scope verification guide explains the conditions.
A YouTube compliance audit is distinct from OAuth verification. Google's quota and compliance audit guide requires an audit before requesting quota beyond the default allocation. Do not treat creating a key, publishing consent branding, and obtaining more quota as the same approval step.
Quota basics: check the current buckets
Verified against Google's documentation in November 2026: the default allocation is 100 search.list calls daily, 100 videos.insert calls daily, and 10,000 units daily combined for other endpoints. Daily quotas reset at midnight Pacific Time.
That is more specific than saying "every project gets 10,000 units for everything." Google's current quota calculator lists separate buckets for search and uploads.
Method | Current documented cost | Default daily allocation it uses |
|---|---|---|
videos.list | 1 unit | General 10,000-unit pool |
channels.list | 1 unit | General 10,000-unit pool |
playlistItems.list | 1 unit | General 10,000-unit pool |
videos.update | 50 units | General 10,000-unit pool |
thumbnails.set | 50 units | General 10,000-unit pool |
search.list | 1 unit in its own bucket | 100 search calls |
videos.insert | 1 unit in its own bucket | 100 upload calls |
Additional result pages are additional requests. Invalid requests also consume quota. Check your project's actual limits and usage in Cloud Console rather than assuming every project has identical allocations.
In particular, do not estimate upload capacity by dividing the general 10,000-unit pool by an upload cost copied from an older tutorial. Read the current upload bucket. Our YouTube API pricing and quota guide goes deeper into capacity planning.
Keep the key secure
Follow Google's API key security recommendations, even though a standard YouTube key does not grant private channel access. A leaked key can still expose your project's available quota to misuse.
- Keep server-side keys in a secret manager or deployment environment, not committed source files.
- Avoid putting keys in URLs, screenshots, support tickets, or copied request traces.
- Restrict the API and caller instead of relying on secrecy alone.
- Separate application credentials so a rotation does not affect unrelated services.
- Monitor usage, remove unused keys, and rotate exposed credentials.
Do not disable all restrictions as a permanent fix for a failed request. Identify which restriction is rejecting the legitimate caller and correct that specific configuration.
Common errors and what to check
Inspect the response body, not just the HTTP status. Google's global error reference and YouTube-specific errors distinguish configuration, authorization, and quota failures.
Error | What it means | First checks |
|---|---|---|
keyInvalid | The supplied key is invalid | Confirm you used the key string, removed whitespace, and loaded the intended secret |
accessNotConfigured | The project cannot access the API | Enable YouTube Data API v3 in the key's project; inspect the message for blocked or deleted project conditions |
quotaExceeded | The request exceeds available quota | Inspect the relevant bucket and usage; wait for reset or pursue the documented extension process |
insufficientPermissions | OAuth permissions are inadequate | Check granted scopes and the user's channel access |
authorizationRequired | The operation requires user authorization | Use OAuth rather than trying another public-data key |
If a restricted key fails only from production, compare production egress addresses with the configured allowlist. If it fails only in a terminal, check whether the key was restricted for website requests. Retrying an unchanged configuration will not fix either mismatch.
How Outstand fits
If your objective is uploading, Outstand's YouTube integration provides a different entry point. YouTube is a Managed Keys network: your subscription includes use of Outstand's Google Cloud OAuth app, so you do not need to register your own Google project for the managed connection.
The channel owner still signs in and grants access. Managed Keys remove the need to operate your own OAuth app, not the need for user consent.
Once the channel is connected, create a post using your Outstand API key, which is separate from a Google API key. The request below follows the create-post container model and the YouTube configuration example:
1curl -X POST https://api.outstand.so/v1/posts/ \
2 -H "Authorization: Bearer YOUR_API_KEY" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "containers": [
6 {
7 "content": "Check out this amazing tutorial!",
8 "media": [
9 {
10 "url": "https://example.com/video.mp4",
11 "filename": "video.mp4"
12 }
13 ]
14 }
15 ],
16 "accounts": ["YOUR_YOUTUBE_ACCOUNT_ID"],
17 "youtube": {
18 "isShort": true,
19 "privacyStatus": "public",
20 "tags": ["tutorial", "shorts"]
21 }
22 }'Replace the example media URL with the publicly accessible URL returned after confirming your media upload. Use the connected account's ID, not the network name youtube. Platform configuration belongs in the top-level youtube object.
Managed uploads share paced daily capacity. Scheduling does not reserve a slot, and failures can require manual retry. Optional BYOK uses your own OAuth credentials and quota instead of the managed pool. Read the YouTube configuration documentation before choosing between those paths.
FAQ
Is the YouTube API free?
Google's cited documentation describes access through quota allocations rather than a purchasable per-request plan. You can start with the default allocation, but it is not unlimited access. Higher quota requires the documented request and compliance process; your own hosting or integration provider can have separate costs.
Can I upload videos with a YouTube API key?
No. A Google API key alone retrieves public data. Uploading requires OAuth authorization with an accepted scope and an account permitted to upload to the channel.
Do I need an OAuth consent screen just to read public metadata?
Not for a public-data request authenticated only with an API key. Consent configuration becomes relevant when your app asks users to authorize account access through OAuth.
Does creating another key give me more quota?
No. The documented quota allocation belongs to the project, not each key string. Additional keys in that project do not create independent daily allocations.
Is a YouTube API key the same as an Outstand API key?
No. The Google key identifies a Google Cloud project for supported public-data requests. An Outstand key authenticates requests to Outstand, which uses the connected channel's OAuth authorization for publishing.