# Registering Push Devices

Once your app has enabled the push notifications, you can use the APIs to register user devices such as iPhones and Android phones.

<admonition type="info">

Each chat user has a limit of  **25**  unique devices. Once this limit is reached, the oldest device will be removed and replaced by the new device.

</admonition>

### Device Parameters

| name               | type    | description                                                                      | default | optional |
|--------------------|---------|----------------------------------------------------------------------------------|---------|----------|
| user_id            | string  | The user ID for this device                                                      | -       |          |
| id                 | string  | The device ID.                                                                   | -       |          |
| push_provider      | string  | The push provider for this device. Either APN, Firebase, Huawei, or Xiaomi.      | -       |          |
| disabled           | boolean | Set if the device is disabled                                                    | -       | ✓        |
| disabled_reason    | string  | Explanation if the device is disabled                                            | -       | ✓        |
| push_provider_name | string  | The push provider name for this device if a multi-bundle configuration is added. | -       | ✓        |

### Register a Device

Registering a device associates it with a user and tells the push provider to send new message notifications to the device.

<admonition type="info">

Register the user's device for remote push notifications once your user is successfully connected to Chat.

</admonition>

<admonition type="info">

Multi-bundle configurations require that you specify a push_provider_name when registering a device that corresponds to the name of the push configuration that you've set up in the dashboard or via the API.

</admonition>

<codetabs>

<codetabs-item value="kotlin" label="Kotlin">

```kotlin
client.addDevice(
  Device(
    token = "push-provider-token",
    pushProvider = PushProvider.FIREBASE,
    providerName = "provider_name", // Optional, if adding to multi-bundle named provider
  )
).enqueue { result ->
  if (result.isSuccess) {
    // Device was successfully registered
  } else {
    // Handle result.error()
  }
}
```

</codetabs-item>

<codetabs-item value="javascript" label="JavaScript">

```js
const id = "2ffca4ad6599adc9b5202d15a5286d33c19547d472cd09de44219cda5ac30207";
const push_provider = "apn";
const user_id = "Taquito";

await client.addDevice(id, push_provider, user_id);

// if multi providers
await client.addDevice(id, push_provider, user_id, push_provider_name);
```

</codetabs-item>

<codetabs-item value="python" label="Python">

```python
client.add_device(
  '2ffca4ad6599adc9b5202d15a5286d33c19547d472cd09de44219cda5ac30207',
  'apn',
  '42'
)
```

</codetabs-item>

<codetabs-item value="ruby" label="Ruby">

```ruby
# require 'stream-chat'

client.add_device(
  '2ffca4ad6599adc9b5202d15a5286d33c19547d472cd09de44219cda5ac30207',
  'apn',
  '42'
)
```

</codetabs-item>

<codetabs-item value="swift" label="Swift">

```swift
func application(
  _ application: UIApplication,
  didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data
) {
  // Note: If you leverage mutli-bundle configuration, please provide providerName - name of your configuration
  chatClient.currentUserController().addDevice(.apn(token: deviceToken)) { error in
   if let error = error {
     print("Error adding device token.", error)
   }
  }
}
```

</codetabs-item>

<codetabs-item value="bash" label="Bash">

```bash
stream chat:push:device:add \
  --device_id '2ffca4ad6599adc9b5202d15a5286d33c19547d472cd09de44219cda5ac30207'
  --user_id '42'
  --provider 'apn'
```

</codetabs-item>

<codetabs-item value="php" label="PHP">

```php
$add = $client->addDevice(
  '2ffca4ad6599adc9b5202d15a5286d33c19547d472cd09de44219cda5ac30207',
  'apn',
  'elon'
);
```

</codetabs-item>

<codetabs-item value="dart" label="Dart">

```dart
// register the device with APN (Apple only)
  await client.addDevice("device-token", "apn");

  // register the device with Firebase (Android only)
  await client.addDevice("device-token", "firebase");
```

</codetabs-item>

<codetabs-item value="go" label="Go">

```go
_ = client.AddDevice(ctx, &Device{
	ID:      "2ffca4ad6599adc9b5202d15a5286d33c19547d472cd09de44219cda5ac30207",
	UserID:    "elon",
	PushProvider: PushProviderAPNS,
})
```

</codetabs-item>

<codetabs-item value="unreal" label="Unreal">

```cpp
// register the device with APN (Apple only)
Client->AddDevice(TEXT("device-token"), EPushProvider::Apn);

// register the device with Firebase (Android only)
Client->AddDevice(TEXT("device-token"), EPushProvider::Firebase);
```

</codetabs-item>

<codetabs-item value="csharp" label="C#">

```csharp
await deviceClient.AddDeviceAsync(new Device
{
  Id = "2ffca4ad6599adc9b5202d15a5286d33c19547d472cd09de44219cda5ac30207",
  PushProvider = "apn",
  UserID = "<user_id>",
});
```

</codetabs-item>

<codetabs-item value="unity" label="Unity">

```csharp
await Client.DeviceApi.AddDeviceAsync(new CreateDeviceRequest
{
  //Device ID provided by the notifications provider e.g. Token provided by Firebase Messaging SDK
  Id = "unique-device-id",
  PushProvider = PushProviderType.Firebase,
});
```

</codetabs-item>

</codetabs>

### Unregister a Device

Unregistering a device removes the device from the user and stops further new message notifications.

<codetabs>

<codetabs-item value="kotlin" label="Kotlin">

```kotlin
client.deleteDevice(
  Device(
    token = "push-provider-token",
    pushProvider = PushProvider.FIREBASE,
    providerName = "custom_name", // Optional, if added to multi-bundle named provider
  )
).enqueue { result ->
  if (result.isSuccess) {
    // Device was successfully unregistered
  } else {
    // Handle result.error()
  }
}
```

</codetabs-item>

<codetabs-item value="javascript" label="JavaScript">

```js
const id = "2ffca4ad6599adc9b5202d15a5286d33c19547d472cd09de44219cda5ac30207";
const user_id = "Taquito";

await chatClient.removeDevice(id, user_id);
```

</codetabs-item>

<codetabs-item value="python" label="Python">

```python
client.delete_device(
  '2ffca4ad6599adc9b5202d15a5286d33c19547d472cd09de44219cda5ac30207',
  '42'
)
```

</codetabs-item>

<codetabs-item value="ruby" label="Ruby">

```ruby
client.delete_device(
  '2ffca4ad6599adc9b5202d15a5286d33c19547d472cd09de44219cda5ac30207',
  '42'
)
```

</codetabs-item>

<codetabs-item value="swift" label="Swift">

```swift
let currentUserController = chatClient.currentUserController()

guard let device = currentUserController.currentUser?.currentDevice else {
  // No device to remove
}

currentUserController.removeDevice(id: device.id) { error in
  if let error = error {
    print("Error removing the device", error)
  }
}
```

</codetabs-item>

<codetabs-item value="bash" label="Bash">

```bash
stream chat:push:device:delete \
  --device_id '2ffca4ad6599adc9b5202d15a5286d33c19547d472cd09de44219cda5ac30207'
  --user_id '42'
```

</codetabs-item>

<codetabs-item value="php" label="PHP">

```php
$delete = $client->deleteDevice(
  '2ffca4ad6599adc9b5202d15a5286d33c19547d472cd09de44219cda5ac30207',
  'elon'
);
```

</codetabs-item>

<codetabs-item value="dart" label="Dart">

```dart
await client.removeDevice("device-token");
```

</codetabs-item>

<codetabs-item value="go" label="Go">

```go
deviceID := "2ffca4ad6599adc9b5202d15a5286d33c19547d472cd09de44219cda5ac30207"
	userID := "elon"
	_ = client.DeleteDevice(ctx, userID, deviceID)
```

</codetabs-item>

<codetabs-item value="unreal" label="Unreal">

```cpp
Client->RemoveDevice(TEXT("device-token"));
```

</codetabs-item>

<codetabs-item value="csharp" label="C#">

```csharp
await deviceClient.RemoveDeviceAsync("2ffca4ad6599adc9b5202d15a5286d33c19547d472cd09de44219cda5ac30207", "Taquito");
```

</codetabs-item>

<codetabs-item value="unity" label="Unity">

```csharp
await Client.DeviceApi.RemoveDeviceAsync(deviceId, Client.UserId);
```

</codetabs-item>

</codetabs>

### List Devices

Provides a list of all devices associated with a user.

<codetabs>

<codetabs-item value="kotlin" label="Kotlin">

```kotlin
client.getDevices().enqueue { result ->
  if (result.isSuccess) {
    val devices: List<Device> = result.data()
  } else {
    // Handle result.error()
  }
}
```

</codetabs-item>

<codetabs-item value="javascript" label="JavaScript">

```js
const user_id = "Taquito";

await chatClient.getDevices(user_id);
```

</codetabs-item>

<codetabs-item value="python" label="Python">

```python
client.get_devices(user_id)
```

</codetabs-item>

<codetabs-item value="ruby" label="Ruby">

```ruby
client.get_devices(user_id)
```

</codetabs-item>

<codetabs-item value="php" label="PHP">

```php
$client->getDevices($userID)
```

</codetabs-item>

<codetabs-item value="go" label="Go">

```go
client.GetDevices(ctx, userID)
```

</codetabs-item>

<codetabs-item value="bash" label="Bash">

```bash
stream chat:push:device:get --user_id '42'
```

</codetabs-item>

<codetabs-item value="swift" label="Swift">

```swift
let currentUserController = chatClient.currentUserController()

currentUserController.synchronizeDevices { error in
  guard error == nil else {
    print("Error getting the list of devices")
    return
  }

  let devices = currentUserController.currentUser?.devices
}
```

</codetabs-item>

<codetabs-item value="unreal" label="Unreal">

```cpp
Client->ListDevices(
  [](const TArray<FDevice> Devices)
  {
    // Do something with Devices
  });
```

</codetabs-item>

<codetabs-item value="csharp" label="C#">

```csharp
await deviceClient.GetDevicesAsync(userId);
```

</codetabs-item>

<codetabs-item value="unity" label="Unity">

```csharp
var response = await Client.DeviceApi.ListDevicesAsync(Client.UserId);
foreach (var userDevice in response.Devices)
{
  Debug.Log(userDevice.Id); // Unique Device ID provided by push notifications provider
  Debug.Log(userDevice.CreatedAt);
  Debug.Log(userDevice.PushProvider); //E.g. Firebase
  Debug.Log(userDevice.Disabled);
  Debug.Log(userDevice.DisabledReason);
}
```

</codetabs-item>

</codetabs>

---

This page was last updated at 2025-08-15T14:14:54.969Z.

For the most recent version of this documentation, visit [https://getstream.io/chat/docs/node/push_devices/](https://getstream.io/chat/docs/node/push_devices/).