Skip to main content
Write data by sending PUT, POST, PATCH, or DELETE requests. The request body is JSON.

Set (PUT)

Replace the data at a path completely. Any existing data at that path is overwritten.
Response (echoes the written data):
PUT to a path that doesn’t exist creates it. PUT to a path that does exist replaces it entirely. Missing fields are deleted, not preserved. To delete a path with PUT, send null as the body. An empty body is an error, for both PUT and POST, so a request that lost its body can’t delete anything.

Push (POST)

Add a new child with an auto-generated key. This is the REST equivalent of push() in the SDKs.
Response:
The name field contains the generated key. Push IDs are chronologically sortable, so later posts sort after earlier ones.
Use POST for append-only data like chat messages, event logs, or queue items where each entry needs a unique key.

Update (PATCH)

Merge data into an existing path. Only the specified keys are modified; everything else is preserved.
This updates Alice’s score and lastSeen without touching name or online.

Multi-path updates

Update multiple locations atomically by using paths as keys in your PATCH body at a higher level:
All four updates happen atomically. Either they all succeed or none do. Multi-path updates are the way to keep denormalized data consistent.

Remove (DELETE)

Delete data at a path.
Returns null on success. Deleting a non-existent path succeeds silently.

Server values

Use {".sv": "timestamp"} to write the server’s current timestamp:
The server replaces {".sv": "timestamp"} with the actual Unix timestamp in milliseconds.

Silent writes

If you don’t need the response body (saving bandwidth), add print=silent:
Returns 204 No Content instead of echoing the written data.

Method override

If your client can’t send PUT, PATCH, or DELETE, send a POST and name the method you want in the X-HTTP-Method-Override header:
You can also use the x-http-method-override query parameter:

Error responses

When a write fails, you get a JSON object with an error field. Some errors also include a message with more detail: