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

# Cancel Matchmaking Ticket

> Cancel a matchmaking ticket.

## Error codes

This operation may return the following PlayFab errors:

| Error | Code |
| --- | --- |
| MatchmakingEntityInvalid | 2001 |
| MatchmakingPlayerHasNotJoinedTicket | 2053 |
| MatchmakingQueueNotFound | 2016 |
| MatchmakingRateLimitExceeded | 2054 |
| MatchmakingRequestTypeMismatch | 2058 |
| MatchmakingTicketAlreadyCompleted | 2029 |
| MatchmakingTicketNotFound | 2018 |
| MatchmakingUnauthorized | 2056 |




## OpenAPI

````yaml /services/playfab/api-references/rest/multiplayer/multiplayer.openapi.json post /Match/CancelMatchmakingTicket
openapi: 3.0.0
info:
  version: '260922'
  title: PlayFab Multiplayer API
  description: >-
    API methods for managing multiplayer servers. API methods for managing
    parties. The lobby service helps players group together to play multiplayer
    games. It is often used as a rendezvous point for players to share
    connection information. The TrueSkill service helps titles to estimate a
    player's skill based on their match results. The player skill values from
    this service are commonly used by a matchmaking service to provide players
    with balanced matches.
  termsOfService: https://playfab.com/terms/
  contact:
    url: https://community.playfab.com/index.html
  license:
    name: Apache 2.0
    url: https://github.com/PlayFab/API_Specs/blob/master/LICENSE
servers:
  - url: https://{titleId}.playfabapi.com
    description: PlayFab title endpoint
    variables:
      titleId:
        default: your_title_id
        description: Your PlayFab title ID (hex).
security: []
tags:
  - name: Lobby
    description: ''
  - name: Matchmaking
    description: Matchmaking APIs
  - name: Matchmaking Admin
    description: Matchmaking Admin APIs
  - name: MultiplayerServer
    description: Multiplayer Server APIs
  - name: PubSub
    description: PlayFab PubSub APIs
  - name: TrueSkill
    description: TrueSkill APIs
  - name: TrueSkill Admin
    description: TrueSkill Admin APIs
paths:
  /Match/CancelMatchmakingTicket:
    post:
      tags:
        - Matchmaking
      summary: Cancel Matchmaking Ticket
      description: |
        Cancel a matchmaking ticket.

        ## Error codes

        This operation may return the following PlayFab errors:

        | Error | Code |
        | --- | --- |
        | MatchmakingEntityInvalid | 2001 |
        | MatchmakingPlayerHasNotJoinedTicket | 2053 |
        | MatchmakingQueueNotFound | 2016 |
        | MatchmakingRateLimitExceeded | 2054 |
        | MatchmakingRequestTypeMismatch | 2058 |
        | MatchmakingTicketAlreadyCompleted | 2029 |
        | MatchmakingTicketNotFound | 2018 |
        | MatchmakingUnauthorized | 2056 |
      operationId: CancelMatchmakingTicket
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelMatchmakingTicketRequest'
        description: >-
          Only servers and ticket members can cancel a ticket. The ticket can be
          in five different states when it is cancelled. 1: the ticket is
          waiting for members to join it, and it has not started matching. If
          the ticket is cancelled at this stage, it will never match. 2: the
          ticket is matching. If the ticket is cancelled, it will stop matching.
          3: the ticket is matched. A matched ticket cannot be cancelled. 4: the
          ticket is already cancelled and nothing happens. 5: the ticket is
          waiting for a server. If the ticket is cancelled, server allocation
          will be stopped. A server may still be allocated due to a race
          condition, but that will not be reflected in the ticket. There may be
          race conditions between the ticket getting matched and the client
          making a cancellation request. The client must handle the possibility
          that the cancel request fails if a match is found before the
          cancellation request is processed. We do not allow resubmitting a
          cancelled ticket because players must consent to enter matchmaking
          again. Create a new ticket instead.
      responses:
        '200':
          $ref: '#/components/responses/CancelMatchmakingTicketResult'
        '400':
          $ref: '#/components/responses/ApiErrorWrapper'
      security:
        - EntityToken: []
components:
  schemas:
    CancelMatchmakingTicketRequest:
      description: >-
        Only servers and ticket members can cancel a ticket. The ticket can be
        in five different states when it is cancelled. 1: the ticket is waiting
        for members to join it, and it has not started matching. If the ticket
        is cancelled at this stage, it will never match. 2: the ticket is
        matching. If the ticket is cancelled, it will stop matching. 3: the
        ticket is matched. A matched ticket cannot be cancelled. 4: the ticket
        is already cancelled and nothing happens. 5: the ticket is waiting for a
        server. If the ticket is cancelled, server allocation will be stopped. A
        server may still be allocated due to a race condition, but that will not
        be reflected in the ticket. There may be race conditions between the
        ticket getting matched and the client making a cancellation request. The
        client must handle the possibility that the cancel request fails if a
        match is found before the cancellation request is processed. We do not
        allow resubmitting a cancelled ticket because players must consent to
        enter matchmaking again. Create a new ticket instead.
      type: object
      properties:
        CustomTags:
          description: >-
            The optional custom tags associated with the request (e.g. build
            number, external trace identifiers, etc.).
          type: object
        QueueName:
          description: The name of the queue the ticket is in.
          type: string
        TicketId:
          description: The Id of the ticket to find a match for.
          type: string
      required:
        - TicketId
        - QueueName
      example:
        TicketId: 1c4b0daa-150e-47ae-9923-d770c0f9b07c
        QueueName: custom123
    CancelMatchmakingTicketResult:
      type: object
      properties: {}
      example: {}
    ApiErrorWrapper:
      description: The basic wrapper around every failed API response
      type: object
      properties:
        code:
          description: Numerical HTTP code
          type: integer
        status:
          description: String HTTP code
          type: string
        error:
          description: Playfab error code
          type: string
        errorCode:
          description: Numerical PlayFab error code
          type: integer
        errorMessage:
          description: Description for the PlayFab errorCode
          type: string
        errorDetails:
          description: Detailed description of individual issues with the request object
          type: object
      required:
        - code
        - errorCode
  responses:
    CancelMatchmakingTicketResult:
      description: ''
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: integer
                description: >-
                  The Http status code. If X-ReportErrorAsSuccess header is set
                  to true, this will report the actual http error code.
              status:
                type: string
                description: The Http status code as a string.
              data:
                $ref: '#/components/schemas/CancelMatchmakingTicketResult'
            example:
              code: 200
              status: OK
              data: {}
    ApiErrorWrapper:
      description: This is the outer wrapper for all responses with errors
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorWrapper'
  securitySchemes:
    EntityToken:
      type: apiKey
      in: header
      name: X-EntityToken
      description: >-
        This API requires an Entity Session Token, available from the Entity
        GetEntityToken method.

````

## Related topics

- [Cancel Matchmaking Ticket](/services/playfab/api-references/rest/multiplayer/matchmaking/cancel-matchmaking-ticket.md)
- [Matchmaking quickstart](/services/playfab/multiplayer/matchmaking/quickstart.md)
- [MatchmakingTicket.Cancel](/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/MatchmakingTicket/Cancel.md)
- [PFMatchmakingTicketCancel](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/functions/pfmatchmakingticketcancel.md)
- [Cancel All Matchmaking Tickets For Player](/services/playfab/api-references/rest/multiplayer/matchmaking/cancel-all-matchmaking-tickets-for-player.md)
