# Contact tags

`crm.contactTags` — `/v1/audience/contact-tags`

The labels a contact can carry. A tag is its own resource: `crm.contacts` takes
tag **ids** on a write, and hands back the full tag documents resolved into
`contact.tags` on a read.

| Action | Route | Scope |
| --- | --- | --- |
| [`list`](#list) | `GET /v1/audience/contact-tags` | `contact_tags:read` |
| [`get`](#get) | `GET /v1/audience/contact-tags/:id` | `contact_tags:read` |
| [`create`](#create) | `POST /v1/audience/contact-tags` | `contact_tags:write` |
| [`update`](#update) | `PATCH /v1/audience/contact-tags/:id` | `contact_tags:write` |
| [`delete`](#delete) | `DELETE /v1/audience/contact-tags/:id` | `contact_tags:write` |

**Permissions** — `CRM.CONTACT.TAG`: `LIST` to list, `READ` to read one,
`CREATE`, `UPDATE`, `DELETE`. A tag is account-level, so a role's `data_scope`
does not narrow this list — a member who holds `LIST` sees the account's tags.

## The tag object

```ts
interface ContactTag {
  id: string;
  name: string;
  icon: string;   // icon name or emoji; '' when unset
  color: string;  // free-form; '' when unset
}
```

---

## list

```ts
crm.contactTags.list(query?: Partial<ListContactTagsQuery>): Promise<Paginated<ContactTag>>
```

`GET /v1/audience/contact-tags` · `contact_tags:read` · **200**

### Query

| Field | Type | Default | Notes |
| --- | --- | --- | --- |
| `page` | number | `1` | 1-based. |
| `rows` | number | `25` | 1–100. |
| `search` | string | — | 1–120 chars. Matches the tag **name**. |

```ts
const { data, pagination } = await crm.contactTags.list({ search: 'vip' });
```

---

## get

```ts
crm.contactTags.get(id: string): Promise<ContactTag>
```

`GET /v1/audience/contact-tags/:id` · `contact_tags:read` · **200**

`404 not_found` if the tag is not the caller's.

---

## create

```ts
crm.contactTags.create(input: CreateContactTagInput): Promise<ContactTag>
```

`POST /v1/audience/contact-tags` · `contact_tags:write` · **201**

### Body

| Field | Type | Required | Default | Notes |
| --- | --- | --- | --- | --- |
| `name` | string | yes | — | Trimmed, 1–120 chars. |
| `icon` | string | no | `''` | Up to 120 chars. |
| `color` | string | no | `''` | Up to 32 chars. Free-form, so the palette can evolve; only length is checked. |

```ts
const tag = await crm.contactTags.create({ name: 'VIP', icon: 'star', color: '#f59e0b' });
```

---

## update

```ts
crm.contactTags.update(id: string, input: UpdateContactTagInput): Promise<ContactTag>
```

`PATCH /v1/audience/contact-tags/:id` · `contact_tags:write` · **200**

Same fields as `create`, all optional. Renaming a tag changes it everywhere it
is shown — contacts hold the id, not a copy of the name.

---

## delete

```ts
crm.contactTags.delete(id: string): Promise<void>
```

`DELETE /v1/audience/contact-tags/:id` · `contact_tags:write` · **204**, no body.

> **Known gap.** Deleting a tag does not currently remove its id from the
> contacts that carry it, so those contacts keep a reference that resolves to
> nothing. Clear the tag off its contacts first if that matters to you.
