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

# XSystemGetXboxLiveSandboxId

> XSystemGetXboxLiveSandboxId

# XSystemGetXboxLiveSandboxId

Retrieves the XBOX Live sandbox ID.

## Syntax

```cpp theme={null}
HRESULT XSystemGetXboxLiveSandboxId(  
         size_t sandboxIdSize,  
         char* sandboxId,  
         size_t* sandboxIdUsed  
)  
```

### Parameters

*sandboxIdSize*   \_In\_<br />Type: size\_t

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

*sandboxId*   \_Out\_writes\_bytes\_to\_(sandboxIdSize,\*sandboxIdUsed)<br />Type: char\*

The character buffer that will receive the sandbox ID.

*sandboxIdUsed*   \_Out\_opt\_<br />Type: size\_t\*

The actual size, in bytes, of the *sandboxId* 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 *sandboxIdSize* is set to a value less than **XSystemXboxLiveSandboxIdMaxBytes**, the return value is set to **HRESULT\_FROM\_WIN32(ERROR\_INSUFFICIENT\_BUFFER)**.

## Remarks

Together with the TitleID and the Service Configuration ID (SCID), the sandbox ID is critical to the development of XBOX Live titles and applications. The sandbox ID identifies your sandbox, which provides content isolation for your development kit during development. Content isolation ensures that you have a clean environment for developing and testing your title.

<Note>
  Sandbox IDs are case sensitive.
</Note>

For XBOX and PC devices, the sandbox ID is stored on the device. If the sandbox ID is not found, or you do not have permissions to access the sandbox ID, the sandbox ID defaults to 'RETAIL'.

This function will also return 'RETAIL' if in fact your game is running in the retail environment.

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

[Configuring dev kit settings (NDA topic)](/home/setup-install/dev-kit-settings/config-dev-kit-settings)<br />[Setting up sandboxes for XBOX Live development](/services/xbox-services/fundamentals/sandboxes/live-setting-up-sandboxes)<br />[XSystemGetConsoleId](/reference/system/xsystem/functions/xsystemgetconsoleid)<br />[XSystem](/reference/system/xsystem/xsystem_members)


## Related topics

- [XSystem](/reference/system/xsystem/xsystem_members.md)
- [Determining console location](/build/game-principles/localization/determining-console-geolocation.md)
- [Sandboxes](/services/xbox-services/fundamentals/sandboxes/index.md)
- [XGameGetXboxTitleId](/reference/system/xgame/functions/xgamegetxboxtitleid.md)
- [PC Sandbox Switcher (XblPCSandbox.exe)](/tools/tools-services/live-pc-sandbox-switcher.md)
