Use the Cloud Firestore REST API

While the easiest way to use Cloud Firestore is to use one of the native client libraries, there are some situations when it is useful to call the REST API directly.

The REST API can be helpful for the following use cases:

  • Accessing Cloud Firestore from a resource-constrained environment, such as an internet of things (IoT) device, where running a complete client library is not possible.
  • Automating database administration or retrieving detailed database metadata.

If you are using a gRPC-supported language, consider using the RPC API rather than the REST API.


You can generate an access_token for the Cloud Firestore REST API by using a service account with a Google API Client Library or by manually following the steps in Using OAuth 2.0 for Server to Server Applications.

This token must have the following scope, which will grant it full read/write access to Cloud Firestore:


After you obtain this token, pass it to the Cloud Firestore endpoints as an Authorization header set to Bearer {YOUR_TOKEN}.

Making REST calls

All REST API endpoints exist under the base URL

To create a path to a document with the ID LA in the collection cities under the project YOUR_PROJECT_ID you would use the following structure.


To interact with this path, combine it with the base API URL.

The best way to begin experimenting with the REST API is to use the API Explorer, which will automatically generate tokens and allow you to easily examine the API.


Below are brief descriptions of the two most important method groups. For a complete list, see the REST API reference or use the API Explorer.


Perform CRUD operations on documents, similar to those outlined in the add data or get data guides.


Perform actions on indexes such as creating new indexes, disabling an existing index, or listing all current indexes. Useful for automating data structure migrations or synchronizing indexes between projects.

Also enables retrieval of document metadata, such as the list of all fields and subcollections for a given document.

Send feedback about...

Need help? Visit our support page.