Guide

Manage Google Calendar from the CLI

Google Calendar's API requires a GCP project, OAuth consent screen, scope configuration, and service account credentials before you can read a single event. Nylas CLI handles all of that in one auth step. List events, create meetings, check availability, update, and delete from your terminal. Works with Gmail, Outlook, Exchange, Yahoo, iCloud, and IMAP.

By Aaron de Mello

The Google Calendar API problem

You want to manage Google Calendar from the command line. The official route requires 6 steps before you touch a single event:

  1. Create a GCP project in the Google Cloud Console
  2. Enable the Google Calendar API
  3. Configure the OAuth consent screen
  4. Create OAuth 2.0 credentials (or a service account)
  5. Set calendar scopes (https://www.googleapis.com/auth/calendar)
  6. Write code to exchange tokens and make API calls

According to Google's own documentation, this process takes 15-30 minutes for experienced developers. For someone who just wants to check their next meeting from the terminal, that's too much setup.

1. Install Nylas CLI

Pick one of these install methods:

# Homebrew (macOS / Linux)
brew install nylas/nylas-cli/nylas

# Shell script (macOS / Linux / WSL)
curl -fsSL https://cli.nylas.com/install.sh | bash

# PowerShell (Windows)
irm https://cli.nylas.com/install.ps1 | iex

# Go
go install github.com/nylas/cli/cmd/nylas@latest

2. Authenticate with Google

One command connects your Google Calendar account. Nylas handles the OAuth2 flow, token refresh, and scope management.

nylas auth login

This opens your browser, prompts Google sign-in, and stores credentials locally. The token auto-refreshes, so you won't re-authenticate unless you revoke access. Verify the connection:

nylas calendar list

You should see your Google calendars listed by name and ID.

3. List Google Calendar events

# Upcoming events (default: next 7 days)
nylas calendar events list

# Next 30 days
nylas calendar events list --days 30

# Show timezone info
nylas calendar events list --show-tz

# Convert to a specific timezone
nylas calendar events list --timezone America/Los_Angeles

Example output

$ nylas calendar events list --days 7

Sprint Planning
  When: Mon, Mar 30, 2026, 10:00 AM - 11:00 AM
  Location: Google Meet
  Guests: 8 participant(s)
  ID: event_abc123

Design Review
  When: Tue, Mar 31, 2026, 2:00 PM - 3:00 PM
  Guests: 3 participant(s)
  ID: event_def456

Found 6 event(s)

4. Create events

# Basic meeting
nylas calendar events create \
  --title "Weekly Standup" \
  --start "2026-04-01 09:00" \
  --end "2026-04-01 09:30"

# With participants
nylas calendar events create \
  --title "Project Kickoff" \
  --start "2026-04-02 14:00" \
  --end "2026-04-02 15:00" \
  --participant alice@company.com \
  --participant bob@company.com

# All-day event
nylas calendar events create \
  --title "Company Holiday" \
  --start "2026-04-10" \
  --all-day

5. Update and delete events

# Update event title and time
nylas calendar events update event_abc123 \
  --title "Sprint Planning (Moved)" \
  --start "2026-04-01 11:00" \
  --end "2026-04-01 12:00"

# Add a participant to an existing event
nylas calendar events update event_abc123 \
  --participant carol@company.com

# Delete an event
nylas calendar events delete event_abc123

6. Check availability

See your free/busy slots without opening a browser. This queries your Google Calendar's actual availability data.

# Check your availability
nylas calendar availability check

# Specify a date range
nylas calendar availability check \
  --start "2026-04-01" \
  --end "2026-04-05"

7. Find mutual free times

When you need to schedule across multiple people, find-time queries everyone's calendars and returns overlapping free slots.

# Find 30-minute slot with two participants
nylas calendar find-time \
  --participants alice@company.com,bob@company.com \
  --duration 30m

# Find 1-hour slot within specific days
nylas calendar find-time \
  --participants alice@company.com,bob@company.com \
  --duration 1h \
  --start "2026-04-01" \
  --end "2026-04-05"

8. JSON output for scripting

Every command supports --json for machine-readable output. Pipe it through jq for filtering and transformation.

# Get all events as JSON
nylas calendar events list --json

# Extract event titles with jq
nylas calendar events list --json | jq '.[].title'

# Count events per day this week
nylas calendar events list --days 7 --json | \
  jq 'group_by(.when.start_date) | map({date: .[0].when.start_date, count: length})'

# Check if a specific time slot is free
nylas calendar availability check --json | \
  jq '.time_slots[] | select(.status == "free")'

Google Calendar API vs Nylas CLI

Here's what each approach requires to list your next 10 Google Calendar events:

TaskGoogle Calendar APINylas CLI
Initial setupGCP project + OAuth consent screen + credentials (15-30 min)brew install nylas/nylas-cli/nylas (30 sec)
AuthenticationWrite OAuth2 token exchange code, handle refresh tokensnylas auth login
List eventsWrite Python/Node.js script with calendar.events().list()nylas calendar events list
Check availabilityfreebusy.query() with time ranges and calendar IDsnylas calendar availability check
Multi-provider supportGoogle only. Separate Microsoft Graph SDK for Outlook.Google, Outlook, Exchange, Yahoo, iCloud, IMAP
Token managementManual refresh token handling and storageAutomatic
Lines of code40-80 lines (Python) for basic CRUD0 lines. CLI commands only.

Google Calendar-specific tips

Color labels

Google Calendar assigns numeric color IDs (1-11) to events. When you list events with --json, the color_id field maps to Google's color palette. Use this to filter events by category in scripts:

# List events with a specific color (e.g., "Tomato" = color_id 11)
nylas calendar events list --json | \
  jq '.[] | select(.metadata.color_id == "11") | .title'

Recurring events

Google Calendar uses RRULE (RFC 5545) patterns for recurring events. When you create a recurring event through Nylas CLI, each occurrence appears as a separate event in the list output. The master_event_id field links occurrences back to the original:

# List events and filter for a recurring series
nylas calendar events list --json | \
  jq '.[] | select(.master_event_id == "event_abc123") | {title, start: .when.start_time}'

Google Meet links

Events created with participants through a Google Calendar grant automatically include conferencing details. Check the conferencing field in JSON output:

# Find events with Google Meet links
nylas calendar events list --json | \
  jq '.[] | select(.conferencing != null) | {title, meet: .conferencing.details.url}'

Next steps