Skip to main content
Technical Preview

Overview

Firebase has two databases with different REST APIs and different hosts, so this package ships two connectors that you can deploy together or on their own:
  • FirebaseRealtimeDatabaseRestApi talks to the Realtime Database REST API on https://<database>.firebaseio.com. Any path plus .json is an endpoint, and plain JSON goes in and out.
  • CloudFirestoreRestApi talks to the Cloud Firestore REST API on https://firestore.googleapis.com. Documents use Firestore typed values.

Realtime Database events

Topics use data/firebase/rtdb/<object>/<verb>.

Cloud Firestore events

Topics use data/firebase/firestore/<object>/<verb>. Replies for both connectors arrive on <topic>/response.

Auth

Both connectors send Authorization: Bearer {value.json.access_token}. Mint the token outside the connector (a Python action, edge service, or SDK) and keep the service account key or token in Hub secrets, for example FIREBASE_ACCESS_TOKEN. Never commit keys.
  • Realtime Database: a Google OAuth2 access token from a service account with scopes https://www.googleapis.com/auth/userinfo.email and https://www.googleapis.com/auth/firebase.database. The API also accepts the token as ?access_token=, and a Firebase Auth ID token as ?auth=<ID_TOKEN>; edit the endpoints if you use those. See Authenticate REST requests.
  • Cloud Firestore: a Google OAuth2 access token for a service account with a Datastore role such as roles/datastore.user (scope https://www.googleapis.com/auth/datastore or cloud-platform). Service account tokens bypass security rules. A Firebase Auth ID token also works and is checked against your rules.
Access tokens expire after about an hour, so refresh them before they lapse.

Basic Syntax

Realtime Database

Cloud Firestore

Set BASE_ADDRESS on the Realtime Database connector to your instance URL: https://<database>-default-rtdb.firebaseio.com for US instances, or https://<database>-default-rtdb.<region>.firebasedatabase.app elsewhere. The Firestore connector targets the (default) database; edit the endpoints for a named database.

Payload examples

Realtime Database

Set device state, with a server-side timestamp, on data/firebase/rtdb/state/set:
Append an event on data/firebase/rtdb/event/append:
Merge one field on data/firebase/rtdb/fields/update:
Latest two events by ts on data/firebase/rtdb/path/query (order_by is URL-encoded and quoted, here "ts"):
Ordering by a child needs an index rule such as ".indexOn": ["ts"]; ordering by %22%24key%22 ("$key") needs none.

Cloud Firestore

Upsert a device document on data/firebase/firestore/document/upsert:
Merge two fields on data/firebase/firestore/document/merge:
Create an event document on data/firebase/firestore/document/create:
Query events for one device on data/firebase/firestore/documents/query:
Firestore integers are strings ("integerValue": "42"), and timestamps are RFC 3339 (timestampValue).

Errors and limits

  • Realtime Database: 401 {"error":"Permission denied"} means a missing or bad token or a rules denial. 404 {"error":"404 Not Found"} usually means the BASE_ADDRESS instance URL is wrong. Add print=silent to write endpoints to get 204 No Content instead of the echoed data.
  • Cloud Firestore: 401 UNAUTHENTICATED (bad or expired token), 403 PERMISSION_DENIED (missing role, rules, or API not enabled on the project), 404 NOT_FOUND, 400 INVALID_ARGUMENT (bad typed value or mask). MergeFields needs a non-empty update_mask; send an upsert instead if you want to replace the whole document.
  • Firestore writes to a single document are limited to about one per second sustained; spread high-rate telemetry across documents or use the Realtime Database.
  • Realtime Database streaming (Server-Sent Events) is not covered by these client connectors.

Testing

Tested on 2026-10-05 (PT):
  • Firebase Local Emulator Suite (firebase-tools, Realtime Database and Firestore emulators): all 11 connector events returned 200 with the exact methods, endpoints, headers and bodies the connectors send, and requests without a token were rejected by security rules (401 and 403).
  • Real Realtime Database: GET on a public Firebase instance returned 200 for path reads and orderBy/limitToFirst queries; PUT, POST and PATCH without credentials returned 401 Permission denied.
  • Real Firestore: requests reached firestore.googleapis.com and returned 401 UNAUTHENTICATED for an invalid token.
Not yet tested: a real Firebase project with a service account token, and an MQTT round-trip through a deployed broker connector.
Last modified on October 21, 2026