How to Create a Google Service Account
A Google service account is like hiring an employee for your app. You create it once — it gets its own email address. Then you share your Google services with that email, the same way you'd share a Google Sheet with a coworker. One account. Every Google service. No manual exports ever again.
This guide was written as of April 2026. If anything looks different, let us know.
Before you start
What you'll have at the end
A service account email and JSON key in your .env file — unlocking Analytics, Sheets, YouTube, Drive, Calendar, Docs, and more
Free tier
Google Cloud's free tier covers virtually all API usage for dashboards and internal tools. Most APIs have daily quotas that side projects never hit.
What is a service account?
A service account is an email address for your app. When you share a Google Sheet with a coworker, they can open it. When you share it with your service account, your app can read it. Same idea.
You create one service account, and then share whichever Google services you need with that email. Your vibe coded dashboard can then pull live data from all of them.
Create a Google Cloud account
Go to console.cloud.google.com and sign in with your Google account. No credit card is needed for the APIs we're using.
If it asks you to agree to terms of service, accept them. You'll land on the Google Cloud Console dashboard.
Create a project
Click the project dropdown at the top of the page (it might say "Select a project" or show an existing project name). Click "New Project."
Name it after your app — for example, "my-seo-dashboard" or "client-portal." Click Create.
A project is just a container. It keeps your APIs and credentials organized.
Create the service account
In the left sidebar, go to IAM & Admin > Service Accounts. Click "Create Service Account."
Give it a name (like "my-app-reader"). Click Create and Continue. You can skip the optional permissions steps — just click Done.
You now have a service account with an email like: [email protected]
Copy this email. You'll use it in every section below.
Download the JSON key
Click on your new service account in the list. Go to the Keys tab. Click Add Key > Create new key > JSON > Create.
A JSON file will download to your computer. This is the "password" for your app-employee. Keep it safe — anyone with this file can act as your service account.
Add it to your .env file
Open your .env file and add these two lines:
GOOGLE_SERVICE_ACCOUNT_EMAIL=my-app-reader@my-project.iam.gserviceaccount.com
GOOGLE_SERVICE_ACCOUNT_KEY={"type":"service_account","project_id":...}
For the key, open the JSON file you downloaded, copy the entire contents, and paste it as a single line.
Some AI tools prefer a file path instead. If your tool asks for that, put the JSON file in your project folder and use:
GOOGLE_APPLICATION_CREDENTIALS=./service-account-key.json
The pattern for connecting services
From here on, every Google service follows the same pattern:
1. Go to Google Cloud Console — enable the API for that service
2. Go to the service itself (Sheets, Analytics, etc.) — share access with your service account email
3. Done. Your app can now read/write that service.
Memorize this. It's always the same three steps.
Connect to Google Search Console
What it gives your app: Your site's clicks, impressions, rankings, and top search queries.
Step 1: In Google Cloud Console, search for "Google Search Console API" and click Enable.
Step 2: Go to Google Search Console (search.google.com/search-console). Open your property. Go to Settings > Users and permissions > Add user. Paste your service account email. Set permission to "Full."
Your app can now read all your search performance data.
Connect to Google Analytics
What it gives your app: Your site's traffic, visitors, page views, and sessions.
Step 1: In Google Cloud Console, search for "Google Analytics Data API" and click Enable.
Step 2: Go to Google Analytics (analytics.google.com). Go to Admin > Property > Property Access Management. Click the + button, paste your service account email, and set the role to "Viewer."
Your app can now read your analytics data.
Connect to Google Sheets
What it gives your app: Read and write any spreadsheet — use Sheets as a simple database or data source.
Step 1: In Google Cloud Console, search for "Google Sheets API" and click Enable.
Step 2: Open the Google Sheet you want to connect. Click the Share button. Paste your service account email and click Send.
That's it. Your app can now read and write that sheet. Repeat for any other sheets you need.
Connect to YouTube
What it gives your app: Channel stats, video views, likes, and comments.
Step 1: In Google Cloud Console, search for "YouTube Data API v3" and click Enable.
For public data (any channel's stats): Create an API key in the Credentials section. This is simpler than a service account and works for any public YouTube data.
For your own channel's private data: Use the service account + share your channel's Brand Account access with the service account email.
Add your YouTube API key to .env as YOUTUBE_API_KEY.
Connect to Google Drive
What it gives your app: Read, upload, and organize files and folders in Drive.
Step 1: In Google Cloud Console, search for "Google Drive API" and click Enable.
Step 2: Open Google Drive. Right-click the folder you want to share. Click Share. Paste your service account email.
Your app can now read and upload files to that folder.
Connect to Google Calendar
What it gives your app: Read, create, and edit calendar events.
Step 1: In Google Cloud Console, search for "Google Calendar API" and click Enable.
Step 2: Open Google Calendar. Go to Settings > Settings for my calendars > [your calendar] > Share with specific people. Add your service account email.
Your app can now read and create events on that calendar.
Connect to Google Docs
What it gives your app: Read and write documents programmatically.
Step 1: In Google Cloud Console, search for "Google Docs API" and click Enable.
Step 2: Open the Google Doc (or folder of docs) you want to connect. Click Share. Paste your service account email.
Same pattern as Sheets and Drive — share with the service account email.
Connect to Gmail
What it gives your app: Send and read emails programmatically.
Important: Gmail API access requires Google Workspace (a paid Google account for businesses) and domain-wide delegation. It's not available on free Gmail accounts.
If you just need to send emails from your app, use Resend instead — it's free, simpler, and doesn't require Workspace. See our Resend guide.
If you do have Google Workspace and need full Gmail access, the setup involves enabling domain-wide delegation in your Workspace admin console and granting the service account specific Gmail scopes.
Tell your AI tool what you built
Now that you've connected your services, tell your AI tool what's available. Copy the prompt below and fill in which services you connected.
Tell Your AI Tool
Copy this prompt and paste it into your AI coding tool. It tells your AI exactly what credentials you just set up.
I've created a Google service account. My credentials are in my .env file: - GOOGLE_SERVICE_ACCOUNT_EMAIL — the service account email - GOOGLE_SERVICE_ACCOUNT_KEY — the JSON key (full JSON string) I've connected these Google services: - [list the services you connected, e.g., Search Console, Analytics, Sheets] Build me a dashboard that shows: - [describe what you want to see] Use the Google APIs Node.js client library.
Paste the prompt into the chat panel (Cmd+L or Ctrl+L). Cursor can also read your .env file directly — if your credentials are there, it already knows.
YepAPI Tip
Google gives you YOUR data — your site's analytics, your search rankings, your spreadsheets. YepAPI gives you everyone else's — competitor keywords, backlink profiles, SERP results, AI models. Together they're the complete picture.
Was this guide helpful?
Google Service Account — FAQ
A service account is like an email address for your app. You share your Google services (Sheets, Analytics, etc.) with this email, and your app can read/write that data — the same way a coworker can access a shared Google Sheet.
Yes. Creating a service account and using most Google APIs is completely free under Google Cloud's free tier. Side projects and dashboards rarely hit any usage limits.
An API key accesses public data (YouTube search results, Maps). A service account accesses YOUR private data (your Analytics, your Sheets, your Calendar). Most vibe coders need a service account.
Yes. That's the whole point. You create one service account and then share each Google service with its email. One setup, everything connected.
No — except for Gmail API access. All other Google APIs (Analytics, Sheets, Drive, Calendar, YouTube, Docs, Search Console) work with a free Google account.
Start vibe coding with one API key.
One API key. 100+ endpoints. Yep, that's it.