Keys / Google
YOUTUBE_API_KEY
A Google Cloud API key, restricted to the YouTube Data API, that your app reads public YouTube data with. Private user data needs OAuth instead.
- Expires
- the docs don't say
- API
- create, list and delete, with the Google Cloud API Keys API
Get it
Create one on console.cloud.google.com/apis/credentials. The steps aren't recorded yet.
Set it
YOUTUBE_API_KEY=...
No official Google SDK reads this variable; your app passes the key in, such as developerKey in the Python client. Or keep it out of .env with keypin: keypin run -- npm run dev
Replace it
- Open the key on the Cloud console's Credentials page and click Rotate key. The new key keeps the old key's restrictions.
keypin rotatecopies the restrictions itself, using a service account with API Keys Admin; it refuses a key bound to a service account. - Deploy it everywhere that reads
YOUTUBE_API_KEY. Keep the old key until the new one works. - Delete the old key. You can restore a deleted key within 30 days.