> 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/other/migrate.md).

# Migrate

Utility endpoints for migrating from the deprecated Teamleader API to the new UUID-based API.

```php
Teamleader::migrate()
```

|                          |                                                       |
| ------------------------ | ----------------------------------------------------- |
| Class                    | `McoreServices\TeamleaderSDK\Resources\Other\Migrate` |
| Create / update / delete | — / — / —                                             |
| Pagination               | No                                                    |

## Endpoints

* `migrate.activityType`
* `migrate.id`
* `migrate.taxRate`

## Filters

`list()` takes no filters.

## Accepted values

Public constants on the class. Body fields and enum values outside these lists throw before the request is sent.

| Constant         | Values                                                                                                                                                                                                                                  |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ACTIVITY_TYPES` | `meeting`, `call`, `task`                                                                                                                                                                                                               |
| `RESOURCE_TYPES` | `account`, `user`, `department`, `product`, `contact`, `company`, `deal`, `dealPhase`, `project`, `milestone`, `task`, `meeting`, `call`, `ticket`, `invoice`, `creditNote`, `subscription`, `quotation`, `timeTracking`, `customField` |

## Methods

### `activityType()`

```php
activityType(string $type): array
```

Translate activity type (meeting, call, task) into activity type UUID

* `$type` — Activity type (meeting, call, or task)

**Throws** `InvalidArgumentException`

### `taxRate()`

```php
taxRate(string $departmentId, string $taxRate): array
```

Translate old tax rate to new UUID tax rate

* `$departmentId` — Department UUID
* `$taxRate` — Tax rate as string (e.g., "21", "6", "0")

**Throws** `InvalidArgumentException`

### `id()`

```php
id(string $type, int $id): array
```

Translate old numeric ID to new UUID

* `$type` — Resource type (contact, company, invoice, etc.)
* `$id` — Old numeric ID

**Throws** `InvalidArgumentException`

### `batchIds()`

```php
batchIds(string $type, array $ids): array
```

Batch migrate multiple IDs of the same type This is a convenience method that calls the API multiple times

* `$type` — Resource type
* `$ids` — Array of old numeric IDs

**Throws** `InvalidArgumentException`

### `getActivityTypes()`

```php
getActivityTypes(): array
```

Get all valid activity types

### `getResourceTypes()`

```php
getResourceTypes(): array
```

Get all valid resource types for ID migration

### `isValidActivityType()`

```php
isValidActivityType(string $type): bool
```

Check if an activity type is valid

### `isValidResourceType()`

```php
isValidResourceType(string $type): bool
```

Check if a resource type is valid for migration

### `getResponseStructure()`

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

Get response structure documentation

### `list()`

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

Override list method as it's not supported for migration endpoints

### `info()`

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

Override info method as it's not supported for migration endpoints

## Examples

Translate meeting, call, or task into activity type UUID:

```php
$result = Teamleader::migrate()->activityType("meeting");
// Returns: ["data" => ["id" => "uuid", "type" => "meeting"]]
```

Translate old tax rate to new UUID tax rate:

```php
$result = Teamleader::migrate()->taxRate(
    "department-uuid",
    "21"
);
```

Translate old contact ID to new UUID:

```php
$result = Teamleader::migrate()->id("contact", 123);
// Returns: ["data" => ["type" => "contact", "id" => "new-uuid"]]
```

Translate old invoice ID to new UUID:

```php
$result = Teamleader::migrate()->id("invoice", 456);
```

Migrate multiple IDs in a loop:

```php
$oldIds = [1, 2, 3, 4, 5];
$newIds = [];

foreach ($oldIds as $oldId) {
    $result = Teamleader::migrate()->id("contact", $oldId);
    $newIds[$oldId] = $result["data"]["id"];
}
```
