> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squadassist.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# /get_clubs_in_competition

Use this endpoint to retrieve all clubs that are playing in the competition in the current seasion. These are the same competitions as can be found via`GET /competitions`.

## Authentication

All requests must include a valid API key, either as an `x-api-key` header or as a Bearer token in the `Authorization` header.

```http theme={null}
x-api-key: YOUR_API_KEY
# or
Authorization: Bearer YOUR_API_KEY
```

## Request

<ParamField query="competition_id" type="string" required>
  The SquadAssist competition ID. Obtain this from `GET /competitions`
</ParamField>

## Response

<ResponseField name="clubs" type="array[Club]">
  An array of club objects, one for each club in the competition.

  <Expandable title="Club object">
    <ResponseField name="squadassist_id" type="string">
      The squadassist\_id used in the API

      <ResponseField name="name" type="string">
        The full display name of the club.

        <ResponseField name="transfermarkt_id" type="string">
          The transfermarkt\_id of the club
        </ResponseField>
      </ResponseField>
    </ResponseField>
  </Expandable>
</ResponseField>

## Example

<CodeGroup>
  ```bash PowerShell theme={null}
  $headers = @{
      "x-api-key"    = "YOUR_API_KEY"
      "Content-Type" = "application/json"
  }

  curl "https://api.squadassist.ai/v1/get_clubs_in_competition?competition=BELGIAN_JUPILER_PRO_LEAGUE" -H $headers
  ```

  ```python Python theme={null}
  import requests

  # Set up the API endpoint with query parameters
  url = "https://api.squadassist.ai/v1/get_clubs_in_competition"
  params = {
      "competition": "BELGIAN_JUPILER_PRO_LEAGUE"
  }

  # Define the request headers
  headers = {
      "x-api-key": "YOUR_API_KEY",
      "Content-Type": "application/json"
  }

  # Execute the GET request
  response = requests.get(url, headers=headers, params=params)

  # Parse the JSON response into a Python object
  data = response.json()

  # Display the result
  print(data)
  ```

  ```r R theme={null}
  library(httr2)

  # Define the base URL
  url <- "https://api.squadassist.ai/v1/get_clubs_in_competition"

  # Set up the request with headers and query parameters
  request_obj <- request(url) %>%
    req_headers(
      "x-api-key" = "YOUR_API_KEY",
      "Content-Type" = "application/json"
    ) %>%
    req_url_query(
      "competition" = "BELGIAN_JUPILER_PRO_LEAGUE"
    )

  # Execute the request
  response <- req_perform(request_obj)

  # Extract and parse the JSON data
  data <- resp_body_json(response)

  # Print the result
  print(data)
  ```
</CodeGroup>

```json Response theme={null}
{
	"clubs": 
  	[
		{
		"squadassist_id": "C01JJBSWKE71ZEN2E52257YQGP5",
		"transfermarkt_id": 520, 
		"name" : "Cercle Brugge"
		},
	...
	]

}
```
