Skip to main content

FCM Server Key: What It Is and How to Replace It

The FCM server key was retired in 2024. Learn how to replace it with HTTP v1 service-account credentials, secure them, and fix common FCM send errors.

FCM Server Key: What It Is and How to Replace It

The legacy FCM server key was deprecated on June 20, 2023, and Google began shutting down the legacy APIs on July 22, 2024, so a send that goes out today needs an HTTP v1 service-account credential, not a server key. Both dates have passed, and a key still sitting in a backend config is not a working credential, whatever the Firebase console shows.

The uncomfortable part is how it fails without warning. A legacy sender path usually returns an error that reads like a token problem, so the engineer on call spends an afternoon regenerating registration tokens while the actual fault sits in the authorization header. Getting the credential right is the easy half. The other half is accepting that a perfectly valid credential still can’t deliver to a token that went stale, or to a project that isn’t the one your app registers with.

A server key isn’t something you look up. It’s something you retire, on a schedule, with a rollback plan.

Table of Contents

What the FCM Server Key Was and Whether It Still Works

A server key was a static string that authorized calls to Firebase Cloud Messaging’s legacy HTTP and XMPP server APIs. Google deprecated those APIs on June 20, 2023, then started shutting them down on July 22, 2024, which is the point at which keys embedded in backends, notification gateways and third-party integrations stopped being a forward-compatible option, as a technical writeup on the FCM server key traces through the timeline.

The deadline moved once, and that caught people out. Iterable’s migration guide records that Google shifted the shutdown from June 20 to July 22, 2024, and that any project still using a legacy FCM server API key had to migrate before that date. Teams that read the first announcement and scheduled the work for June found themselves behind.

A timeline graphic showing the depreciation and shutdown dates for the legacy FCM server key.

Notification vendors pushed the same message to their own customers, because their integrations had embedded the key too. Twilio’s documentation for its FCM credential error warned that legacy server-key credentials stop working and that FCM v1 credentials were required in their place. If your push provider is a third party, the key may not even be in your repository.

The legacy HTTP API accepted up to 1,000 registration tokens in a single request, according to Oricato’s FCM HTTP v1 guide, and a lot of older sender code was shaped around exactly that number. The replacement model counts quota per message rather than per request, which is a different mental model for batching and a common source of surprise during a first large campaign.

Aspect Legacy server key HTTP v1 service account
Status Deprecated June 20, 2023; shutdown began July 22, 2024 Current and recommended for all new integrations
Authentication Static server key sent with each request OAuth 2.0 access token minted from a service-account JSON file
Endpoint Legacy HTTP and XMPP server APIs Project-specific HTTP v1 endpoint (projects/{project-id}/messages:send)
Secret storage Key pasted into backend or gateway configuration Private-key JSON kept in a secret manager
Recipients per request Up to 1,000 registration tokens No separate token cap; quota counts each message in the request
Quota unit Legacy throughput limits 600,000 messages per minute per project by default

Where the key lived, and why a missing one proves nothing

In the Firebase console, a legacy server key appeared under Project settings, on the Cloud Messaging tab, for projects created while the old API was active. On newer projects the field is absent because a key was never issued. A missing key is not evidence that your integration is healthy: plenty of codebases still post to a legacy send endpoint with a key loaded from an environment variable that nothing validates. The check that matters is which URL your code calls and which header it sets, not which fields the console renders.

How to Replace the Server Key with a Service Account

The migration is six steps, and only one of them happens in the Firebase console. The rest is Google Cloud identity hygiene, which is why it takes longer than the estimate suggests.

A professional man sitting at a desk and working on his laptop regarding service account migration.

  1. Create a dedicated service account in the owning project. Open the Google Cloud console on the project that backs your Firebase app and create an identity used only for sending, because a dedicated account makes rotation, audit and revocation far simpler than sharing one with your build tooling.

  2. Grant only the messaging send role. Resist the urge to attach Editor or Firebase Admin, since a narrow role shrinks the blast radius if the JSON file ever leaks. Google’s HTTP v1 send documentation calls out exactly this pitfall, alongside the more basic one that a legacy static key is not the HTTP v1 authorization mechanism at all.

  3. Create a JSON key and download it once. The console lets you save the file a single time. Treat that download as the credential itself, because there’s no second chance to retrieve the same private key.

  4. Store the file in a secret manager, never in the repository. Point your backend at the secret store at boot, and keep a separate secret per environment so a staging test can’t page real users, which is the same discipline that environment configuration for mobile releases applies to build and update settings.

  5. Mint short-lived access tokens from the stored secret. Use the Google Auth Library for your language to exchange the service-account credentials for an OAuth 2.0 access token, then send it as an Authorization: Bearer <token> header.

  6. Confirm the project ID matches. The project embedded in the credentials must be the Firebase project that owns the app receiving the message. A mismatch produces errors that look like authentication failures and send teams down the wrong path for hours.

For Android delivery that previously depended on a server key, uploading the service-account JSON is the step that restores it: Salesforce’s Android push guidance states that continuing push after July 22, 2024 required uploading a Firebase service-account JSON file instead of the legacy key.

The rule I’d enforce in review: the credential lives on the server and nowhere else. Mobile binaries can be unpacked, so neither a server key nor a service-account file belongs inside an app bundle.

How to Send a Test Message with HTTP v1

A bearer token that looks valid is not proof the migration works. Send one message to one device before you touch a campaign, and send it twice, once to an Android handset and once to an iPhone. The iOS run is where missing APNs configuration surfaces, and it is much cheaper to find that now than during a release announcement.

A three-step guide to sending a test message using the Firebase Cloud Messaging HTTP v1 API.

Use the short-lived access token you already mint from the service account. The test itself is a single registration token, one POST, and a check on the physical device.

  1. Build a message addressed to one registration token. Start with that token as the target, a title, a body, and one data field you can assert on in the client. A minimal payload looks like this:
{"message": {"token": "<device-token>", "notification": {"title": "Test", "body": "Hello from HTTP v1"}, "data": {"screen": "home"}}}
  1. POST it to the project endpoint. The URL is https://fcm.googleapis.com/v1/projects/{project-id}/messages:send with Authorization: Bearer <token> and Content-Type: application/json. The project ID in the path must be the Firebase project that owns the app and the registration token. A well-formed token from another project, or a device token from an old install, still fails here even though the credential itself is fine.

  2. Read the response body, not just the status code. A success returns a message name you can log against the send. A failure returns a status plus a machine-readable error code, which is the value worth alerting on. Treat that code as a token, project, or device problem before you blame the sender credential.

  3. Verify on the device, not in the console. Delivery is confirmed when the notification renders in the tray or the foreground handler fires, not when the API returns 200. An empty tray with a 200 usually means the registration token, the project, or the handset (APNs on iOS, a stale Android install) never matched the payload.

Plan sends around message volume, not requests

HTTP v1 carries a default downstream quota of 600,000 messages per minute per project, a capacity Google says covers more than 99% of FCM developers, and the limit is enforced per message rather than per HTTP request, as Google’s throttling and quotas documentation explains. Google describes it as a token bucket: the project gets 600,000 quota tokens per one-minute window and the bucket refills at the end of it.

That changes how you schedule. A workload pushing 10,000 messages per second exhausts the default allocation in a single minute even if every request is perfectly batched. Smooth traffic across the window, avoid synchronized retries, and add jittered exponential backoff so a transient failure doesn’t turn into a self-inflicted flood. Higher throughput needs a quota adjustment request, not a tighter loop. If your client stack is Expo-based, the token acquisition path differs from a bare Capacitor app, and sending push notifications from Expo covers the client side of that flow.

Securing and Rotating Sender Credentials

A sender credential can push a notification to every install of your app. That makes a leak an incident with a user-visible surface, not a configuration bug you fix on a Friday afternoon. The controls are unglamorous, and they’re the difference between a contained rotation and a mass notification sent by someone else.

Separate accounts per environment. Development, staging and production each get their own service account, so a test run can never reach a real device population.

Least privilege, reviewed when people leave. The messaging send role is enough. Review grants quarterly, because permissions accumulate over time and the account that could send to everyone is the one worth watching.

Restricted secret access with logging. Keep the JSON in a secret manager, limit read access to the delivery service, and log every read. If the secret is fetched at 3 a.m. by a host that never sends at 3 a.m., you want that in a log.

Rotate without an outage

  1. Create a new JSON key on the same service account.
  2. Deploy it to staging and confirm token minting plus one test send per platform.
  3. Switch production with a single configuration change.
  4. Watch the send error rate through one full campaign cycle.
  5. Delete the old key only after that cycle completes cleanly.

Step five is where teams cause their own outage. Deleting the old key before a full delivery cycle has run leaves no fallback if the new credential was scoped incorrectly or bound to the wrong project. If rotation also means touching TLS material or signing assets, the same sequencing applies, and certificate management for mobile apps covers the parts that aren’t push-specific.

Revoke first when a credential is exposed. Investigation is faster when the thing that could send is already dead.

Fixing Send Errors Before They Reach Users

A clean credential check does not mean a delivered notification. Authentication failures, permission failures, invalid tokens, malformed payloads and quota errors all land in the same log stream with similar shapes, and they need completely different fixes. Sorting them by status code first saves hours.

Error Likely cause Fix
QUOTA_EXCEEDED (429) Message volume above 600,000 per minute Spread sends over time and retry with exponential backoff, as in the previous section
THIRD_PARTY_AUTH_ERROR (401) Access token expired, mistargeted, or minted from the wrong service account Re-mint from the current secret and confirm the token’s project
SENDER_ID_MISMATCH Device token belongs to a different Firebase project than the sender Align the configuration’s project ID with the project the app registers against
UNREGISTERED App uninstalled, data cleared, or token otherwise dead Delete the token from your database and stop retrying it
INVALID_ARGUMENT (400) Malformed token string or unsupported payload field Validate the payload shape and the token format before sending

Token lifecycle is the bigger failure mode

Most “push is broken” reports are registration problems wearing an authentication costume. Google’s token management documentation notes that FCM is transitioning from registration tokens toward Firebase Installation IDs for identifying app instances, and recommends periodically retrieving and updating stored tokens. The documentation also records further server-side API and device-group deprecations, so legacy FCM concepts keep moving rather than settling.

The practical consequence is that a project can pass every credential check and still deliver nothing. The stored token was stale, the user had turned notification permission off at the OS level, or the iOS build shipped without working APNs configuration. None of those produce an authorization error, and none of them are fixed by editing a header.

Build the runbook around token hygiene. Delete any token that returns UNREGISTERED from your database immediately, re-register the device on the next app launch, and treat permission state as data you collect rather than something you assume. When a release goes wrong, the fastest way to narrow it down is a tool that separates crashes and bundle failures from delivery problems, and troubleshooting a mobile app in production walks through that split. Work in this order: credential, project ID, token, device.

Confirm the Migration Before You Retire the Old Key

Run the checks in staging and treat each one as a gate rather than a formality. A partial migration is worse than the status quo, because the remaining legacy path gets less attention while everyone assumes the new one is live.

A checklist screen asking users to confirm a Firebase service account migration before retiring old keys.

  1. Token minting works from the secret store with the new service account, and the project ID matches the Firebase project that owns the app.
  2. An Android device and an iOS device both receive a message. This is the step that proves APNs configuration and Android notification permission, which no credential test covers.
  3. An invalid token is deleted after an UNREGISTERED response, so the next campaign doesn’t spend quota on dead devices.
  4. Rotation is complete and the old key is still present. Deleting it comes after one full campaign cycle, not before.

Any failed item is a no-go. Fix it with the error reference, then rerun the checklist from the top rather than from the failed step, since a change to the credential often disturbs the project ID check.

Verification doesn’t stop at the cutover. Track sent, received and opened counts for each campaign so a silent delivery drop shows up as a funnel anomaly instead of a support ticket, and pair that with app health monitoring so a delivery dip gets read against crash and update signals at the same time. Our notifications dashboard reports that per-campaign funnel, and APNs and FCM credentials are stored encrypted, so the check is one screen rather than a query against your own send logs.

The next step is small and specific: run these four checks on staging this week, then move production over in a single configuration change with the old key still in place as a fallback.


Every plan includes native notifications with live updates and release monitoring in one account, which means the migration you just finished and the delivery numbers that prove it live in the same dashboard. If you’re retiring a legacy FCM server key and want per-campaign sent, received and opened counts waiting on the other side of the cutover, Capgo handles the sending and stores your APNs and FCM credentials encrypted. Sign up, link your app, and run the checklist against a real build before the old key disappears.

Live updates for Capacitor apps

When a web-layer bug is live, ship the fix through Capgo instead of waiting days for app store approval. Users get the update in the background while native changes stay in the normal review path.

Latest from our Blog

Capgo gives you the best insights you need to create a truly professional mobile app.