> For the complete documentation index, see [llms.txt](https://teamleader-sdk.mcore-services.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://teamleader-sdk.mcore-services.dev/api-reference/general/teams.md).

# Teams

Manage teams in Teamleader Focus.

```php
Teamleader::teams()
```

|                          |                                                       |
| ------------------------ | ----------------------------------------------------- |
| Class                    | `McoreServices\TeamleaderSDK\Resources\General\Teams` |
| Create / update / delete | — / — / —                                             |
| Pagination               | No                                                    |

## Endpoints

* `teams.list`

## Filters

Passed as the first argument to `list()`. Any other key throws.

| Filter         | Description                         |
| -------------- | ----------------------------------- |
| `ids`          | Array of team UUIDs to filter by    |
| `team_lead_id` | Filter teams by team leader user ID |
| `term`         | Filter by team name                 |

## Sorting

Pass `sort` (and optionally `sort_order`) in the options. Any other field throws.

| Field  | Description |
| ------ | ----------- |
| `name` | Team name   |

## Methods

### `search()`

```php
search(string $term): array
```

Search teams by name

* `$term` — Search term

### `list()`

```php
list(array $filters = [], array $options = []): array
```

List teams with filtering and sorting

* `$filters` — Filters to apply
* `$options` — Additional options (sorting)

### `byIds()`

```php
byIds(array $ids): array
```

Get teams by specific IDs

* `$ids` — Array of team UUIDs

### `byTeamLead()`

```php
byTeamLead(string $teamLeadId): array
```

Get teams by team leader

* `$teamLeadId` — User UUID of the team leader

### `sortedByName()`

```php
sortedByName(string $order = 'asc'): array
```

Get teams sorted by name

* `$order` — Sort order (asc or desc)

### `info()`

```php
info($id, $includes = null)
```

Override info method with compatible signature but throw exception

### `create()`

```php
create(array $data)
```

Override create method with compatible signature but throw exception

### `update()`

```php
update($id, array $data)
```

Override update method with compatible signature but throw exception

### `delete()`

```php
delete($id, ...$additionalParams): array
```

Override delete method with compatible signature but throw exception Fixed signature to match parent class

## Examples

Get all teams:

```php
$teams = Teamleader::teams()->list();
```

Search teams by name:

```php
$teams = Teamleader::teams()->list(['term' => 'Designers']);
```

Get teams by team leader:

```php
$teams = Teamleader::teams()->list(['team_lead_id' => 'user-uuid']);
```

Get teams sorted by name:

```php
$teams = Teamleader::teams()->list([], ['sort' => [['field' => 'name', 'order' => 'asc']]]);
```

Get specific teams by ID:

```php
$teams = Teamleader::teams()->list(['ids' => ['team-uuid-1', 'team-uuid-2']]);
```
