Hello Google Workspace Developer Team and Community,
We are developing an email management iOS application using a Node.js backend that integrates with the Gmail REST API (v1).
Our Current Architecture:
-
Initial Sync: We use
users.messages.list(5 units) paginated at 300 messages per page, followed byusers.messages.get(format: "metadata",metadataHeaders: ["From"], 20 units per call) to aggregate sender counts and store message IDs in our database. -
Incremental Sync: Once the initial sync completes, we store the user’s
historyIdviausers.getProfile(1 unit) and useusers.history.list(2 units) along with database pre-filtering so we never callmessages.geton previously synced message IDs.
Our Questions Regarding Rate Limits & Billing: According to the official Gmail API Usage Limits documentation, the Per minute per user per project limit is 6,000 quota units, and messages.get consumes 20 quota units per request. During a user’s initial sync, fetching metadata for 300 messages consumes 300 × 20 = 6,000 units, reaching the per-user per-minute ceiling in a single page request.
Could you please clarify:
-
Impact of Cloud Billing on Per-User Limits: Does enabling a Google Cloud Billing account or requesting a quota adjustment in the GCP Console allow increasing the 6,000 quota units/minute/user limit, or does billing/quota adjustment only apply to the project-wide limit (1,200,000 units/minute/project) and the 80,000,000 units/day billing threshold?
-
Recommended Best Practice for Initial Bulk Metadata Sync: Beyond throttling concurrency, implementing exponential backoff, and using
users.history.listfor subsequent syncs, is there an officially recommended pattern to fetchFromheaders across thousands of existing messages during a user’s first login without hitting the 6,000 units/min per-user limit?
Environment Details:
-
Backend: Node.js (
googleapisnpm package, Gmail API v1) -
OAuth Scopes:
gmail.readonly,gmail.modify,gmail.settings.basic
Thank you in advance for your guidance!