Identity and Access Management (IAM)

Manage access to your resources with Identity and Access Management (IAM).IAM lets you give more granular access to specificGoogle Cloudresources and prevents unwanted access to other resources. Thispage describes the IAM permissions and roles forCloud Firestore. For a detailed description of IAM, read theIAM documentation.

IAM lets you adopt thesecurity principle of least privilege,so you grant only the necessary access to your resources.

IAM lets you controlwho (user) haswhat (role)permission forwhich resources by setting IAM policies.IAM policies grant one or more roles to a user, giving theuser certain permissions. For example, you can grant thedatastore.indexAdminrole to a user, which allows the user to create, modify, delete, list, or viewindexes.

Permissions and roles

This section summarizes the permissions and roles thatCloud Firestoresupports.

Note: SomeCloud Firestore permissions differ from the standardIAM model permissions. For example, in the IAMmodel, thedatastore.databases.getpermission lets you return a database object while, inCloud Firestore,datastore.databases.get lets you begin orroll back a transaction. To retrieve a database object's information, use thedatastore.databases.getMetadata permission.

Required permissions for API methods

The following table lists the permissions that the caller must have to performeach action:

MethodRequired permissions
projects.databases.MongoDBCompatible
ListDatabasesdatastore.databases.getMetadata
ListIndexesdatastore.indexes.list
Finddatastore.entities.get
datastore.entities.list
Aggregatedatastore.entities.get
datastore.entities.list
GetMore

The same permissions that were required by the call that created the cursor.

ListCollectionsdatastore.entities.list
Countdatastore.entities.list
Distinctdatastore.entities.get
datastore.entities.list
CommitTransactiondatastore.databases.get
AbortTransactiondatastore.databases.get
EndSessionsdatastore.databases.get
KillCursorsdatastore.databases.get
Insertdatastore.entities.create
Updatedatastore.entities.get
datastore.entities.list
datastore.entities.update
datastore.entities.create (for upsert only)
FindAndModifydatastore.entities.get
datastore.entities.list
datastore.entities.update (for replace or update only)
datastore.entities.create (for upsert only)
datastore.entities.delete (for delete only)
CreateCollectiondatastore.entities.create
projects.databases.indexes
createdatastore.indexes.create
deletedatastore.indexes.delete
getdatastore.indexes.get
listdatastore.indexes.list
projects.databases
createdatastore.databases.create
deletedatastore.databases.delete
getdatastore.databases.getMetadata
listdatastore.databases.list
patchdatastore.databases.update
restoredatastore.backups.restoreDatabase
clonedatastore.databases.cloneClone a database.

If yourclone request contains atags value, then the following additional permissions are required:

  • datastore.databases.createTagBinding

If you would like to verify whether the tag bindings are set successfully by listing the bindings, then the following additional permissions are required:

  • datastore.databases.listTagBindings
  • datastore.databases.listEffectiveTags
projects.locations
getdatastore.locations.get
listdatastore.locations.list
projects.databases.backupschedules
getdatastore.backupSchedules.get
listdatastore.backupSchedules.list
createdatastore.backupSchedules.create
updatedatastore.backupSchedules.update
deletedatastore.backupSchedules.delete
projects.locations.backups
getdatastore.backups.get
listdatastore.backups.list
deletedatastore.backups.delete
projects.databases.usercreds
getdatastore.userCreds.get
listdatastore.userCreds.list
createdatastore.userCreds.create
enabledatastore.userCreds.update
disabledatastore.userCreds.update
resetPassworddatastore.userCreds.update
deletedatastore.userCreds.delete

Predefined roles

With IAM, every API method inCloud Firestorerequires that the account making the API request has the appropriate permissionsto use the resource. Permissions are granted by setting policies that grantroles to a user, group, or service account. In addition to the primitive roles,owner, editor, and viewer,you can grantCloud Firestore roles to the users of your project.

The following table lists theCloud Firestore IAMroles. You can grant multiple roles to a user, group, or service account.

RolePermissionsDescription
roles/datastore.ownerappengine.applications.get

datastore.*

resourcemanager.projects.get
resourcemanager.projects.list
Full access toCloud Firestore.
roles/datastore.userappengine.applications.get

datastore.databases.get
datastore.databases.getMetadata
datastore.databases.list
datastore.entities.*
datastore.indexes.list
datastore.namespaces.get
datastore.namespaces.list
datastore.statistics.get
datastore.statistics.list

resourcemanager.projects.get
resourcemanager.projects.list
Read/write access to data in aCloud Firestore database. Intended for application developers and service accounts.
roles/datastore.viewerappengine.applications.get

datastore.databases.get
datastore.databases.getMetadata
datastore.databases.list
datastore.entities.get
datastore.entities.list
datastore.indexes.get
datastore.indexes.list
datastore.namespaces.get
datastore.namespaces.list
datastore.statistics.get
datastore.statistics.list

resourcemanager.projects.get
resourcemanager.projects.list
Read access to allCloud Firestore resources.
roles/datastore.indexAdminappengine.applications.get

datastore.databases.getMetadata

datastore.indexes.*

datastore.operations.list
datastore.operations.get
resourcemanager.projects.get
resourcemanager.projects.list
Full access to manage index definitions.
roles/datastore.backupSchedulesViewerdatastore.backupSchedules.get
datastore.backupSchedules.list
Read access to backup schedules in aCloud Firestore database.
roles/datastore.backupSchedulesAdmindatastore.backupSchedules.get
datastore.backupSchedules.list
datastore.backupSchedules.create
datastore.backupSchedules.update
datastore.backupSchedules.delete
datastore.databases.list
datastore.databases.getMetadata
Full access to backup schedules in aCloud Firestore database.
roles/datastore.backupsViewerdatastore.backups.get
datastore.backups.list
Read access to backup information in aCloud Firestore location.
roles/datastore.backupsAdmindatastore.backups.get
datastore.backups.list
datastore.backups.delete
Full access to backups in aCloud Firestore location.
roles/datastore.restoreAdmindatastore.backups.get
datastore.backups.list
datastore.backups.restoreDatabase
datastore.databases.list
datastore.databases.create
datastore.databases.getMetadata
datastore.operations.list
datastore.operations.get
Ability to restore aCloud Firestore backup into a new database. This role also gives the ability to create new databases, not necessarily by restoring from a backup.
roles/datastore.cloneAdmindatastore.databases.clone
datastore.databases.list
datastore.databases.create
datastore.databases.getMetadata
datastore.operations.list
datastore.operations.get
Ability to clone aCloud Firestore database into a new database. This role also gives the ability to create new databases, not necessarily by cloning.
roles/datastore.statisticsViewerresourcemanager.projects.get
resourcemanager.projects.list
datastore.databases.getMetadata
datastore.insights.get
datastore.keyVisualizerScans.get
datastore.keyVisualizerScans.list
datastore.statistics.list
datastore.statistics.get
Read access to Insights, Stats, and Key Visualizer scans.
roles/datastore.userCredsViewerdatastore.userCreds.get
datastore.userCreds.list
Read access to user credentials in aCloud Firestore database.
roles/datastore.userCredsAdmindatastore.userCreds.get
datastore.userCreds.list
datastore.userCreds.create
datastore.userCreds.update
datastore.userCreds.delete
datastore.databases.list
datastore.databases.getMetadata
Full access to user credentials in aCloud Firestore database.

Custom roles

If the predefined roles do not address your business requirements,you can define your own custom roles with permissions thatyou specify:

Required roles to create and manage tags

If any tag is represented in create or restore actions, some roles are required. SeeCreating and managing tags for more details on creating tag key-value pairs before associate them to the database resources.

The following listed permissions are required.

View tags
  • datastore.databases.listTagBindings
  • datastore.databases.listEffectiveTags
Manage tags on resources

The following permission is required for the database resource you're attaching the tag value.

  • datastore.databases.createTagBinding

Permissions

The following table lists the permissions thatCloud Firestore supports.

Database permission nameDescription
datastore.databases.getBegin or rollback a transaction.
datastore.databases.getMetadataRead metadata from a database.
datastore.databases.listList databases in a project.
datastore.databases.createCreate a database.
datastore.databases.updateUpdate a database.
datastore.databases.deleteDelete a database.
datastore.databases.cloneClone a database.
datastore.databases.createTagBindingCreate a tag binding for a database.
datastore.databases.deleteTagBindingDelete a tag binding for a database.
datastore.databases.listTagBindingsList all tag bindings for a database.
datastore.databases.listEffectiveTagBindingsList effective tag bindings for a database.
Entity permission nameDescription
datastore.entities.createCreate a document.
datastore.entities.deleteDelete a document.
datastore.entities.getRead a document.
datastore.entities.listList the names of documents in a project.
(datastore.entities.get is required to access the document data.)
datastore.entities.updateUpdate a document.
Index permission nameDescription
datastore.indexes.createCreate an index.
datastore.indexes.deleteDelete an index.
datastore.indexes.getRead metadata from an index.
datastore.indexes.listList the indexes in a project.
datastore.indexes.updateUpdate an index.
Operation permission nameDescription
datastore.operations.cancelCancel a long-running operation.
datastore.operations.deleteDelete a long-running operation.
datastore.operations.getGets the latest state of a long-running operation.
datastore.operations.listList long-running operations.
Project permission nameDescription
resourcemanager.projects.getBrowse resources in the project.
resourcemanager.projects.listList owned projects.
Location permission nameDescription
datastore.locations.getGet details about a database location. Required to create a new database.
datastore.locations.listList available database locations. Required to create a new database.
Key Visualizer permission nameDescription
datastore.keyVisualizerScans.getGet details about Key Visualizer scans.
datastore.keyVisualizerScans.listList available Key Visualizer scans.
Backup Schedule permission nameDescription
datastore.backupSchedules.getGet details about a backup schedule.
datastore.backupSchedules.listList available backup schedules.
datastore.backupSchedules.createCreate a backup schedule.
datastore.backupSchedules.updateUpdate a backup schedule.
datastore.backupSchedules.deleteDelete a backup schedule.
Backup permission nameDescription
datastore.backups.getGet details about a backup.
datastore.backups.listList available backups.
datastore.backups.deleteDelete a backup.
datastore.backups.restoreDatabaseRestore a database from a backup.
Insights permission nameDescription
datastore.insights.getGet insights of a resource
User credentials permission nameDescription
datastore.userCreds.getGet details about user credentials.
datastore.userCreds.listList available user credentials.
datastore.userCreds.createCreate user credentials.
datastore.userCreds.updateEnable or disable user credentials, or reset a user password.
datastore.userCreds.deleteDelete user credentials.

Role change latency

Cloud Firestore caches IAM permissions for 5 minutes,so it takes up to 5 minutes for a role change to become effective.

ManagingCloud Firestore IAM

You can get and set IAM policies using the Google Cloud console,the IAM API, or thegcloud command-line tool. SeeGranting, Changing, and Revoking Access to Project Membersfor details.

Configure conditional access permissions

You can useIAM Conditions todefine and enforce conditional access control.

For example, the following condition assigns a principal thedatastore.userrole up until a specified date:

{"role":"roles/datastore.user","members":["user:travis@example.com"],"condition":{"title":"Expires_December_1_2023","description":"Expires on December 1, 2023","expression":"request.time < timestamp('2023-12-01T00:00:00.000Z')"}}

To learn how to define IAM Conditions for temporary access,seeConfigure temporary access.

To learn how to configure IAM Conditions for access to one or moredatabases, seeConfigure database access conditions.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-18 UTC.