Remove someone’s access
unshare_docRevoke a person's, group's, or link-based access grant on a Google Doc after verifying the current role, preventing accidental and unrecoverable permission removal.
Instructions
Revoke a grant on a Google Doc. Pass email for a person or a group. A grant with no email — a domain-wide grant, or anyone-with-link — has no email to pass, so address it by permissionId from list_permissions (run that first; it also tells you the role you are about to remove). Refuses to touch the owner. expectRole is REQUIRED — run list_permissions first and echo the role back; a permission change is recorded nowhere and cannot be restored from version history, so this is the only thing standing between a misaimed call and a silent, unrecoverable revocation. Note a doc created under a Workspace domain may carry a domain grant nobody explicitly added.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| No | person or group to revoke; omit when using permissionId | ||
| account | No | Google account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account. | |
| documentId | Yes | ||
| expectRole | Yes | REQUIRED — the grant's current role as list_permissions reported it (reader/commenter/writer). Verified first: if it changed since you looked, nothing is removed. Revoking leaves no record anywhere, so this makes you look before you cut. | |
| expectTitle | No | the doc’s title; verified before revoking so a wrong id is refused | |
| permissionId | No | id from list_permissions — the only way to revoke a domain or anyone-with-link grant |