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

# PlayFabMultiplayer.CreateMatchmakingTicket

> PlayFabMultiplayer.CreateMatchmakingTicket

## Method (1 of 3)

Creates a matchmaking ticket for one or more local users.

```csharp theme={null}
public static MatchmakingTicket CreateMatchmakingTicket(IList<MatchUser> localUsers, 
    string queueName, uint timeoutInSeconds = 120)
```

| parameter | description |
| - | - |
| localUsers | The array of local users along with local user attributes to include in the ticket. |
| queueName | The queue to which the ticket belongs. |
| timeoutInSeconds | How long to attempt matchmaking the ticket, in seconds. Defaults to 120 seconds |

## Return Value (1 of 3)

The resulting ticket object.

## Remarks (1 of 3)

The library automatically, and asynchronously, will submit all local users on a ticket to the matchmaking service. Each time the ticket status changes, a [`OnMatchmakingTicketStatusChanged`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnMatchmakingTicketStatusChanged) will be provided. The ticket status can be queried at any time via [`Status`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/MatchmakingTicket/Status). The ticket immediately starts in the `MatchmakingTicketStatus.Creating` state.

When the ticket has completed, a [`OnMatchmakingTicketStatusChanged`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnMatchmakingTicketStatusChanged) will be provided. At that point, a match will have been found or the ticket stopped due to failure. On success, the match that was found can be queried via [`GetMatchDetails`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/MatchmakingTicket/GetMatchDetails).

All existing tickets in which a local user is a member will be canceled as part of this operation.

A match can't be found until all remote users specified in the `membersToMatchWith` field of the `configuration` parameter have joined the ticket via [`JoinMatchmakingTicketFromId`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/JoinMatchmakingTicketFromId).

***

## Method (2 of 3)

Creates a matchmaking ticket for one or more local users.

```csharp theme={null}
public static MatchmakingTicket CreateMatchmakingTicket(MatchUser localUser, string queueName, 
    uint timeoutInSeconds = 120)
```

| parameter | description |
| - | - |
| localUser | The local user along with local user attributes to include in the ticket. |
| queueName | The queue to which the ticket belongs. |
| timeoutInSeconds | How long to attempt matchmaking the ticket, in seconds. Defaults to 120 seconds |

## Return Value (2 of 3)

The resulting ticket object.

## Remarks (2 of 3)

The library automatically, and asynchronously, will submit all local users on a ticket to the matchmaking service. Each time the ticket status changes, a [`OnMatchmakingTicketStatusChanged`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnMatchmakingTicketStatusChanged) will be provided. The ticket status can be queried at any time via [`Status`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/MatchmakingTicket/Status). The ticket immediately starts in the `MatchmakingTicketStatus.Creating` state.

When the ticket has completed, a [`OnMatchmakingTicketStatusChanged`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnMatchmakingTicketStatusChanged) will be provided. At that point, a match will have been found or the ticket stopped due to failure. On success, the match that was found can be queried via [`GetMatchDetails`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/MatchmakingTicket/GetMatchDetails).

All existing tickets in which a local user is a member will be canceled as part of this operation.

A match can't be found until all remote users specified in the `membersToMatchWith` field of the `configuration` parameter have joined the ticket via [`JoinMatchmakingTicketFromId`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/JoinMatchmakingTicketFromId).

***

## Method (3 of 3)

Creates a matchmaking ticket for one or more local users.

```csharp theme={null}
public static MatchmakingTicket CreateMatchmakingTicket(IList<MatchUser> localUsers, 
    string queueName, List<PFEntityKey> membersToMatchWith, uint timeoutInSeconds = 120)
```

| parameter | description |
| - | - |
| localUsers | The array of local users along with local user attributes to include in the ticket. |
| queueName | The queue to which the ticket belongs. |
| membersToMatchWith | The other specific users expected to join the ticket. |
| timeoutInSeconds | How long to attempt matchmaking the ticket, in seconds. Defaults to 120 seconds |

## Return Value (3 of 3)

The resulting ticket object.

## Remarks (3 of 3)

The library automatically, and asynchronously, will submit all local users on a ticket to the matchmaking service. Each time the ticket status changes, a [`OnMatchmakingTicketStatusChanged`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnMatchmakingTicketStatusChanged) will be provided. The ticket status can be queried at any time via [`Status`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/MatchmakingTicket/Status). The ticket immediately starts in the `MatchmakingTicketStatus.Creating` state.

When the ticket has completed, a [`OnMatchmakingTicketStatusChanged`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnMatchmakingTicketStatusChanged) will be provided. At that point, a match will have been found or the ticket stopped due to failure. On success, the match that was found can be queried via [`GetMatchDetails`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/MatchmakingTicket/GetMatchDetails).

All existing tickets in which a local user is a member will be canceled as part of this operation.

A match can't be found until all remote users specified in the `membersToMatchWith` field of the `configuration` parameter have joined the ticket via [`JoinMatchmakingTicketFromId`](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/JoinMatchmakingTicketFromId).

## See Also

* class [MatchmakingTicket](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/MatchmakingTicket/overview.md)
* struct [MatchUser](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/MatchUser/overview.md)
* class [PFEntityKey](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PFEntityKey/overview.md)
* class [PlayFabMultiplayer](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/overview.md)
* namespace [PlayFab.Multiplayer](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference.md)


## Related topics

- [PlayFabMultiplayer.OnMatchmakingTicketCompleted](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnMatchmakingTicketCompleted.md)
- [PlayFabMultiplayer.JoinMatchmakingTicketFromId](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/JoinMatchmakingTicketFromId.md)
- [PlayFabMultiplayer.OnMatchmakingTicketStatusChanged](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/PlayFabMultiplayer/OnMatchmakingTicketStatusChanged.md)
- [Create Matchmaking Ticket](https://docs.xbox.com/api-reference/matchmaking/create-matchmaking-ticket.md)
- [Matchmaking quickstart](https://docs.xbox.com/services/playfab/multiplayer/matchmaking/quickstart.md)
