Skip to main content

Projects API

The Projects API allows you to manage Firebase projects connected to FireBackup. You can list, create, update, and delete project connections, as well as manage collections.

Endpoints Overview

MethodEndpointDescription
GET/projectsList all projects
POST/projectsCreate (connect) a project
GET/projects/:idGet project details
PUT/projects/:idUpdate project
DELETE/projects/:idDelete (disconnect) project
GET/projects/:id/collectionsList collections
POST/projects/:id/collections/syncSync collections

List Projects

Retrieve all projects in the current organization.

GET /api/v1/projects
Authorization: Bearer YOUR_TOKEN
X-Organization-Id: YOUR_ORG_ID

Query Parameters:

ParameterTypeDefaultDescription
pageinteger1Page number
limitinteger20Items per page (max 100)
statusstring-Filter by status: connected, disconnected, error
searchstring-Search by name or Firebase project ID

Response:

{
"success": true,
"data": [
{
"id": "proj_abc123",
"name": "Production App",
"firebaseProjectId": "my-firebase-prod",
"status": "connected",
"credentialType": "oauth",
"collectionsCount": 12,
"lastBackupAt": "2024-01-15T10:00:00Z",
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-15T10:00:00Z"
}
],
"meta": {
"page": 1,
"limit": 20,
"total": 5,
"totalPages": 1
}
}

Get Project

Retrieve details of a specific project.

GET /api/v1/projects/:id
Authorization: Bearer YOUR_TOKEN
X-Organization-Id: YOUR_ORG_ID

Path Parameters:

ParameterTypeDescription
idstringProject ID

Response:

{
"success": true,
"data": {
"id": "proj_abc123",
"name": "Production App",
"firebaseProjectId": "my-firebase-prod",
"status": "connected",
"credentialType": "oauth",
"tokenStatus": {
"valid": true,
"expiresAt": "2024-01-15T11:00:00Z",
"scopes": [
"https://www.googleapis.com/auth/datastore",
"https://www.googleapis.com/auth/firebase"
]
},
"settings": {
"defaultStorageId": "storage_xyz789",
"compression": "brotli",
"encryption": true,
"includeAuth": false
},
"collections": [
{ "name": "users", "documentCount": 15000 },
{ "name": "orders", "documentCount": 45000 }
],
"statistics": {
"totalBackups": 42,
"totalSize": 1250000000,
"lastBackupAt": "2024-01-15T10:00:00Z",
"lastBackupStatus": "completed"
},
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-15T10:00:00Z"
}
}

Create Project

Connect a new Firebase project to FireBackup.

POST /api/v1/projects
Authorization: Bearer YOUR_TOKEN
X-Organization-Id: YOUR_ORG_ID
Content-Type: application/json

{
"firebaseProjectId": "my-firebase-prod",
"name": "Production App",
"credentials": {
"type": "oauth",
"accessToken": "ya29.xxx...",
"refreshToken": "1//xxx..."
},
"settings": {
"defaultStorageId": "storage_xyz789",
"compression": "brotli",
"encryption": true,
"includeAuth": false
}
}

Request Body:

FieldTypeRequiredDescription
firebaseProjectIdstringYesFirebase project ID
namestringNoDisplay name (defaults to Firebase project name)
credentials.typestringYesoauth or service_account
credentials.accessTokenstringConditionalOAuth access token
credentials.refreshTokenstringConditionalOAuth refresh token
credentials.serviceAccountJsonobjectConditionalService account JSON
settings.defaultStorageIdstringNoDefault storage destination
settings.compressionstringNobrotli or gzip
settings.encryptionbooleanNoEnable encryption (default: true)
settings.includeAuthbooleanNoInclude Auth users in backups

Response:

{
"success": true,
"data": {
"id": "proj_abc123",
"name": "Production App",
"firebaseProjectId": "my-firebase-prod",
"status": "connected",
"createdAt": "2024-01-15T10:00:00Z"
}
}

Update Project

Update project settings or credentials.

PUT /api/v1/projects/:id
Authorization: Bearer YOUR_TOKEN
X-Organization-Id: YOUR_ORG_ID
Content-Type: application/json

{
"name": "Production App (Updated)",
"settings": {
"defaultStorageId": "storage_new456",
"compression": "gzip",
"encryption": true,
"includeAuth": true
}
}

Request Body:

FieldTypeDescription
namestringDisplay name
credentialsobjectNew credentials (triggers re-verification)
settingsobjectProject settings

Response:

{
"success": true,
"data": {
"id": "proj_abc123",
"name": "Production App (Updated)",
"status": "connected",
"updatedAt": "2024-01-15T11:00:00Z"
}
}

Delete Project

Disconnect a project from FireBackup.

DELETE /api/v1/projects/:id
Authorization: Bearer YOUR_TOKEN
X-Organization-Id: YOUR_ORG_ID

Query Parameters:

ParameterTypeDefaultDescription
deleteBackupsbooleanfalseAlso delete all backups

Response:

{
"success": true,
"message": "Project disconnected successfully"
}
Backup Retention

By default, backups are retained when disconnecting a project. Use deleteBackups=true to remove them.

List Collections

Get all Firestore collections for a project.

GET /api/v1/projects/:id/collections
Authorization: Bearer YOUR_TOKEN
X-Organization-Id: YOUR_ORG_ID

Response:

{
"success": true,
"data": {
"collections": [
{
"name": "users",
"documentCount": 15000,
"estimatedSize": 45000000,
"subcollections": ["settings", "notifications"]
},
{
"name": "orders",
"documentCount": 45000,
"estimatedSize": 120000000,
"subcollections": ["items", "payments"]
}
],
"lastSyncedAt": "2024-01-15T10:00:00Z"
}
}

Sync Collections

Refresh the collection list from Firestore.

POST /api/v1/projects/:id/collections/sync
Authorization: Bearer YOUR_TOKEN
X-Organization-Id: YOUR_ORG_ID

Response:

{
"success": true,
"data": {
"collections": [
{ "name": "users", "documentCount": 15500 },
{ "name": "orders", "documentCount": 46000 },
{ "name": "products", "documentCount": 1200 }
],
"added": ["products"],
"removed": [],
"syncedAt": "2024-01-15T11:00:00Z"
}
}

Verify IAM Permissions

Check if credentials have required IAM permissions.

POST /api/v1/projects/:id/verify-iam
Authorization: Bearer YOUR_TOKEN
X-Organization-Id: YOUR_ORG_ID

Response:

{
"success": true,
"data": {
"valid": true,
"permissions": {
"datastore.viewer": true,
"datastore.importExportAdmin": true,
"firebase.viewer": true,
"identitytoolkit.viewer": false
},
"warnings": [
"Missing identitytoolkit.viewer: Firebase Auth backup will not be available"
]
}
}

Refresh OAuth Token

Manually refresh the OAuth token for a project.

POST /api/v1/projects/:id/refresh-token
Authorization: Bearer YOUR_TOKEN
X-Organization-Id: YOUR_ORG_ID

Response:

{
"success": true,
"data": {
"tokenStatus": {
"valid": true,
"expiresAt": "2024-01-15T12:00:00Z",
"refreshedAt": "2024-01-15T11:00:00Z"
}
}
}

Project Object

FieldTypeDescription
idstringUnique project ID
namestringDisplay name
firebaseProjectIdstringFirebase project identifier
statusstringconnected, disconnected, error
credentialTypestringoauth or service_account
tokenStatusobjectOAuth token status (if applicable)
settingsobjectProject settings
collectionsarrayList of collections
statisticsobjectBackup statistics
createdAtstringISO 8601 timestamp
updatedAtstringISO 8601 timestamp

Error Responses

Project Not Found

{
"success": false,
"error": {
"code": "PROJECT_NOT_FOUND",
"message": "Project with ID 'proj_xxx' not found"
}
}

Invalid Credentials

{
"success": false,
"error": {
"code": "INVALID_CREDENTIALS",
"message": "Failed to connect to Firebase project",
"details": {
"reason": "Token expired or revoked"
}
}
}

IAM Permission Denied

{
"success": false,
"error": {
"code": "IAM_PERMISSION_DENIED",
"message": "Missing required IAM permissions",
"details": {
"missing": ["roles/datastore.importExportAdmin"]
}
}
}