Join us in person and online for Firebase Summit on October 18, 2022. Learn how Firebase can help you accelerate app development, release your app with confidence, and scale with ease. Register now

Managing Firebase Realtime Database Rules via REST

Stay organized with collections Save and categorize content based on your preferences.

This document explains how you can manage your app's Firebase Realtime Database Rules through the REST API.

Updating Firebase Realtime Database Rules

Using the REST API, you can write and update Firebase Realtime Database Rules for your Firebase app by making a PUT request to the /.settings/rules.json path. To do this, we'll need an access token to authenticate our REST request

In this example, we enable read access for all data in our Firebase database:

curl -X PUT -d '{ "rules": { ".read": true } }' 'https://docs-examples.firebaseio.com/.settings/rules.json?access_token=<ACCESS_TOKEN>'

Retrieving Firebase Realtime Database Rules

Similarly, we can make a GET request to the /.settings/rules.json path of our app's URL to retrieve our Firebase Realtime Database Rules:

curl 'https://docs-examples.firebaseio.com/.settings/rules.json?access_token=<ACCESS_TOKEN>'

The response will contain all of the rules for our app.