domainwidedelegation.comGet it set up

Scope reference for domain-wide delegation

Scopes are the entire security model here. The grant is a pairing of one client ID with an exact list of these strings — so the list you choose is the blast radius you accept.

Choose narrow, and choose once. Every scope you authorize applies to every user in the domain, silently. Adding one later means editing the grant in every tenant, so it is worth thinking through the full list before the first grant rather than bolting scopes on as features ship.

Gmail

mail.google.com is full access and supersedes the granular ones. Prefer the narrow scopes unless you genuinely need everything.

ScopeGrants
https://www.googleapis.com/auth/gmail.readonlyRead mail and settings. No send, no modify.
https://www.googleapis.com/auth/gmail.sendSend only. Cannot read the mailbox.
https://www.googleapis.com/auth/gmail.composeCreate and manage drafts.
https://www.googleapis.com/auth/gmail.modifyRead, modify, label. No permanent delete.
https://www.googleapis.com/auth/gmail.settings.basicSignatures, filters, forwarding, send-as.
https://mail.google.com/Everything, including permanent delete.

Drive

drive.file only sees files your app created — a frequent surprise when a script cannot find an existing document.

ScopeGrants
https://www.googleapis.com/auth/driveFull access to the impersonated user's Drive.
https://www.googleapis.com/auth/drive.readonlyRead everything they can see.
https://www.googleapis.com/auth/drive.fileOnly files created or opened by your app.

Calendar, Sheets, Docs

Straightforward. Read-only variants exist for each and are usually enough for reporting.

ScopeGrants
https://www.googleapis.com/auth/calendarFull calendar access.
https://www.googleapis.com/auth/calendar.readonlyRead events and calendars.
https://www.googleapis.com/auth/spreadsheetsRead and write Sheets.
https://www.googleapis.com/auth/documentsRead and write Docs.

Admin SDK — the ones people forget

Directory scopes are authorized separately and are the most common cause of a delegation that 'suddenly' stops working when new code lands.

ScopeGrants
https://www.googleapis.com/auth/admin.directory.userCreate, read, update users.
https://www.googleapis.com/auth/admin.directory.user.readonlyRead the user directory.
https://www.googleapis.com/auth/admin.directory.user.securityList and revoke a user's OAuth app tokens.
https://www.googleapis.com/auth/admin.directory.groupManage groups and membership.
https://www.googleapis.com/auth/admin.reports.audit.readonlyRead audit and usage reports.

Three traps

Read-only is not a subset at grant time

Authorizing drive does not authorize drive.readonly as far as the grant is concerned. If your code requests the read-only string, that exact string must be in the list.

Trailing characters matter

https://mail.google.com/ carries a trailing slash. Copy scopes; do not retype them.

Requesting more than you need fails louder than you expect

Because one unauthorized scope rejects the whole token request, a hopeful extra scope in your code breaks APIs that were working fine. Request exactly what the job needs.

Not sure which scopes your project needs?

Getting the list right the first time avoids re-opening the Admin console in every tenant later. We plan and implement scope sets as part of setup — $500 per hour.

Plan your scope list