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

# XGameGetXboxTitleId

> XGameGetXboxTitleId

# XGameGetXboxTitleId

Returns the TitleID for the game.

## Syntax

```cpp theme={null}
HRESULT XGameGetXboxTitleId(  
         uint32_t* titleId  
)  
```

### Parameters

*titleId*   \_Out\_\
Type: uint32\_t\*

A pointer to the TitleID of the game.

### 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 TitleID is not configured by the game developer in the MicrosoftGame.config file, then the return value is set to **HRESULT\_FROM\_WIN32(ERROR\_NOT\_FOUND)**.

## 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 TitleID uniquely identifies your game to XBOX Live services. It is used throughout XBOX Live services to enable your users to access your game's Live content, such as user statistics and achievements, and to enable Live multiplayer functionality. The TitleID is stored in the MicrosoftGame.config manifest file for your game.

The following example generates a URL for calling a back-end REST service used by the game. The **XGameGetXBoxTitleId** function is called to include the TitleID as part of the URL.

```cpp theme={null}
std::string GetBackendServiceUrl()  
{  
    uint32_t titleId;  
  
    RetailAssert(SUCCEEDED(XGameGetXboxTitleId(&titleId)));  
  
    std::stringstream url;  
    url << "https://example.com/some/api/call";  
  
    url << std::hex << std::uppercase << std::setfill('0');  
    url << "/titleId/" << std::setw(8) << titleId;  
  
    return url.str();  
}   
```

## Requirements

**Header:** XGame.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

[MicrosoftGame.config](/build/core-features/common/game-config/MicrosoftGameConfig-toc)\
[XGame](/reference/system/xgame/xgame_members)\
[Setting up sandboxes for XBOX Live development](/services/xbox-services/fundamentals/sandboxes/live-setting-up-sandboxes)


## Related topics

- [XGame](/reference/system/xgame/xgame_members.md)
- [Getting started with packaging titles for XBOX consoles](/build/core-features/common/packaging/overviews/packaging-getting-started-for-console.md)
- [XSystemGetXboxLiveSandboxId](/reference/system/xsystem/functions/xsystemgetxboxlivesandboxid.md)
- [Get started packaging PC titles with MSIXVC tools](/build/core-features/common/packaging/overviews/packaging-getting-started-for-PC.md)
- [Build and run your first console title with GDKX](/home/build-first-title/first-console-title-walkthrough.md)
