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

# Sending invites

> Send XBOX multiplayer game invites from a title using the Title-Callable UI overlay or the XblMultiplayerSendInvitesAsync API with a custom in-game UI.

Use this topic to configure user-to-user multiplayer game sessions on XBOX services.

Your game sends invites to other users to join your game session. There are two ways to send a game invite to other users.
You can use the Title-Callable UI (TCUI) (System UI overlay), or you can use a title-implemented custom UI.

## Using the Title-Callable UI (TCUI) (System UI overlay)

Calling the [XGameUiShowSendGameInviteAsync](/reference/system/xgameui/functions/xgameuishowsendgameinviteasync) API retrieves the standard System UI overlay for inviting friends.
This displays a UI that the user can navigate to select friends or users from the [Recent Players list](/services/xbox-services/multiplayer/mpa/concepts/live-mpa-recent-players)
to invite to the game. When the user selects **Confirm**, the invite is sent to the selected users.

## Using a title-implemented custom UI

Your title can implement a custom UI for viewing online friends and inviting them to game sessions.
Use the [XblMultiplayerSendInvitesAsync](/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayersendinvitesasync) API to send invites to a set of users that are defined
by their [XboxUserId (XUID)](/services/xbox-services/multiplayer/mpa/concepts/live-mpa-activities) as shown in the following code.
This is useful if you prefer to use your own in-game UI instead of the stock System UI.

### Flat C

```cpp theme={null}
auto asyncBlock = std::make_unique<XAsyncBlock>();
asyncBlock->queue = queue;
asyncBlock->context = nullptr;
asyncBlock->callback = [](XAsyncBlock* asyncBlock)
{
    std::unique_ptr<XAsyncBlock> asyncBlockPtr{ asyncBlock }; // Take ownership of the XAsyncBlock*
    size_t handlesCount = 1; // must be equal to invites that are requested
    XblMultiplayerInviteHandle handles[1] = {};
    HRESULT hr = XblMultiplayerSendInvitesResult(asyncBlock, handlesCount, handles);
};

uint64_t xuids[1] = {};
xuids[0] = targetXuid;
size_t xuidsCount = 1;

HRESULT hr = XblMultiplayerSendInvitesAsync(
    xblContextHandle,
    &sessionReference,
    xuids,
    xuidsCount,
    titleId,
    contextStringId,
    customActivationContext,
    asyncBlock.get());
if (SUCCEEDED(hr))
{
    // The call succeeded, so release the std::unique_ptr ownership of XAsyncBlock* since the callback will take ownership.
    // If the call fails, the std::unique_ptr will keep ownership and delete the XAsyncBlock*
    asyncBlock.release();
}
```

## Reference API documentation

* [Xgameactivation (API contents)](/reference/system/xgameactivation/xgameactivation_members)
* [xgameui (API contents)](/reference/system/xgameui/xgameui_members)
  * Functions
    * [XGameUiShowSendGameInviteAsync](/reference/system/xgameui/functions/xgameuishowsendgameinviteasync)
* [multiplayer\_c (API contents)](/reference/live/xsapi-c/multiplayer_c/multiplayer_c_members)
  * Functions
    * [XblMultiplayerSendInvitesAsync](/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayersendinvitesasync)
    * [XblMultiplayerSendInvitesResult](/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayersendinvitesresult)
  * Structures
    * [XblMultiplayerInviteHandle](/reference/live/xsapi-c/multiplayer_c/structs/xblmultiplayerinvitehandle)
* [xasync (API contents)](/reference/system/xasync/xasync_members)
  * Structures
    * [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)

## See also

[XAsyncBlock](/reference/system/xasync/structs/xasyncblock)
[XblMultiplayerInviteHandle](/reference/live/xsapi-c/multiplayer_c/structs/xblmultiplayerinvitehandle)
[XblMultiplayerSendInvitesAsync](/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayersendinvitesasync)
[XblMultiplayerSendInvitesResult](/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayersendinvitesresult)
[XGameActivation (API Reference)](/reference/system/xgameactivation/xgameactivation_members)
[Handling protocol activation to start a game, using Multiplayer Manager](/services/xbox-services/multiplayer/mpm/how-to/live-handle-protocol-activation)
[Sending game invites using Multiplayer Manager](/services/xbox-services/multiplayer/mpm/how-to/live-send-game-invites)


## Related topics

- [Sending invites to another player (flowchart)](/services/xbox-services/multiplayer/mpm/concepts/flowcharts/live-mpm-send-invites.md)
- [Sending game invites using Multiplayer Manager](/services/xbox-services/multiplayer/mpm/how-to/live-send-game-invites.md)
- [Invites overview](/services/xbox-services/multiplayer/invites/live-multiplayer-invites-overview.md)
- [Invites example code](/services/xbox-services/multiplayer/invites/how-to/live-invites-howto-nav.md)
- [Invite players to game sessions](/services/xbox-services/multiplayer/invites/live-invites-nav.md)
