# GET /tournaments/:id/matches/:matchId

This endpoint allows you to retrieve detailed information about a specific match within a tournament.
:::note
Works with a public API key for public tournaments (shared on a result page).
:::
 This endpoint is useful for getting up-to-date data on match status, scores, and participating players or teams. 

### entries
The structure of the entries field can vary depending on the type of tournament running.

:::caution
All teams or players can be `null`. For example, if a team in an elimination round has not yet been assigned, it will be indicated as `null`.
:::

#### Singles Tournament
For a Singles tournament it would appear as follows:
```json
"entries": [
  {
    "id": "05-2553",
    "name": "Helmut Poppen",
    "entries": [
      {
        "id": "05-2553",
        "name": "Helmut Poppen"
      }
    ]
  },
  {
    "id": "11-2482",
    "name": "Isabel Wagner",
    "entries": [
      {
        "id": "11-2482",
        "name": "Isabel Wagner"
      }
    ]
  }
],
```

#### Teams tournament
For a structiure for a fixed team tournament looks quite similar:
```json
"entries": [
{
    "id": "05-2553_05-4357",
    "name": "Helmut Poppen / Sophia Poppen",
    "entries": [
      {
        "id": "05-2553",
        "name": "Helmut Poppen"
      },
      {
        "id": "05-4357",
        "name": "Sophia Poppen"
      }
    ]
  },
  {
    "id": "05-9012_05-9876",
    "name": "Caroline Conrad / Andrei Andros",
    "entries": [
      {
        "id": "05-9876",
        "name": "Caroline Conrad"
      },
      {
        "id": "05-9012",
        "name": "Andrei Andros"
      }
    ]
  }
],
```

#### Variable Teams Tournament
We removed the variable teams, so the responses are uniform now.

:::note
There are tournament modes that support more than 2 players per team.
:::
:::caution
The team may be set to `null`, and there are even cases where a single player in a team is set to `null`. This occurs when the "Lord Have Mercy" system is enabled during an elimination.
:::

### Valid `state` values:
 - `open`: Match is waiting to be announced
 - `paused`: Match is disabled (on pause)
 - `skipped`: Match is skipped (e.g. Entry left tournament)
 - `running`: Match is running
 - `played`: Match is finished / played
 - `planned`: Match is planned / awaiting announcement
 - `incomplete`: Match is waiting for entries to be assigned
 - `bye`: Match is a bye (e.g. in elimination stage)

### courtIds
The courts (tables) the match is played on. While the match is `running` this is the current
court; after the result was saved it keeps the court(s) the match was played on, so the
assignment stays available for finished matches. The array is empty while the match has not
been announced yet, or when it was never assigned to a court. Most modes use one court per
match; some modes may play a match across several courts.

### encounters / score
The encounters array stores the detailed result of the match. It consists of 3 nested arrays:

```
1) Encounters: For league modes like Single/Double/Single every entry represents an encounter
   2) Sets: This is an array of winning sets
      3) Score: The actual result of an match is stored here
```

:::note
If a result is set, there will be a `displayScore` property that contains the calculated score.
:::

Simple Example: just one set
```json
"encounters": [
  [
    [7, 5]
  ]
],
"displayScore": [7, 5],
```

More complex: Best of 3
```json
"encounters": [
  [
    [7, 5],
    [6, 7],
    [2, 7]
  ]
],
"displayScore": [1, 3]
```

Max. Complexity: 3 Encounters - Best of 3, Best of one, Best of 5
```json
"encounters": [
  [
    [7, 5],
    [6, 7],
    [2, 7]
  ],
    [2, 7]
  ],
    [
    [6, 7],
    [7, 5],
    [2, 7],
    [7, 5],
    [2, 7],
  ],
],
"displayScore": [0, 3]
```
:::note
If "Quick Entry" for results is selected, scores are represented as `1` or `0`.
:::

## Parameters

| Parameter | In | Example |
| --- | --- | --- |
| `id` | path | `tio:4AHchFkVAecs2` |
| `matchId` | path | `tio:jl4V1KG3Djl4u` |

## Responses

```json
{
  "id": "tio:dWT5oSbv2kYQg",
  "entries": [
    {
      "id": "05-2553_05-4357",
      "name": "Helmut Poppen / Sophia Poppen"
    },
    {
      "id": "05-9012_05-9876",
      "name": "Caroline Conrad / Andrei Andros"
    }
  ],
  "state": "running",
  "encounters": [],
  "isLiveResult": true,
  
  "disciplineId": "tio:JHriFxv2ZBCYD",
  "disciplineName": "[D1] Discipline 1",
  "roundId": "tio:S0U825dvJ8v5a",
  "roundName": "Round 1",
  "groupId": "tio:bEC14gDhxf5pT",
  "groupName": "Qualification",
  
  "courtIds": ["tio:dLUOkXt5oHEvq"],
  
  "startTime": "2024-07-03T14:39:16.575Z"
}
```
```json
{
  "id": "tio:dWT5oSbv2kYQg",
  "entries": [
    {
      "id": "05-2553_05-4357",
      "name": "Helmut Poppen / Sophia Poppen",
      "entries": [
        {
          "id": "05-2553",
          "name": "Helmut Poppen"
        },
        {
          "id": "05-4357",
          "name": "Sophia Poppen"
        }
      ]
    },
    {
      "id": "05-9012_05-9876",
      "name": "Caroline Conrad / Andrei Andros",
      "entries": [
        {
          "id": "05-9876",
          "name": "Caroline Conrad"
        },
        {
          "id": "05-9012",
          "name": "Andrei Andros"
        }
      ]
    }
  ],
  "state": "played",
  "encounters": [
    [
      [
        0,
        1
      ]
    ]
  ],
  "displayScore": [
    0,
    1
  ],
  
  "disciplineId": "tio:JHriFxv2ZBCYD",
  "disciplineName": "[D1] Discipline 1",
  "roundId": "tio:S0U825dvJ8v5a",
  "roundName": "Round 1",
  "groupId": "tio:bEC14gDhxf5pT",
  "groupName": "Qualification",
  
  "courtIds": ["tio:dLUOkXt5oHEvq"],
  
  "startTime": "2024-07-03T14:39:16.575Z",
  "endTime": "2024-08-09T18:09:36.210Z"
}
```