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

# Notes

Manage notes in Teamleader Focus - attach notes to various entities like companies, contacts, deals, etc.

```php
Teamleader::notes()
```

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

## Endpoints

* `notes.create`
* `notes.delete`
* `notes.list`
* `notes.update`

## Filters

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

| Filter         | Description                                           |
| -------------- | ----------------------------------------------------- |
| `subject.id`   | UUID of the subject entity the note belongs to        |
| `subject.type` | Type of subject entity (company, contact, deal, etc.) |

## 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`        | `subject`, `content`, `notify`                                                                                                        |
| `CREATE_SUBJECT_TYPES` | `company`, `contact`, `creditNote`, `deal`, `invoice`, `meeting`, `nextgenProject`, `product`, `quotation`, `subscription`            |
| `LIST_SUBJECT_TYPES`   | `company`, `contact`, `creditNote`, `deal`, `invoice`, `meeting`, `nextgenProject`, `product`, `project`, `quotation`, `subscription` |
| `UPDATE_FIELDS`        | `content`                                                                                                                             |

## Methods

### `update()`

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

Update an existing note

* `$id` — Note ID
* `$data` — Data to update

### `forCompany()`

```php
forCompany(string $companyId, array $options = [])
```

Get notes for a company

* `$companyId` — Company UUID
* `$options` — Additional options

### `forSubject()`

```php
forSubject(string $subjectType, string $subjectId, array $options = [])
```

Get notes for a specific subject

* `$subjectType` — Type of subject (company, contact, deal, etc.)
* `$subjectId` — UUID of the subject
* `$options` — Additional options (pagination)

### `list()`

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

List notes with filtering support

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

### `createForCompany()`

```php
createForCompany(string $companyId, string $content, array $notify = [])
```

Create a note for a company

* `$companyId` — Company UUID
* `$content` — Note content
* `$notify` — Users to notify

### `createForSubject()`

```php
createForSubject(string $subjectType, string $subjectId, string $content, array $notify = [])
```

Create a note for a specific subject

* `$subjectType` — Type of subject
* `$subjectId` — UUID of the subject
* `$content` — Note content
* `$notify` — Optional array of users to notify

### `create()`

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

Create a new note

* `$data` — Note data

### `forContact()`

```php
forContact(string $contactId, array $options = [])
```

Get notes for a contact

* `$contactId` — Contact UUID
* `$options` — Additional options

### `createForContact()`

```php
createForContact(string $contactId, string $content, array $notify = [])
```

Create a note for a contact

* `$contactId` — Contact UUID
* `$content` — Note content
* `$notify` — Users to notify

### `forDeal()`

```php
forDeal(string $dealId, array $options = [])
```

Get notes for a deal

* `$dealId` — Deal UUID
* `$options` — Additional options

### `createForDeal()`

```php
createForDeal(string $dealId, string $content, array $notify = [])
```

Create a note for a deal

* `$dealId` — Deal UUID
* `$content` — Note content
* `$notify` — Users to notify

### `getAvailableSubjectTypes()`

```php
getAvailableSubjectTypes(): array
```

Get available subject types

### `info()`

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

Override parent method since Notes use different structure

### `delete()`

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

Delete a note.

* `$id` — Note UUID
* `$additionalParams` — Unused

**Throws** `InvalidArgumentException` When the ID is not a valid UUID

## Examples

Get all notes for a specific contact:

```php
$notes = Teamleader::notes()->list(['subject' => ['type' => 'contact', 'id' => 'contact-uuid']]);
```

Get all notes for a specific company:

```php
$notes = Teamleader::notes()->list(['subject' => ['type' => 'company', 'id' => 'company-uuid']]);
```

Create a note for a contact:

```php
$note = Teamleader::notes()->create(['subject' => ['type' => 'contact', 'id' => 'contact-uuid'], 'content' => 'Meeting notes from today']);
```

Create a note and notify users:

```php
$note = Teamleader::notes()->create(['subject' => ['type' => 'deal', 'id' => 'deal-uuid'], 'content' => 'Important update', 'notify' => [['type' => 'user', 'id' => 'user-uuid']]]);
```

Update an existing note:

```php
$note = Teamleader::notes()->update('note-uuid', ['content' => 'Updated note content']);
```
