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

# PFMatchmakingTicketGetTicketId

> Retrieves the unique ticket ID assigned to a PlayFab Multiplayer matchmaking ticket, used to join or reference the ticket from other client sessions.

Provides the ticket ID.

## Syntax

```cpp theme={null}
HRESULT PFMatchmakingTicketGetTicketId(  
    PFMatchmakingTicketHandle ticket,  
    const char** id  
)  
```

### Parameters

**`ticket`**   PFMatchmakingTicketHandle

The handle of the matchmaking ticket.

**`id`**   char\*\*\
*library-allocated output*

The ticket ID.

### Return value

Type: HRESULT

`S_OK` if the call succeeded or an error code otherwise. The human-readable form of the error code can be retrieved via [PFMultiplayerGetErrorMessage()](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmultiplayer/functions/pfmultiplayergeterrormessage.md).

## Remarks

The ticket ID will be an empty string if it has not yet been set. This can occur under one of the following conditions:

* The ticket is in the `PFMatchmakingTicketStatus::Creating` state
* The ticket is in the `PFMatchmakingTicketStatus::Failed` state due to failure to submit a ticket to the matchmaking service
* The ticket was canceled before it could be submitted to the matchmaking service

## Requirements

**Header:** PFMatchmaking.h

## See also

[PFMatchmaking members](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/pfmatchmaking_members.md)


## Related topics

- [PFMultiplayer C/C++ API overview - PFMatchmaking.h](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/pfmatchmaking_members.md)
- [PlayFab Multiplayer C++ SDK Release Notes](https://docs.xbox.com/services/playfab/multiplayer/lobby/lobby-matchmaking-sdks/lobby-and-matchmaking-release-notes.md)
- [Get Matchmaking Ticket](https://docs.xbox.com/api-reference/matchmaking/get-matchmaking-ticket.md)
- [MatchmakingTicket.TicketId](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/MatchmakingTicket/TicketId.md)
- [PFMultiplayerJoinMatchmakingTicketFromId](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/functions/pfmultiplayerjoinmatchmakingticketfromid.md)
