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

# XSystemGetConsoleId

> XSystemGetConsoleId

# XSystemGetConsoleId

Returns the console ID of the current device.

## Syntax

```cpp theme={null}
HRESULT XSystemGetConsoleId(  
         size_t consoleIdSize,  
         char* consoleId,  
         size_t* consoleIdUsed  
)  
```

### Parameters

*consoleIdSize*   \_In\_\
Type: size\_t

The size of the *consoleId*, in bytes. This value must be equal to or greater than the **XSystemConsoleIdBytes** constant defined in XSystem.h.

*consoleId*   \_Out\_writes\_bytes\_to\_(consoleIdSize,\*consoleIdUsed)\
Type: char\*

The character buffer that will receive the console ID.

*consoleIdUsed*   \_Out\_opt\_\
Type: size\_t\*

The size, in bytes, of the *consoleId* buffer returned.

### Return value

Type: [HRESULT](https://learn.microsoft.com/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a)

Returns **S\_OK** if successful; otherwise, returns an error code. For a list of error codes, see [Error Codes](/reference/errorcodes). If the function fails because *consoleIdSize* is set to a value less than **XSystemConsoleIdBytes**, the return value is set to **HRESULT\_FROM\_WIN32(ERROR\_INSUFFICIENT\_BUFFER)**.

## Remarks

<Note>This function isn't safe to call on a time-sensitive thread. For more information, see [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

The console ID uniquely identifies an XBOX device for XBOX Live for development scenarios only. The console ID is used to identify the console for logging and management purposes; for example, to capture analytics information, or to determine which development kit to reboot in a development environment. The ID returned by this function is a match to the Console ID viewable in Settings \ System \ Console info.

For XBOX devices, the console ID is stored on the device. If the console ID is not found, or if you don't have permission to access the console ID, then the console ID defaults to `00000000.00000000.00000000.00000000.00`. For PC devices, the console ID always defaults to `00000000.00000000.00000000.00000000.00`.

In RETAIL, this function will always return `00000000.00000000.00000000.00000000.00`. If the game is needing an identifier that can
be used in all situations including retail, there are two possibilties:

* If your application is using Single-Sign-On (SSO), you should the XSTS SSO token's pairwise ID instead of the id returned by this function.
* Otherwise, use the [XSystemGetAppSpecificDeviceId](/reference/system/xsystem/functions/xsystemgetappspecificdeviceid) function.

## Requirements

**Header:** XSystem.h

**Library:** xgameruntime.lib

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

## Conceptual documentation

* [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## See also

[Activating your dev kit (NDA topic)](/home/setup-install/devkits/setup/activating-dev-kit)\
[XSystemGetXboxLiveSandbodId](/reference/system/xsystem/functions/xsystemgetxboxlivesandboxid)\
[XSystem](/reference/system/xsystem/xsystem_members)


## Related topics

- [XSystemGetXboxLiveSandboxId](/reference/system/xsystem/functions/xsystemgetxboxlivesandboxid.md)
- [XSystem](/reference/system/xsystem/xsystem_members.md)
- [XSystemGetAppSpecificDeviceId](/reference/system/xsystem/functions/xsystemgetappspecificdeviceid.md)
- [IXtfConsoleControlClient::GetSystemTime](/reference/tools/xtf/xtfconsolecontrol/interfaces/IXtfConsoleControlClient/methods/ixtfconsolecontrolclient_getsystemtime.md)
- [XtfGetConsoleFieldValue](/reference/tools/xtf/xtfapi/functions/xtfgetconsolefieldvalue-xbox-microsoft-m.md)
