> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# xbox_user_id

> chat_user::xbox_user_id

Returns the unique XBOX User ID of this user.

## Syntax

```cpp theme={null}
_Ret_z_ xbox_user_id(  
)  
```

### Parameters

None.

### Return value

Type: \_Ret\_z\_

Returns a pointer to a null-terminated string that represents the unique XBOX User ID of this user.

## Remarks

This method returns a pointer to a null-terminated string that represents the unique XBOX User ID for this [chat\_user](https://docs.xbox.com/reference/chat/gamechat2/classes/chat_user/chat_user.md) object. The memory for the returned string pointer remains valid for the life of the `chat_user object`, which is until the user has been removed by a call to the [chat\_manager::remove\_user](https://docs.xbox.com/reference/chat/gamechat2/classes/chat_manager/methods/chat_manager_remove_user.md) method. For more information about managing users with the local [chat\_manager](https://docs.xbox.com/reference/chat/gamechat2/classes/chat_manager/chat_manager.md) instance for your app, see the [Adding users to Game Chat 2](https://docs.xbox.com/services/xbox-services/multiplayer/chat/game-chat2/using-game-chat-2.md#adding_users_to_game_chat_2) section in [Using the Game Chat 2 C++ API](https://docs.xbox.com/services/xbox-services/multiplayer/chat/game-chat2/using-game-chat-2.md).

## Requirements

**Header:** GameChat2.h

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## See also

[Intro to Game Chat 2](https://docs.xbox.com/services/xbox-services/multiplayer/chat/game-chat2/game-chat-2-intro.md)\
[chat\_user::custom\_user\_context](https://docs.xbox.com/reference/chat/gamechat2/classes/chat_user/methods/chat_user_custom_user_context.md)\
[chat\_user](https://docs.xbox.com/reference/chat/gamechat2/classes/chat_user/chat_user.md)


## Related topics

- [chat_user class](https://docs.xbox.com/reference/chat/gamechat2/classes/chat_user/chat_user.md)
- [PartyXblChatUser::GetXboxUserId](https://docs.xbox.com/services/playfab/multiplayer/networking/xblreference/classes/PartyXblChatUser/methods/partyxblchatuser_getxboxuserid.md)
- [XblContextGetXboxUserId](https://docs.xbox.com/reference/live/xsapi-c/xbox_live_context_c/functions/xblcontextgetxboxuserid.md)
- [add_local_user](https://docs.xbox.com/reference/chat/gamechat2/classes/chat_manager/methods/chat_manager_add_local_user.md)
- [PFUserXboxInfo](https://docs.xbox.com/services/playfab/api-references/c/pftypes/structs/pfuserxboxinfo.md)
