> 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/projects/legacy-projects.md).

# Legacy Projects

Manage legacy projects in Teamleader Focus — the original project system (API path projects, webhook events project.\*). See Projects for the current system.

LegacyProjects — the original project system in Teamleader Focus.

The names do not line up with the class names; to be explicit:

```
SDK method   Teamleader::legacyProjects()
API path     projects.*        (the bare path belongs to the OLD system)
Webhooks     project.created, project.updated, project.deleted
```

The current system is `Projects`, on the `projects-v2/projects.*` path, with `nextgenProject.*` webhook events. So the class names and the endpoint paths run in opposite directions: `Projects` is the newer class on the longer path, `LegacyProjects` is the older class on the shorter one.

**Do not infer which system an account is on from whether a list call returns rows.** Both endpoints answer. Ask directly:

```
Teamleader::accounts()->getProjectsVersion();      // "projects-v2" or "legacy"
Teamleader::accounts()->isUsingLegacyProjects();   // bool
```

Accounts are migrated to the new system over time; Accounts::getAutoSwitchDate() reports when, if it is scheduled.

```php
Teamleader::legacyProjects()
```

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

## Endpoints

* `projects.addParticipant`
* `projects.close`
* `projects.create`
* `projects.delete`
* `projects.info`
* `projects.list`
* `projects.reopen`
* `projects.update`
* `projects.updateParticipant`

## Filters

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

| Filter           | Description                                        |
| ---------------- | -------------------------------------------------- |
| `customer.id`    | Customer UUID                                      |
| `customer.type`  | Customer type (contact, company)                   |
| `participant_id` | Filter by participant UUID                         |
| `status`         | Project status (active, on\_hold, done, cancelled) |
| `term`           | Search term (searches title or description)        |
| `updated_since`  | ISO 8601 datetime                                  |

## Sorting

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

| Field        | Description              |
| ------------ | ------------------------ |
| `created_at` | Sort by creation date    |
| `due_on`     | Sort by project due date |
| `title`      | Sort by project title    |

## Accepted values

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

| Constant         | Values                                                                                                                                                          |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CREATE_FIELDS`  | `title`, `description`, `starts_on`, `milestones`, `participants`, `customer`, `purchase_order_number`, `custom_fields`                                         |
| `CURRENCIES`     | `BAM`, `CAD`, `CHF`, `CLP`, `CNY`, `COP`, `CZK`, `DKK`, `EUR`, `GBP`, `INR`, `ISK`, `JPY`, `MAD`, `MXN`, `NOK`, `PEN`, `PLN`, `RON`, `SEK`, `TRY`, `USD`, `ZAR` |
| `CUSTOMER_TYPES` | `contact`, `company`                                                                                                                                            |
| `ROLES`          | `decision_maker`, `member`                                                                                                                                      |
| `STATUSES`       | `active`, `on_hold`, `done`, `cancelled`                                                                                                                        |
| `UPDATE_FIELDS`  | `title`, `description`, `status`, `starts_on`, `customer`, `budget`, `purchase_order_number`, `custom_fields`                                                   |

## Methods

### `info()`

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

Get detailed information about a specific project

* `$id` — Project UUID
* `$includes` — Not used for legacy projects

### `create()`

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

Create a new project

* `$data` — Project data

### `update()`

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

Update an existing project

* `$id` — Project UUID
* `$data` — Project data to update

### `delete()`

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

Delete a project

* `$id` — Project UUID
* `$additionalParams` — Not used for legacy projects

### `close()`

```php
close(string $id): array
```

Close a project (also closes all phases and tasks)

* `$id` — Project UUID

### `reopen()`

```php
reopen(string $id): array
```

Reopen a closed project

* `$id` — Project UUID

### `addParticipant()`

```php
addParticipant(string $id, array $participant, ?string $role = 'member'): array
```

Add a participant to a project

* `$id` — Project UUID
* `$participant` — Participant data
* `$role` — Participant role (decision\_maker, member)

### `updateParticipant()`

```php
updateParticipant(string $id, array $participant, string $role): array
```

Update a participant's role in a project

* `$id` — Project UUID
* `$participant` — Participant data
* `$role` — New role (decision\_maker, member)

### `active()`

```php
active(array $options = []): array
```

Get active projects

* `$options` — Additional options

### `list()`

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

List projects with filtering and sorting

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

### `byStatus()`

```php
byStatus(string $status, array $options = []): array
```

Get projects by status

* `$status` — Status (active, on\_hold, done, cancelled)
* `$options` — Additional options

### `forCustomer()`

```php
forCustomer(string $customerId, string $customerType = 'company', array $options = []): array
```

Get projects for a specific customer

* `$customerId` — Customer UUID
* `$customerType` — Customer type (contact, company)
* `$options` — Additional options

### `forParticipant()`

```php
forParticipant(string $participantId, array $options = []): array
```

Get projects for a specific participant

* `$participantId` — Participant UUID
* `$options` — Additional options

### `search()`

```php
search(string $term, array $options = []): array
```

Search projects by term

* `$term` — Search term
* `$options` — Additional options

### `updatedSince()`

```php
updatedSince(string $datetime, array $options = []): array
```

Get projects updated since a specific date

* `$datetime` — ISO 8601 datetime
* `$options` — Additional options

## Examples

Get all projects:

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

Get active projects:

```php
$projects = Teamleader::legacyProjects()->active();
```

Create a new project:

```php
$project = Teamleader::legacyProjects()->create([...]);
```

Close a project:

```php
$result = Teamleader::legacyProjects()->close("project-uuid");
```

Check whether this account is on the legacy system at all:

```php
if (Teamleader::accounts()->isUsingLegacyProjects()) {
                $projects = Teamleader::legacyProjects()->list();
            } else {
                $projects = Teamleader::projects()->list();
            }
```
