domainwidedelegation.comGet it set up

Use casesReporting and data

Reconciling calendar bookings with invoices using domain-wide delegation

Accurately match Google Calendar bookings to invoiced services across all users with domain-wide delegation, and avoid missing cancellations or updates that lead to financial errors.

Who it is forFinance operations engineers or automation teams responsible for billing reconciliation in Google Workspace environments.
APIsCalendar API
Typical scopescalendar

The problem

Reconciling calendar bookings with invoiced services is critical in environments where bookings drive revenue or resource allocation. Relying on manual exports or single-user API access misses events across the wider tenant, especially when bookings are made on behalf of others or through shared calendars. Inaccurate reconciliation can result in overbilling, underbilling, or missed revenue, and manual checks do not scale.

How it works

  1. Provision a service account with domain-wide delegation and grant it the 'calendar' scope for all users.
  2. Use the Calendar API’s 'events.list' endpoint with 'showDeleted=true' and 'singleEvents=true' to obtain all events within the billing period, across all relevant calendars.
  3. Implement incremental sync by storing and supplying the 'syncToken' parameter from previous runs, letting you fetch only changes (including deletions and updates) since the last reconciliation.
  4. Track each event by its unique event ID, and record its status (confirmed, cancelled) and last modification timestamp.
  5. Compare this canonical calendar event list to your invoicing system, flagging discrepancies where event IDs are missing, cancelled, or modified after invoices were raised, and generate a detailed report for review.

What changes

You achieve reliable, tenant-wide matching of bookings to invoices, catching late cancellations or modifications that would otherwise be missed. This reduces financial errors and supports accurate client billing or resource allocation.

The trap in this one. Calendar events deleted or modified after initial export are not surfaced by the Calendar API’s default sync unless you track event IDs and their status (cancelled, updated). If your script relies on time window queries alone, you will silently miss cancellations—leading to invoices for bookings that no longer exist, and missed refunds. This is particularly problematic when running under domain-wide delegation, as changes may originate from any calendar in the tenant, and the 'syncToken' is required per calendar resource; missing or mishandling it results in incomplete or inconsistent reconciliation.

Watch it explained

Create Google API Key (2024) || Google Cloud Platform *NEW*” — Code & Code on YouTube. Third-party video, included because it covers this ground well. We are not affiliated with the channel.

Questions people ask

Can I use a single syncToken for all calendars?

No, each calendar resource requires its own syncToken. You must persist and manage syncTokens per calendar when operating at scale via domain-wide delegation.

What happens if a syncToken expires or is lost?

If a syncToken is lost or becomes invalid (e.g., after too many missed changes), you must perform a full sync by querying all events without a syncToken and then storing the new one for future incremental updates.

How do I detect if an event was cancelled versus deleted?

The Calendar API marks cancelled events with status 'cancelled' and retains their event IDs if you use 'showDeleted=true'. True deletions without trace are rare but possible if the organiser purges the event; always check both status and existence.

Want this built?

This is a pattern we run in production. We will set up the delegation and build this on top of it — $500 per hour, most of it working the same day.

Talk to us Or read the setup guide

Related use cases

Send a daily digest that catches problems early

One scheduled email that checks the things that fail quietly and reports only what changed.

Run automation from a spreadsheet non-engineers can edit

Keep rules, templates and routing in a Sheet so the operations team changes behaviour without a deploy.

Reconcile records between two systems automatically

Compare what your tracking sheet says against what the source system says, and report the differences.