Guide to Google Calendar API Integration: OAuth, Events and Sync
Set up a Google Cloud project, request the right OAuth scopes, read and write events, and keep your app in sync with push notifications and sync tokens. Then see how to connect your users' Google Calendar accounts through one hosted authentication link.
/calendar/v3/calendars/primary/events
200 OK
The Google Calendar API is Google's REST API for reading and writing calendars and events in a user's Google account. To integrate it, you enable the API in a Google Cloud project, send each user through OAuth 2.0 with a calendar scope, then call endpoints such as calendarList and events, and keep data fresh with push notifications and sync tokens.
This guide walks through each step with the native API, then shows how a Google Calendar API integration with Unipile replaces the OAuth app, token storage and sync loop with one hosted authentication link.
Comparing Google Calendar with Outlook Calendar, or building availability and scheduling features across both? Start with the complete developer's guide to calendar API integration.
What is Google Calendar API?
The Google Calendar API is a RESTful API that gives your application access to the calendars, events and settings of a Google account, with the user's permission. It exposes most of what people do in the Google Calendar web interface: list calendars, create and edit events, invite attendees, check availability.
You call it with plain HTTPS requests to https://www.googleapis.com/calendar/v3, or through the Google client libraries, which wrap the same requests in methods for your language. Every request acts on behalf of one signed-in user and carries an OAuth 2.0 access token, so your app only sees the calendars that user can see.
The API works with personal Google accounts and Google Workspace accounts alike. Google documents every resource in the Calendar API overview.
Benefits of Integrating Google Calendar API in Your Application
A calendar integration lets users manage meetings without leaving your product: your app creates the event, Google sends the invitations, and the schedule stays the same in both places. For software publishers, it removes the copy and paste between tools that makes scheduling slow and error prone.
Scheduling automation
Create, reschedule and cancel events from your own workflow, with attendees, a video link and reminders. Google notifies the guests, so your app does not have to send invitations itself.
Availability checks
Query busy time ranges before you propose a slot. A booking page, an interview planner or an AI assistant can suggest only the times that are really free.
Unified calendar management
Bring the calendars of many users into one view inside your app: a team schedule, meetings logged on a CRM record, or interviews attached to a candidate.
Typical products: ATS interview scheduling, CRM meeting sync, booking tools and AI agents that plan meetings for their users.
How to Set Up a Google Cloud Project for the Google Calendar API
Before your first request, you need a Google Cloud project with the API enabled, an OAuth consent screen and an OAuth client ID. The project is where Google tracks your credentials, your quotas and the verification status of your app.
Create a Google Cloud project
In the Google Cloud Console, create a project dedicated to your application. Keep production and testing in separate projects if you can.
Enable the Google Calendar API
Open APIs and Services, then Library, search for the Calendar API and click Enable. Requests to an API that is not enabled fail with a 403 error.
Configure the OAuth consent screen
Set the app name, support email, audience and the calendar scopes you will request. While the app is in testing, only the test users you add can sign in. Our guide to the OAuth consent screen covers each field.
Create an OAuth client ID
Under Credentials, create an OAuth client ID of type web application and add your authorized redirect URI. An API key alone only reads public calendars: private calendars always need OAuth.
Install a client library or call REST
Google publishes client libraries for Node.js, Python, Java, Go, PHP, .NET and more. You can also call the REST endpoints directly with any HTTP client, as in the examples below.
A public app that requests calendar scopes must go through Google's verification before the unverified app screen goes away. Until then, the app is limited to 100 users, see how the 100 user limit works, and in testing mode refresh tokens expire after 7 days. Details in our Google OAuth verification guide.
Which OAuth Scopes Does the Google Calendar API Need?
Request the narrowest scope that covers your feature: calendar.events to read and write events, calendar.readonly to only read, and the full calendar scope only if you manage calendars themselves. Users accept limited, clearly described access more easily, and a smaller scope set is simpler to justify during Google's review.
Google Calendar uses OAuth 2.0 for authentication and authorization. Your app redirects the user to Google, the user approves the scopes on the consent screen, and Google returns an authorization code that your backend exchanges for an access token and a refresh token. Only that user's calendars become reachable, and the user can revoke access at any time from their Google account.
Access inside Google Calendar is then governed by access control rules (the Acl resource): a user or a group gets a role such as reader, writer or owner on a calendar, and the API returns only what that role allows. All traffic goes over HTTPS.
On your side, store refresh tokens encrypted, never in the browser, and plan for the day a token stops working: our article on the Google OAuth refresh token explains when that happens.
oauth2.googleapis.com/token
access_token + refresh_token
Calendar scopes compared
All scopes start with https://www.googleapis.com/auth/. The full list is in Google's Calendar API scopes reference.
| Scope | What it allows | Use it for |
|---|---|---|
calendar | Full access to every calendar the user can reach, including sharing settings and permanent deletion | Apps that create calendars or manage sharing |
calendar.events | View and edit events on all the user's calendars | Scheduling, booking and meeting sync |
calendar.readonly | Read calendars and events, no changes | Dashboards, reporting, activity logging |
calendar.freebusy | See availability only, not event details | Slot pickers and availability checks |
Key Features of Google Calendar API
The core features of the API are listing the user's calendars, reading events in a time range, creating, updating and deleting events, checking availability and watching for changes. Each one maps to a small set of REST endpoints under the same base URL.
https://www.googleapis.com/calendar/v3Listing and creating events
Use primary as the calendar ID for the user's main calendar. To read a time window, pass timeMin and timeMax in RFC 3339 format; add singleEvents=true to expand recurring events into individual occurrences, which also lets you sort with orderBy=startTime.
# List this week's events, recurring events expanded
curl --request GET \
--url "https://www.googleapis.com/calendar/v3/calendars/primary/events?timeMin=2026-10-19T00:00:00Z&timeMax=2026-10-26T00:00:00Z&singleEvents=true&orderBy=startTime" \
--header "Authorization: Bearer {ACCESS_TOKEN}"
# Create an event and email the invitation to the attendee
curl --request POST \
--url "https://www.googleapis.com/calendar/v3/calendars/primary/events?sendUpdates=all" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--data '{
"summary": "Onboarding call",
"start": { "dateTime": "2026-10-20T11:00:00+02:00", "timeZone": "Europe/Paris" },
"end": { "dateTime": "2026-10-20T12:00:00+02:00", "timeZone": "Europe/Paris" },
"attendees": [{ "email": "client@example.com" }]
}'
The response is the created event, with its id. Store it with your own record: you need it to update or delete the event later.
Update and delete events
Use PATCH to change only the fields you send, such as a new time, a location or an extra attendee, and PUT to replace the whole event. Both accept sendUpdates (all, externalOnly or none) to decide who gets notified. DELETE removes a canceled event and takes the same parameter, so guests learn about the cancellation.
Only the organizer's copy of an event can change shared properties such as guest permissions: an update from an attendee's calendar on those fields returns a 403 error, covered in the errors section below.
Integrating Google Calendar API with Your Application: Sync and Push Notifications
A production Google Calendar integration keeps a local copy of each user's events and updates it in two ways: a full sync once, then incremental syncs driven by push notifications. This avoids polling every calendar every few minutes, which wastes quota and still shows stale data between two polls.
List all events once and save them. The last page of results returns a nextSyncToken: store it per calendar.
GET /calendars/primary/eventsOpen a notification channel on the calendar with your HTTPS callback address and a unique channel ID.
POST /calendars/primary/events/watchGoogle calls your endpoint when something changes. The request has no body: the headers only say that the calendar changed.
X-Goog-Resource-State: existsList events again with the stored token. You get only what changed, deleted events included, plus a new token.
GET /calendars/primary/events?syncToken=...If Google answers 410 Gone with the reason fullSyncRequired, the sync token is no longer valid: clear the local copy of that calendar and go back to step 1.
Webhooks and push notifications
Google Calendar push notifications are the API's webhooks. You create a channel with events.watch, and Google sends a POST to your address each time the watched calendar changes. The address must be HTTPS with a valid certificate, and your endpoint answers with a 2xx status code. Use the optional token field to check that a notification really comes from your channel.
curl --request POST \
--url "https://www.googleapis.com/calendar/v3/calendars/primary/events/watch" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--data '{
"id": "channel-user-42-primary",
"type": "web_hook",
"address": "https://yourapp.com/webhooks/google-calendar",
"token": "user=42"
}'
# Notification sent to your address (headers only, no body)
# X-Goog-Channel-ID: channel-user-42-primary
# X-Goog-Resource-State: exists
# X-Goog-Channel-Token: user=42
Channels expire and are not renewed automatically: create a new channel with a new id before the old one ends, and stop old ones with POST /channels/stop. Google does not guarantee delivery of every message, so keep a periodic incremental sync as a safety net.
Creating custom calendar views
Once events live in your database, you can show them the way your users need, instead of embedding the Google Calendar interface. Filter by event type, attendee or calendar, combine the calendars of a whole team, or attach meetings to the record they belong to: a deal, a candidate, a support ticket. Users stay in your app, and every change they make there is written back to Google Calendar through the same events endpoints.
Google Calendar and Outlook Calendar, one Calendar API
Skip the Cloud project, the token storage and the watch channels. Link a user's calendar through hosted authentication and receive event changes on one webhook. See the Calendar API for both providers.
Handling Common Errors and Best Practices
Most Google Calendar API errors in production come from three causes: too many requests in a short window (403 or 429), an expired token (401), and a sync token that is no longer valid (410). Each one has a known fix, and only some of them should be retried.
Managing rate limits and quotas
Google measures Calendar API quotas per minute, on a sliding window, at two levels: your whole Cloud project, and each user inside your project. A burst above the limit in one minute can still slow you down in the next one.
- Retry with truncated exponential backoff: wait 1, 2, 4, 8 seconds and so on, plus a random delay of up to one second, and stop at a maximum of 32 or 64 seconds.
- Spread recurring jobs: do not start every user's sync at the same minute; randomize the start time and vary the interval.
- Prefer push notifications to polling: one notification plus one incremental sync costs far fewer requests than a poll every few minutes.
Values from Google's Calendar API usage limits. Not all projects have the same quotas; check the Quotas page of your Cloud project. Last verified: October 2026.
Error codes and troubleshooting
The response body gives a reason next to the HTTP status. Read it before you decide to retry: a 403 can mean a rate limit (retry later) or a permission problem (retrying never helps).
| Status and reason | What it means | What to do |
|---|---|---|
401 authError | The access token is expired or invalid | Refresh the token; if that fails, send the user through OAuth again |
403 or 429 rateLimitExceeded, 403 userRateLimitExceeded | Too many requests for the calendar, the user or the project in a short window | Retry with exponential backoff and reduce request volume |
403 quotaExceeded | A Google Calendar usage limit, for example on invitations, was reached | Do not retry in a loop; review the Calendar usage limits for the account |
403 forbiddenForNonOrganizer | An attendee's copy tried to change shared properties of an event | Patch only non shared fields, or update the organizer's copy |
404 notFound | The event or calendar does not exist, or the user cannot access it | Check the IDs and the user's access; retry with backoff if it was just created |
410 fullSyncRequired | The sync token is no longer valid | Clear the local copy and run a full sync |
Source: Google's Calendar API error reference. For errors raised during the OAuth flow itself, such as invalid_grant, see our guide to Google OAuth errors. Last verified: October 2026.
Unipile Google Calendar Integration Made Effortless
With Unipile, your users link their Google Calendar through a hosted authentication page, and your app reads and writes their events with a few REST calls, on behalf of each authenticated user. Unipile handles the Google OAuth app, token refresh and change detection, and sends calendar changes to your webhook.
Send the user to Hosted Auth
Your backend requests a one time link, and your app redirects the user to the Unipile hosted authentication page.
The user signs in with Google
The user picks Google, goes through the Google OAuth consent screen and grants calendar access.
Your app gets an account ID
Unipile redirects the user back to your app and calls your notify_url with the new account_id.
Call the Calendar endpoints
Pass that account_id to list calendars, read and create events, or edit them for the user.
Start without verifying your own Google app
By default, users connect through Unipile's Google OAuth app, which is CASA Tier 2 certified. You do not need your own Cloud project, consent screen review or security assessment to start.
Google Calendar API examples with Unipile
Every call uses your Unipile API key in the X-API-KEY header and your account's DSN as the base URL. Events are read with start and end filters in RFC 3339 format and paginated with a cursor.
# 1. Create a hosted auth link for one of your users
curl --request POST \
--url "https://{YOUR_DSN}/api/v1/hosted/accounts/link" \
--header "X-API-KEY: {YOUR_ACCESS_TOKEN}" \
--header "content-type: application/json" \
--data '{
"type": "create",
"providers": ["GOOGLE"],
"api_url": "https://{YOUR_DSN}",
"expiresOn": "2026-10-20T12:00:00.000Z",
"notify_url": "https://yourapp.com/unipile/accounts",
"name": "user_42"
}'
# 2. List the user's calendars
curl --request GET \
--url "https://{YOUR_DSN}/api/v1/calendars?account_id={ACCOUNT_ID}" \
--header "X-API-KEY: {YOUR_ACCESS_TOKEN}"
# 3. Read this week's events from one calendar
curl --request GET \
--url "https://{YOUR_DSN}/api/v1/calendars/{CALENDAR_ID}/events?account_id={ACCOUNT_ID}&start=2026-10-19T00:00:00Z&end=2026-10-26T00:00:00Z" \
--header "X-API-KEY: {YOUR_ACCESS_TOKEN}"
# 4. Create an event with a Google Meet link
curl --request POST \
--url "https://{YOUR_DSN}/api/v1/calendars/{CALENDAR_ID}/events?account_id={ACCOUNT_ID}" \
--header "X-API-KEY: {YOUR_ACCESS_TOKEN}" \
--header "content-type: application/json" \
--data '{
"title": "Onboarding call",
"start": { "date_time": "2026-10-20T09:00:00.000Z", "time_zone": "Europe/Paris" },
"end": { "date_time": "2026-10-20T10:00:00.000Z", "time_zone": "Europe/Paris" },
"attendees": [{ "email": "client@example.com" }],
"conference": { "provider": "google_meet" },
"notify": true
}'
# 5. Receive calendar changes on your webhook
curl --request POST \
--url "https://{YOUR_DSN}/api/v1/webhooks" \
--header "X-API-KEY: {YOUR_ACCESS_TOKEN}" \
--header "content-type: application/json" \
--data '{
"source": "calendar_event",
"request_url": "https://yourapp.com/unipile/calendar",
"events": ["calendar_event_created", "calendar_event_updated", "calendar_event_deleted"]
}'
The same calls work for an Outlook Calendar account: only the account_id changes. Each event comes back with title, start, end, attendees and organizer in one format for both providers.
Calendar endpoints reference
Unipile vs Self-Integration: Save Time and Gain Support
Integrating Google Calendar yourself gives you full control, at the cost of a Google Cloud project, an OAuth app to get verified, token storage and a sync engine to maintain. Unipile takes over that infrastructure and gives you one calendar contract for Google and Outlook.
| Topic | Self-integration | Unipile |
|---|---|---|
| OAuth app | Your Cloud project, consent screen and OAuth client | Unipile's Google OAuth app by default, your own credentials optional |
| Google verification | Required before a public launch, 100 user cap until then | Not needed to start: the Unipile app is CASA Tier 2 certified |
| User connection | Your own OAuth flow, callback and consent handling | One hosted authentication link |
| Tokens | Store, encrypt and refresh tokens per user | Handled by Unipile, your app keeps an account_id |
| Change detection | Watch channels to renew, sync tokens, 410 recovery | One calendar_event webhook for created, updated and deleted events |
| Outlook Calendar | A second integration on Microsoft Graph | Same endpoints and event format |
account_idcalendar_event webhook for created, updated and deleted eventsOne link Hosted Auth vs. full OAuth flow
With a native integration, you build the authorization redirect, the callback, the code exchange, the encrypted token store and the reconnection flow when a token is revoked. With Unipile Hosted Auth, your backend requests one link and receives an account_id on your notify_url once the user is connected. When access is lost, the same link with "type": "reconnect" brings the user back. Your team spends its time on the calendar features users see, not on the plumbing.
Technical support and integration ease
You are not left alone with the documentation. Book an integration call with our founders (CTO and CEO) to align scopes, sync strategy and the choice of OAuth app before you build, and reach our live support team before, during and after the integration, at no extra cost. We keep the integration up to date when Google changes its API or its policies.
Expanding Versatility: Unipile's Integration with Outlook Calendar API
Most B2B products need Outlook Calendar as soon as they support Google Calendar. With Unipile, an Outlook Calendar account uses the same endpoints, the same event format and the same webhook as a Google account, so your calendar code is written once.
On the Microsoft side, you register your application in Microsoft Entra ID (formerly Azure Active Directory) and add its credentials to Unipile; our team can help with that setup. The native route goes through Microsoft Graph, explained in our Outlook Calendar API guide. To keep both providers in sync in one product, read calendar sync for SaaS.
Same request, same response format. See the Outlook Calendar API page.
Connect your first Google Calendar account today
The Google Calendar API covers everything a scheduling feature needs, from events to availability and change notifications. Unipile gives you the same capabilities through one hosted authentication link and one webhook, without verifying your own Google app first.
Google Calendar API FAQ
Quick answers on scopes, quotas, webhooks and errors when you integrate Google Calendar.
Google's calendar API lets an application read and write the calendars and events of a Google account, with the user's permission. Developers use it to create meetings from their own product, check availability before proposing a slot, and show a user's schedule next to a CRM record, a candidate or a ticket.
Standard use of the API has no charge. Usage is capped by per-minute quotas, per project and per user, listed on Google's usage limits page, which also describes any billing beyond those limits. Check it before you size a large rollout.
Only for public calendars. An API key identifies your project but not a user, so it cannot open private calendars. To read or change a user's own events, your app needs OAuth 2.0 and a calendar scope approved by that user.
Request the narrowest scope that covers your feature. calendar.events reads and writes events, calendar.readonly only reads, calendar.freebusy only shows availability, and the full calendar scope is for apps that also manage calendars and sharing.
Yes, through push notifications. You open a channel with events.watch and an HTTPS address, and Google calls that address when the calendar changes. The notification has no body, so your app then runs an incremental sync with its stored sync token to get the changed events.
A 403 with rateLimitExceeded or userRateLimitExceeded means too many requests: retry with exponential backoff. Other 403 reasons, such as forbiddenForNonOrganizer, are permission problems that a retry will not fix. A 410 with fullSyncRequired means your sync token is no longer valid and you need a full sync.
No. By default your users connect through Unipile's Google OAuth app, which is CASA Tier 2 certified, so you can build and launch without your own verification. You can switch to your own OAuth credentials later for a white label consent screen, as explained in the Google OAuth documentation.
Still have questions? Our team is here to help.
Talk to an expert