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

# 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](https://docs.xbox.com/reference/system/xgameui/functions/xgameuishowsendgameinviteasync.md) 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](https://docs.xbox.com/services/xbox-services/multiplayer/mpa/concepts/live-mpa-recent-players.md)
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](https://docs.xbox.com/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayersendinvitesasync.md) API to send invites to a set of users that are defined
by their [XboxUserId (XUID)](https://docs.xbox.com/services/xbox-services/multiplayer/mpa/concepts/live-mpa-activities.md) 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)](https://docs.xbox.com/reference/system/xgameactivation/xgameactivation_members.md)
* [xgameui (API contents)](https://docs.xbox.com/reference/system/xgameui/xgameui_members.md)
  * Functions
    * [XGameUiShowSendGameInviteAsync](https://docs.xbox.com/reference/system/xgameui/functions/xgameuishowsendgameinviteasync.md)
* [multiplayer\_c (API contents)](https://docs.xbox.com/reference/live/xsapi-c/multiplayer_c/multiplayer_c_members.md)
  * Functions
    * [XblMultiplayerSendInvitesAsync](https://docs.xbox.com/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayersendinvitesasync.md)
    * [XblMultiplayerSendInvitesResult](https://docs.xbox.com/reference/live/xsapi-c/multiplayer_c/functions/xblmultiplayersendinvitesresult.md)
  * Structures
    * [XblMultiplayerInviteHandle](https://docs.xbox.com/reference/live/xsapi-c/multiplayer_c/structs/xblmultiplayerinvitehandle.md)
* [xasync (API contents)](https://docs.xbox.com/reference/system/xasync/xasync_members.md)
  * Structures
    * [XAsyncBlock](https://docs.xbox.com/reference/system/xasync/structs/xasyncblock.md)

## See also

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


## Related topics

- [Invites](https://docs.xbox.com/services/xbox-services/multiplayer/mpa/concepts/live-mpa-invites.md)
- [Sending invites to another player (flowchart)](https://docs.xbox.com/services/xbox-services/multiplayer/mpm/concepts/flowcharts/live-mpm-send-invites.md)
- [Invites overview](https://docs.xbox.com/services/xbox-services/multiplayer/invites/live-multiplayer-invites-overview.md)
- [Invites example code (contents)](https://docs.xbox.com/services/xbox-services/multiplayer/invites/how-to/live-invites-howto-nav.md)
- [-Invite players to game sessions](https://docs.xbox.com/services/xbox-services/multiplayer/invites/live-invites-nav.md)
