Calendar API
Connect a Google Calendar account and manage events, check availability, and schedule directly through the API.All calendar endpoints require an authenticated session. The user is identified from the session automatically — you do not pass a
userId parameter.Most calendar endpoints also require a connected Google Calendar account. Use the connect flow to authorize access before calling event endpoints.
Base URL
Authentication
All calendar endpoints require a valid NextAuth session. Requests without an active session receive a401 Unauthorized response (or a redirect to /login for browser-based flows).
The authenticated user’s identity is derived from the session. You do not need to include a userId parameter in any request.
Token storage
Calendar tokens (access and refresh tokens) are encrypted at rest using AES-256-GCM before being persisted to the database. Tokens are never stored in plaintext.Connect calendar
Request body
Response
authUrl to begin the OAuth consent flow. After granting access, Google redirects to the callback endpoint below.
Errors
OAuth callback
Query parameters
Behavior
On success, this endpoint:- Verifies the HMAC-signed state parameter and checks it has not expired.
- Exchanges the authorization code for access and refresh tokens.
- Retrieves the user’s primary calendar ID and timezone.
- Encrypts and persists the tokens to the database (AES-256-GCM).
- Redirects to
/dashboard/calendar?connected=true.
Error redirects
If an error occurs, the endpoint redirects to/dashboard/calendar with an error query parameter:
Start OAuth (redirect)
/login.