Skip to content
AISpendbook

Your app's data

Firebase / Firestore

Map Firestore documents that log AI calls, read with a read-only service account.

Use a dedicated service account with read-only Firestore access (roles/datastore.viewer). Don't use the default App Engine or Firebase Admin SDK account.

least-privilege service account
# Create a dedicated, read-only service account (Google Cloud CLI).
PROJECT_ID=your-firebase-project
gcloud iam service-accounts create spendbook-reader \
  --project "$PROJECT_ID" --display-name "AI Spendbook (read-only)"

# Cloud Datastore Viewer = read-only access to Firestore documents.
gcloud projects add-iam-policy-binding "$PROJECT_ID" \
  --member "serviceAccount:spendbook-reader@$PROJECT_ID.iam.gserviceaccount.com" \
  --role "roles/datastore.viewer"

# Create a key and upload/paste the JSON in AI Spendbook, then delete the local file.
gcloud iam service-accounts keys create spendbook-reader.json \
  --iam-account "spendbook-reader@$PROJECT_ID.iam.gserviceaccount.com"
  • Upload or paste the JSON key in the Firestore wizard. It is stored encrypted and never shown again.
  • Choose collections, then allowlist the fields to read. Fields that look sensitive start unchecked.
  • Map fields to canonical fields (nested fields use dotted paths like usage.input_tokens), test the mapping, then sync.

This connector has not been run against a live account. It was tested against mocked responses.