# List teams `GET /api/v1/teams` Lists teams in the workspace. Send X-Sport-Id to list teams for one sport. ## Permissions Send your API key in `X-API-Key`. Required permissions are **Teams → Read**. ## Headers - `X-Sport-Id` (integer) — Limits the result to one sport. Omit it for the workspace-wide view. ## Query parameters - `status` (string) — Returns active teams by default. Use `archived` for archived teams or `all` for both. - `q` (string) — Searches team names. The API also accepts `search[value]`. - `athlete_id` (integer) — Filters teams by athlete ID. Use only one member filter per request. - `coach_id` (integer) — Filters teams by coach ID. - `director_id` (integer) — Filters teams by director ID. - `staff_id` (integer) — Filters teams by staff ID. - `length` (integer) — Positive page size. Omit it to return all matches. - `start` (integer) — Zero-based offset. Defaults to `0`. Use it with `length`. - `sort` (string) — Comma-separated sort fields. Supports `id`, `name`, `tsc`, `tsu`, and the three count fields. Prefix a field with `-` for descending order. - `order` (string) — Defaults to `asc`. Use `desc` for sort fields without a direction prefix. The list also accepts table-style sorting with `order[0][column]`, `order[0][dir]`, and `columns[index][data]`. - `fields[teams]` (string) — Requests derived columns, such as `count_athletes,count_coaches,count_directors`. Financial fields require Subscriptions and Payments read access. - `view_totals` (integer) — Send `1` to include financial totals and membership counts. Financial totals and sorting by `total`, `paid`, `left`, or their aliases `total_amount`, `total_paid`, and `total_left` require Subscriptions and Payments read access. - `draw` (string) — Optional request marker echoed in the response. ## Request Set ASDINCLOUD_API_KEY and SPORT_ID before running. ```sh curl --get \ --url "https://api.asdincloud.com/api/v1/teams" \ --header "X-API-Key: $ASDINCLOUD_API_KEY" \ --header "X-Sport-Id: $SPORT_ID" \ --data-urlencode "sort=name" \ --data-urlencode "length=10" \ --data-urlencode "fields[teams]=count_athletes,count_coaches,count_directors" ``` ## Response **200 OK** `data` contains one page of teams. `records_total` counts teams after the sport, status, and member filters. `records_filtered` also applies text search. Both counts are before pagination. Request the count fields explicitly when you need all three membership counts. Without a sport filter, the API can include an embedded `sport` object. Example with fictional data and selected fields. ```json { "status": "success", "records_total": 1, "records_filtered": 1, "data": [ { "id": 12, "sport_id": 1, "name": "Under 14 Basketball", "archived_at": null, "count_athletes": 4, "count_coaches": 1, "count_directors": 0 } ], "draw": null } ``` ## Errors - `401` — The API key is missing or invalid. - `403` — The API key lacks one or more required permissions.