Manage Instance ID data

Instance IDs identify individual installations of your app. Since each Instance ID is unique to a particular app and device, they give Firebase services a way to refer to specific app instances. For example, Cloud Messaging uses Instance IDs to determine which devices to send messages to.

Several Firebase services use Instance IDs to power their features:

  • Analytics
  • Crashlytics
  • Cloud Messaging
  • Remote Config

Manage app data associated with Instance IDs

Services that use Instance IDs to identify installations also use them as a key to associate relevant data with that device. For example, Crashlytics uses Instance IDs to record crashes that happen on the device, Remote Config uses them to fetch configurations, and Analytics uses Instance IDs to track particular audiences.

Data associated with Instance IDs is generally not personally-identifying, but it can still be helpful to give users an option to manage it. To that end, Firebase offers two ways to manage Instance-ID-related data collection:

  • Delete Instance IDs. You can delete an Instance ID with a server- or client-side API call. Deleting an Instance ID deletes the ID itself and all data associated with it.
  • Disable services that generate IDs. Most Firebase services that use Instance IDs automatically generate a new ID if there isn't one on the device when they start up. To ensure your app doesn't create unwanted Instance IDs, disable auto-initialization for those services.

Delete an Instance ID

Deleting an Instance ID also deletes data associated with that ID in any of the Firebase services listed above. That makes ID deletion a helpful tool in clearing user data, but also comes with a caveat: if you're using multiple services that rely on Instance IDs, deleting an ID clears data from all of them.

The Instance ID service creates a new ID within a few days, unless you disable all Instance-ID-generating services in your app. Firebase considers the newly-created ID to be a brand new app instance, and doesn't associate it with the previous ID in any way.

Delete an ID with a client API call

To delete IDs generated by Firebase services, call the appropriate method from the Firebase Instance ID API:


InstanceID.instanceID().deleteID { error in
  if let error = error {
    print("Error deleting instance ID: \(error)")


[FIRInstanceID instanceID] deleteIDWithHandler:^(NSError *error) {
  if error != nil {
    NSLog(@"Error deleting instance ID: %@", error);



Delete an ID with a server API call

To delete an Instance ID with server API calls, add the Firebase Admin SDK to your server, if you haven't already.

Once it's added, delete IDs through a call to the Instance ID deletion function in your language of choice:


// An Instance ID sent from a client service SDK
const idToDelete = 'INSTANCE_ID';



// An Instance ID sent from a client service SDK
String idToDelete = "INSTANCE_ID";



  from firebase_admin import instance_id

  # An Instance ID sent from a client service SDK
  id_to_delete = 'INSTANCE_ID'



client, err := app.InstanceId(ctx)
if err != nil {
  log.Fatalln("error initializing client", err)

iidToDelete := "INSTANCE_ID"
if err := client.DeleteInstanceId(ctx, iidToDelete); err != nil {
  log.Fatalln("error deleting iid", err)

When you delete an Instance ID with a server API call, Firebase services delete the associated data, stop accepting new data for that ID, and, within a few days, notify the client app that the ID was deleted. Until Firebase notifies the client app, some of the app's services might experience reduced functionality.

If you want to delete the current Instance ID and immediately use Firebase services with a new, independent ID, use one of the Client APIs above to handle the deletion.

Disable Instance ID generation

Services that use Instance IDs automatically generate a new ID when they're initialized in an app that doesn't currently have one. Typically, those services also automatically initialize when your app launches. To disable Instance ID generation, you have to disable auto-initialization for services that use them.

A common approach is to give users an option to opt-in to data collection: disable auto-initialization for the services that use Instance IDs, implement a dialog that prompts users for their consent to data collection, and re-enable the services manually once you have consent.

Read the guides below to find out how to disable auto-initialization for Instance-ID-using services and instead manually initialize them: