{"library":"firebase-admin","title":"Firebase Admin Python SDK","description":"The Firebase Admin Python SDK enables server-side (backend) Python developers to integrate Firebase into their services and applications. It provides programmatic access to Firebase services from trusted environments, allowing for tasks such as custom authentication, managing user data, sending FCM messages, and accessing Cloud Firestore and Storage. The current version is 7.3.0, and it maintains a regular release cadence with frequent updates.","status":"active","version":"7.3.0","language":"en","source_language":"en","source_url":"https://github.com/firebase/firebase-admin-python","tags":["firebase","google cloud","admin sdk","backend","authentication","firestore","realtime database","cloud messaging","storage"],"install":[{"cmd":"pip install firebase-admin","lang":"bash","label":"Install Firebase Admin SDK"}],"dependencies":[{"reason":"Caching HTTP responses","package":"cachecontrol","optional":false},{"reason":"Core Google API client library, used for gRPC communication (not on PyPy)","package":"google-api-core[grpc]","optional":false},{"reason":"Client library for Cloud Firestore (not on PyPy)","package":"google-cloud-firestore","optional":false},{"reason":"Client library for Cloud Storage","package":"google-cloud-storage","optional":false},{"reason":"JSON Web Token implementation for authentication","package":"pyjwt[crypto]","optional":false},{"reason":"HTTP client for making requests","package":"httpx[http2]","optional":false}],"imports":[{"symbol":"firebase_admin","correct":"import firebase_admin"},{"symbol":"credentials","correct":"from firebase_admin import credentials"},{"symbol":"firestore","correct":"from firebase_admin import firestore"},{"symbol":"auth","correct":"from firebase_admin import auth"},{"symbol":"storage","correct":"from firebase_admin import storage"},{"symbol":"messaging","correct":"from firebase_admin import messaging"}],"quickstart":{"code":"import os\nimport firebase_admin\nfrom firebase_admin import credentials, firestore\n\n# Best practice: store service account key in an environment variable\n# and load it, or use Application Default Credentials on Google Cloud.\n# Replace 'path/to/your/serviceAccountKey.json' with actual path if not using env var.\nSERVICE_ACCOUNT_KEY_PATH = os.environ.get('FIREBASE_SERVICE_ACCOUNT_KEY_PATH', '')\n\nif SERVICE_ACCOUNT_KEY_PATH:\n    cred = credentials.Certificate(SERVICE_ACCOUNT_KEY_PATH)\nelse:\n    # Fallback for Google Cloud environments where ADC are available\n    # or if you prefer not to use a file directly for local testing\n    cred = credentials.ApplicationDefault()\n\n# Initialize the app\nfirebase_admin.initialize_app(cred, {\n    'projectId': os.environ.get('FIREBASE_PROJECT_ID', 'your-project-id'),\n    'databaseURL': os.environ.get('FIREBASE_DATABASE_URL', 'https://your-project-id.firebaseio.com')\n})\n\ndb = firestore.client()\n\n# Add data to Firestore\ndoc_ref = db.collection('users').document('alovelace')\ndoc_ref.set({\n    'first': 'Ada',\n    'last': 'Lovelace',\n    'born': 1815\n})\nprint(f\"Added document with ID: {doc_ref.id}\")\n\n# Read data from Firestore\nusers_ref = db.collection('users')\ndocs = users_ref.stream()\n\nprint(\"\\nAll users:\")\nfor doc in docs:\n    print(f\"{doc.id} => {doc.to_dict()}\")\n\n# Clean up (optional, for demonstration purposes)\n# firebase_admin.delete_app(firebase_admin.get_app())\n","lang":"python","description":"Initializes the Firebase Admin SDK using service account credentials (preferably from an environment variable) or Application Default Credentials. It then demonstrates connecting to Cloud Firestore, adding a new document to a collection, and reading all documents from that collection. Remember to replace placeholder project IDs and URLs, and secure your service account key."},"warnings":[{"fix":"Upgrade your Python environment to 3.10 or newer.","message":"Version 7.0.0 dropped support for Python 3.7 and 3.8. Python 3.9 support is deprecated; developers are strongly advised to use Python 3.10 or higher.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Migrate to `send_each()` and `send_each_for_multicast()` or their asynchronous counterparts `send_each_async()` and `send_each_for_multicast_async()`.","message":"In version 7.0.0, the `send_all()` and `send_multicast()` FCM APIs were removed.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"No direct fix required for `firebase-admin` itself, but review your project's `requirements.txt` if you previously relied on this transitive dependency.","message":"The dependency on `google-api-python-client` was removed in v7.0.0, significantly reducing the SDK's bundle size. While this generally improves performance, ensure your project does not implicitly rely on this dependency.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Update `ActionCodeSettings` to use the `link_domain` parameter instead of `dynamic_link_domain`.","message":"The `ActionCodeSettings.dynamic_link_domain` parameter was deprecated in v7.1.0 in favor of `link_domain` for customizing Firebase Hosting domains in email action flows.","severity":"deprecated","affected_versions":">=7.1.0"},{"fix":"If real-time updates are critical, consider alternative SDKs (e.g., Node.js, Java) or implement a polling mechanism on the Python backend.","message":"The Python Admin SDK for Firebase Realtime Database does not support real-time event listeners. All data retrieval operations are blocking.","severity":"gotcha","affected_versions":"*"},{"fix":"Store the path to the service account key in an environment variable (`FIREBASE_SERVICE_ACCOUNT_KEY_PATH`) or use Google Application Default Credentials when deploying on Google Cloud infrastructure.","message":"Service account JSON key files contain sensitive credentials. Never commit them directly to version control.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-05T00:00:00.000Z","next_check":"2026-07-04T00:00:00.000Z"}