Google Firebase Data API

Operations for reading and writing database nodes

OpenAPI Specification

google-firebase-data-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Google Firebase Firebase Cloud Messaging API (FCM) Data API
  description: The Firebase Cloud Messaging HTTP v1 API enables sending notification and data messages to client apps on Android, iOS, and the web. It supports per-platform message customization, topic messaging, and condition-based targeting.
  version: v1
  contact:
    name: Google Firebase Support
    url: https://firebase.google.com/support
  termsOfService: https://firebase.google.com/terms
servers:
- url: https://fcm.googleapis.com/v1
  description: FCM HTTP v1 API Server
security:
- oauth2: []
tags:
- name: Data
  description: Operations for reading and writing database nodes
paths:
  /{path}.json:
    get:
      operationId: getData
      summary: Google Firebase Read data
      description: Reads data at the specified database path. Returns the JSON data stored at the given location in the database tree.
      tags:
      - Data
      parameters:
      - $ref: '#/components/parameters/path'
      - name: auth
        in: query
        description: Firebase ID token or database secret for authentication
        schema:
          type: string
      - name: orderBy
        in: query
        description: The child key or priority to order results by
        schema:
          type: string
      - name: limitToFirst
        in: query
        description: Limit the number of results returned from the beginning
        schema:
          type: integer
      - name: limitToLast
        in: query
        description: Limit the number of results returned from the end
        schema:
          type: integer
      - name: startAt
        in: query
        description: Return items starting at the specified value
        schema:
          type: string
      - name: endAt
        in: query
        description: Return items ending at the specified value
        schema:
          type: string
      - name: equalTo
        in: query
        description: Return items equal to the specified value
        schema:
          type: string
      - name: shallow
        in: query
        description: Return only the keys at the location (no nested data)
        schema:
          type: boolean
      responses:
        '200':
          description: Successful response with data at the path
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DatabaseNode'
        '401':
          description: Unauthorized
        '404':
          description: Path not found
    put:
      operationId: setData
      summary: Google Firebase Write data
      description: Writes data to the specified database path, replacing any existing data at that location.
      tags:
      - Data
      parameters:
      - $ref: '#/components/parameters/path'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DatabaseNode'
      responses:
        '200':
          description: Data written successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DatabaseNode'
        '401':
          description: Unauthorized
    patch:
      operationId: updateData
      summary: Google Firebase Update data
      description: Updates specific children at the specified path without overwriting the entire node. This performs a multi-path update.
      tags:
      - Data
      parameters:
      - $ref: '#/components/parameters/path'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
      responses:
        '200':
          description: Data updated successfully
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '401':
          description: Unauthorized
    post:
      operationId: pushData
      summary: Google Firebase Push data
      description: Pushes data to the specified path with an auto-generated unique key. Equivalent to using push() in the Firebase SDK.
      tags:
      - Data
      parameters:
      - $ref: '#/components/parameters/path'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DatabaseNode'
      responses:
        '200':
          description: Data pushed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  name:
                    type: string
                    description: The auto-generated key for the new child
        '401':
          description: Unauthorized
    delete:
      operationId: deleteData
      summary: Google Firebase Delete data
      description: Removes data at the specified database path.
      tags:
      - Data
      parameters:
      - $ref: '#/components/parameters/path'
      responses:
        '200':
          description: Data deleted successfully
        '401':
          description: Unauthorized
components:
  parameters:
    path:
      name: path
      in: path
      required: true
      description: The database path to the data node
      schema:
        type: string
  schemas:
    DatabaseNode:
      description: A node in the Firebase Realtime Database. Can be a primitive value, an object, or an array represented as JSON.
      oneOf:
      - type: string
      - type: number
      - type: boolean
      - type: object
        additionalProperties: true
      - type: array
        items: {}
      - type: 'null'
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://accounts.google.com/o/oauth2/auth
          tokenUrl: https://oauth2.googleapis.com/token
          scopes:
            https://www.googleapis.com/auth/firebase.messaging: Send FCM messages
externalDocs:
  description: FCM HTTP v1 API Reference
  url: https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages