domainwidedelegation.comStart free

Use cases → Reporting and data

Report mailbox usage for all users via delegation

Aggregate mailbox sizes and activity across every user in a domain by impersonating them with a service account, avoiding manual exports or per-user scripts.

Who it is forIT administrators and operations teams responsible for monitoring mailbox growth and usage trends across a Workspace domain.
APIsGmail API
Typical scopesgmail.readonly

The problem

Understanding mailbox utilisation across hundreds or thousands of users is painful. The Admin console shows only rough totals, and per-user inspection is manual and slow. Automated scripts are needed for actionable, up-to-date data.

How it works

  1. Use a service account with domain-wide delegation to impersonate each user.
  2. Fetch mailbox size and message counts via the Gmail API's users.getProfile and users.messages.list endpoints.
  3. Aggregate the data centrally for analysis and alerting.
  4. Schedule regular runs to track trends over time.

What changes

Mailbox usage data becomes available in a structured, exportable format, making it possible to spot growth, anomalies, or dormant accounts before they become operational issues.

The trap in this one. The Gmail API's reported mailbox size (users.getProfile.threadsTotal or messagesTotal) lags behind actual usage, especially just after large imports or mass deletions. If you run your reporting job immediately after major migrations or cleanups, you will under- or over-report mailbox sizes for hours. Schedule reporting to avoid these windows or accept that the numbers may be stale until Google's background jobs catch up.

Questions people ask

Can I get exact storage usage per label or folder?

No, the Gmail API only exposes overall message and thread counts per user, not storage size breakdowns by label.

Does this require individual user consent?

No, with domain-wide delegation properly configured, user consent is not needed for reporting mailbox metadata.

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.

Reconcile records between two systems automatically

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

Work out which sources actually produce customers

Join enquiry records to outcomes so spend goes where the revenue is.