Skip to content
Software capabilities
Google Calendar

Recover an expired Google Calendar sync token

Send the stored nextSyncToken as syncToken on the next events.list request. If that request returns 410 Gone, discard the stale token and rebuild the local copy from a full sync.

Documentation reviewed · 3 methods with sources

Ways to do it

  1. API: GET /calendar/v3/calendars/{calendarId}/events
  2. API: Full sync after HTTP 410
  3. SDK: calendar.events().list()
API

GET /calendar/v3/calendars/{calendarId}/events

Keep the same syncToken and query parameters while using each nextPageToken as pageToken. Save the nextSyncToken from the last page.

Read source: Calendar events.list reference
Requirements
An OAuth token with calendar.events.readonly or another allowed scope, a readable calendar, and a nextSyncToken from the last sync.
Limitations
Omit incompatible filters such as timeMin, timeMax, and q. Incremental responses include deleted events so you can update the local copy.

Example shell

curl --fail --get 'https://www.googleapis.com/calendar/v3/calendars/primary/events' -H "Authorization: Bearer $GOOGLE_ACCESS_TOKEN" --data-urlencode "syncToken=$CALENDAR_SYNC_TOKEN" --data-urlencode 'singleEvents=true'
API

Full sync after HTTP 410

Discard the stale local copy and repeat the full events.list sequence without syncToken.

Read source: Calendar synchronize resources guide
Requirements
The same Calendar OAuth credentials and a durable local event store.
Limitations
Calendar returns nextSyncToken on the final page. Save it after applying the rebuilt event state.

Example shell

curl --fail --get 'https://www.googleapis.com/calendar/v3/calendars/primary/events' -H "Authorization: Bearer $GOOGLE_ACCESS_TOKEN" --data-urlencode 'singleEvents=true'
SDK

calendar.events().list()

Use the Python client with an authenticated Calendar service to request the first page of an incremental sync.

Read source: Calendar Python client events.list
Requirements
An authenticated Calendar API service from google-api-python-client and a saved nextSyncToken.
Limitations
Treat HTTP 410 from this sync request as a request to rebuild. Fetch every page before storing the new nextSyncToken.

Example text

page = calendar.events().list(
    calendarId="primary", syncToken=saved_sync_token, singleEvents=True
).execute()