# Call SendbirdChat.init with different application id

**URL:** <https://community.sendbird.com/t/call-sendbirdchat-init-with-different-application-id/7966>\
**Category:** JavaScript\
**Created:** [August 1, 2023, 5:38pm UTC](https://community.sendbird.com/t/call-sendbirdchat-init-with-different-application-id/7966 "2023-08-01T17:38:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eueddem\_Kim](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/eueddem_kim/32/2007_2.png) [@Eueddem\_Kim](https://community.sendbird.com/u/Eueddem_Kim)\
**Post date:** [August 1, 2023, 5:38pm UTC](https://community.sendbird.com/t/call-sendbirdchat-init-with-different-application-id/7966/1 "2023-08-01T17:38:48Z")

</div>

Hello,  
I’m working on the app which is required to support switching among some environments with different Sendbird app ID.

But once `SendbirdChat.init` is called with one application id, it seems it doesn’t update itself anymore on call init with a different ID.

first call

```auto
const instance = SendbirdChat.init({
  appId: "applicationIdFirst",
  modules: [new GroupChannelModule()],
});
console.log(instance.appId)

```

=\> prints “applicationIdFirst” (what we expected)

and then second call…

```auto
const instance = SendbirdChat.init({
  appId: "applicationIdSecond",
  modules: [new GroupChannelModule()],
});
console.log(instance.appId)

```

=\> prints “applicationIdFirst” (appId is not updated!)

It seems SendbirdChat stores its instance and returns it on the second call - how can we resolve the issue?

We’re using:  
“@sendbird/chat”: “4.7.2”,  
“react”: “18.2.0”,  
“react-native”: “0.72.3”,

---

<div class="post-metadata">

**Author:** ![Eueddem\_Kim](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/eueddem_kim/32/2007_2.png) [@Eueddem\_Kim](https://community.sendbird.com/u/Eueddem_Kim)\
**Post date:** [August 1, 2023, 6:44pm UTC](https://community.sendbird.com/t/call-sendbirdchat-init-with-different-application-id/7966/2 "2023-08-01T18:44:05Z")

</div>

It looks specifying `newInstance: true` returns a new instance, but it does not update `SendbirdChat.instance`.

```auto
const instance = SendbirdChat.init({
  appId: "applicationIdSecond",
  modules: [new GroupChannelModule()],
  newInstance: true,
});

```

---

<div class="post-metadata">

**Author:** ![Ben\_Winters](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/ben_winters/32/4080_2.png) [@Ben\_Winters](https://community.sendbird.com/u/Ben_Winters)\
**Post date:** [August 9, 2023, 10:14pm UTC](https://community.sendbird.com/t/call-sendbirdchat-init-with-different-application-id/7966/3 "2023-08-09T22:14:08Z")

</div>

I’m dealing with this same problem, though we use the `SendbirdUIKitContainer` and update the `appId` that is passed into it, which would ideally update the SendbirdChat instance.

We have a multi-tenant setup with the potential for a single end user to belong to multiple organizations/Sendbird apps. To support this, we have the ability in our app for a user to change their Sendbird app at runtime, similar to changing orgs in Slack.

When the active organization ID changes in our redux store, that triggers a series of hooks to run, including changing the `appId` that is passed into the `SendbirdUIKitContainer`. I also call `await disconnect()` and `await connect()` in response to changing the org. Logs show that the `connect()` call succeeds and `sdk.connectionState` is `OPEN`. Sendbird’s internal logs also show success here.

However, the UI fragments from `@sendbird/uikit-react-native` which are mounted in the app have their own network requests running, and the logs start showing `[debug] fail api request [SendbirdError: Connection is required.]`. I assume this is related to the SDK instance not being updated properly.

(Both of these apps work correctly if I use them to initialize Sendbird on app launch, only switching between them causes the connection error.)

**Question:**  
Is changing the Sendbird app ID supported at runtime in the React Native and JS SDKs? [I asked about this scenario before](https://community.sendbird.com/t/advice-on-switching-the-user-between-multiple-sendbird-apps/7893), but no limitation was mentioned.

---

<div class="post-metadata">

**Author:** ![Ben\_Winters](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/ben_winters/32/4080_2.png) [@Ben\_Winters](https://community.sendbird.com/u/Ben_Winters)\
**Post date:** [August 9, 2023, 10:14pm UTC](https://community.sendbird.com/t/call-sendbirdchat-init-with-different-application-id/7966/4 "2023-08-09T22:14:43Z")

</div>

@Chinmaya_Gupta You were very helpful before. Could you please respond here?

---

<div class="post-metadata">

**Author:** ![Ben\_Winters](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/ben_winters/32/4080_2.png) [@Ben\_Winters](https://community.sendbird.com/u/Ben_Winters)\
**Post date:** [September 18, 2025, 4:01pm UTC](https://community.sendbird.com/t/call-sendbirdchat-init-with-different-application-id/7966/5 "2025-09-18T16:01:56Z")

</div>

I eventually figured out that we can just pass the current `chatAppId` as a key for the `SendbirdUIKitContainer`, causing React to unmount/remount the whole thing (and all of our app screens), which allows SendbirdChat to be reinitialized with the new app id. Would be better to have the container allow this updating directly, without remounting all of the children, but this was an acceptable trade off for us.

```auto
    const chatAppId = useChatApplicationId() ?? ''

    <SendbirdUIKitContainer
      key={chatAppId}
      appId={chatAppId}
      // ...
    >
    {children}
    </SendbirdUIKitContainer>

```
