> 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/invoicing/tax-rates.md).

# Tax Rates

Manage tax rates in Teamleader Focus.

```php
Teamleader::taxRates()
```

|                          |                                                                       |
| ------------------------ | --------------------------------------------------------------------- |
| Class                    | `McoreServices\TeamleaderSDK\Resources\Invoicing\TaxRates`            |
| Create / update / delete | — / — / —                                                             |
| Pagination               | `page_size` / `page_number`; no totals — a short page is the last one |

## Endpoints

* `taxRates.list`

## Filters

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

| Filter          | Description               |
| --------------- | ------------------------- |
| `department_id` | Filter by department UUID |

## Sorting

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

| Field           | Description |
| --------------- | ----------- |
| `department_id` | Department  |
| `description`   | Description |
| `rate`          | Tax rate    |

## Methods

### `list()`

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

List tax rates with filtering, sorting, and pagination

* `$filters` — Filter parameters
* `$options` — Pagination and sorting options

### `forDepartment()`

```php
forDepartment(string $departmentId, array $options = []): array
```

Get tax rates for a specific department

* `$departmentId` — Department UUID
* `$options` — Pagination and sorting options

### `find()`

```php
find(string $id): ?array
```

Find a tax rate by ID

* `$id` — Tax rate UUID

### `findByRate()`

```php
findByRate(float $rate, ?string $departmentId = null): ?array
```

Find a tax rate by exact rate value

* `$rate` — Tax rate (e.g., 0.21 for 21%)
* `$departmentId` — Optional department filter

### `findByRateRange()`

```php
findByRateRange(float $minRate, float $maxRate, ?string $departmentId = null): array
```

Find tax rates by rate range

* `$minRate` — Minimum rate (inclusive)
* `$maxRate` — Maximum rate (inclusive)
* `$departmentId` — Optional department filter

### `findByDescription()`

```php
findByDescription(string $description, ?string $departmentId = null, bool $exactMatch = true): ?array
```

Find a tax rate by description

* `$description` — Tax rate description (e.g., "21%")
* `$departmentId` — Optional department filter
* `$exactMatch` — Whether to match exactly or search partial

### `exists()`

```php
exists(string $id): bool
```

Check if a tax rate exists by ID

* `$id` — Tax rate UUID

### `all()`

```php
all(array $filters = [], int $maxPages = 10): array
```

Get all tax rates (handles pagination automatically)

* `$filters` — Filters to apply
* `$maxPages` — Maximum number of pages to fetch (default: 10)

### `asOptions()`

```php
asOptions(?string $departmentId = null): array
```

Get tax rates formatted as options for select dropdowns

* `$departmentId` — Optional department filter

### `groupedByDepartment()`

```php
groupedByDepartment(): array
```

Get tax rates grouped by department

### `sortedByRate()`

```php
sortedByRate(array $filters = []): array
```

Get tax rates sorted by rate ascending

* `$filters` — Additional filters

### `sortedByDescription()`

```php
sortedByDescription(array $filters = [], string $order = 'asc'): array
```

Get tax rates sorted by description

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

### `getResponseStructure()`

```php
getResponseStructure(): array
```

Get response structure documentation

## Examples

Get all tax rates:

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

Get tax rates for a specific department:

```php
$taxRates = Teamleader::taxRates()->forDepartment('department-uuid');
```

Get tax rates sorted by rate:

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

Find tax rate by exact rate value:

```php
$taxRate = Teamleader::taxRates()->findByRate(0.21);
```

Find tax rate by description:

```php
$taxRate = Teamleader::taxRates()->findByDescription("21%");
```

Get tax rates as key-value pairs for dropdowns:

```php
$options = Teamleader::taxRates()->asOptions();
```
