> ## 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.

# XUserGetId

> XUserGetId

Gets the user ID for a specific user.

## Syntax

```cpp theme={null}
HRESULT XUserGetId(  
         XUserHandle user,  
         uint64_t* userId  
)  
```

### Parameters

*user*   \_In\_\
Type: XUserHandle

A handle to the user to retrieve the user ID for.

*userId*   \_Out\_\
Type: uint64\_t\*

Contains the user ID for a specific user.

### Return value

Type: HRESULT

HRESULT success or error code.

| Return Code | Description |
| - | - |
| S\_OK | The operation succeeded. |
| E\_GAMEUSER\_RESOLVE\_USER\_ISSUE\_REQUIRED | The user must use a UI to resolve the issue. Call [XUserResolveIssueWithUiAsync](https://docs.xbox.com/reference/system/xuser/functions/xuserresolveissuewithuiasync.md) to display the UI to the user. |

## Remarks

Retrieves the user's XUID. If the function returns **E\_GAMEUSER\_RESOLVE\_USER\_ISSUE\_REQUIRED**, the user needs to use the system UI to resolve the problem before the function can retrieve the property. Call [XUserResolveIssueWithUiAsync](https://docs.xbox.com/reference/system/xuser/functions/xuserresolveissuewithuiasync.md) to display the system UI and resolve the issue.

## Requirements

**Header:** XUser.h

**Library:** xgameruntime.lib

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

## Conceptual documentation

* [Using the Game Chat 2 C++ API](https://docs.xbox.com/services/xbox-services/multiplayer/chat/game-chat2/using-game-chat-2.md)

## See also

[XUser](https://docs.xbox.com/reference/system/xuser/xuser_members.md)

[XUserFindUserById](https://docs.xbox.com/reference/system/xuser/functions/xuserfinduserbyid.md)

[XUserFindUserByLocalId](https://docs.xbox.com/reference/system/xuser/functions/xuserfinduserbylocalid.md)


## Related topics

- [XUserGetLocalId](https://docs.xbox.com/reference/system/xuser/functions/xusergetlocalid.md)
- [XUserGetMaxUsers](https://docs.xbox.com/reference/system/xuser/functions/xusergetmaxusers.md)
- [User identity and XUser](https://docs.xbox.com/build/core-features/common/user/player-identity-xuser.md)
- [XUserGetGamertag](https://docs.xbox.com/reference/system/xuser/functions/xusergetgamertag.md)
- [Using the Game Chat 2 C++ API](https://docs.xbox.com/services/xbox-services/multiplayer/chat/game-chat2/using-game-chat-2.md)
