5 minute quickstart

REST Quickstart

Build mobile and web apps in minutes using any Firebase database URL as a REST endpoint. Save time. Delight your users.

Create an account

The first thing you need to do to get started with Firebase is sign up for a free account. A brand new Firebase app will automatically be created for you with its own unique database URL ending in firebaseio.com. We'll use this database URL to store and sync data.

Save & Retrieve Data

We can use any Firebase database URL as a REST endpoint by appending .json to the end of the URL, and sending standard HTTPS requests. In this guide we'll use cURL for all of our examples.

The basic write operation through the REST API is PUT. To write data to a Firebase reference with a PUT request, we can do the following:

curl -X PUT -d '{ "alanisawesome": { "name": "Alan Turing", "birthday": "June 23, 1912" } }' 'https://docs-examples.firebaseio.com/rest/quickstart/users.json'
HTTPS is required. The Firebase database only responds to encrypted traffic so that your data remains safe.

A successful request will be indicated by a 200 OK HTTP status code, and the response will contain the data we wrote to the Firebase database:

{
  "alanisawesome": {
    "birthday": "June 23, 1912",
    "name": "Alan Turing"
  }
}

We can issue an HTTP GET request to the same endpoint to read the data we saved:

curl 'https://docs-examples.firebaseio.com/rest/quickstart/users.json'

Use a Client Library

Interacting with the REST API is possible from every language and platform that supports HTTPS. There are several third-party libraries that can make interaction with the REST API even easier:

Language Libraries
Clojure talka by Cloudfuji
Go Go Firebase by Cosmin Nicolaescu and Justin Tulloss
Go Firego by Steven Berlanga and Tim Gossett
Java firebase4j by Brandon Gresham
Perl Firebase-Perl by Kiran Kumar and JT Smith
PHP firebase-php by Tamas Kalman
Python python-firebase by Özgür Vatansever
python-firebase by Michael Huynh
Ruby firebase-ruby by Oscar Del Ben
BigBertha by Fernand Galiana
rest-firebase by Codementor

Add User Authorization and Security

Firebase gives you full control over user authentication by allowing you to authenticate users using secure JSON Web Tokens, or JWTs. We provide helper libraries in several languages for generating JWTs:

Language
Go (Unofficial)
Java
.NET
Node.js
Perl (Unofficial)
PHP
Python
Ruby

Firebase JWTs should always be generated on a trusted server so that the Firebase Secret can be kept private. In the Authorization document of our REST guide we explain how to generate a secure token.

Now that you know the basics of the REST API, check out the guide to dive into the details.