# Tags API

> Tags and tagging records. Every route, its parameters and fields.

Tags and tagging records. 16 routes; send a bearer token with each (see [Authentication](/api/authentication.md)).

| Route | What it does |
| --- | --- |
| `GET /v1/tags` | List tags |
| `POST /v1/tags` | Create a tag |
| `PATCH /v1/tags/{id}` | Rename or recolour a tag (admins) |
| `DELETE /v1/tags/{id}` | Delete a tag (admins) |
| `GET /v1/contacts/{id}/tags` | A contact's tags |
| `POST /v1/contacts/{id}/tags` | Tag a contact |
| `DELETE /v1/contacts/{id}/tags/{tagId}` | Untag a contact |
| `GET /v1/accounts/{id}/tags` | A account's tags |
| `POST /v1/accounts/{id}/tags` | Tag a account |
| `DELETE /v1/accounts/{id}/tags/{tagId}` | Untag a account |
| `GET /v1/opportunities/{id}/tags` | A opportunity's tags |
| `POST /v1/opportunities/{id}/tags` | Tag a opportunity |
| `DELETE /v1/opportunities/{id}/tags/{tagId}` | Untag a opportunity |
| `GET /v1/cases/{id}/tags` | A case's tags |
| `POST /v1/cases/{id}/tags` | Tag a case |
| `DELETE /v1/cases/{id}/tags/{tagId}` | Untag a case |

## List tags

`GET https://staging-api.naruskacrm.com/v1/tags`

include=usage adds `usage`: per record type, the live records carrying the tag that you can see (04d E13).

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `include` | query | `usage` |  | usage: live records per type that carry the tag, as you see them |

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of object | yes |  |
| `data[].id` | string (uuid) | yes |  |
| `data[].name` | string | yes |  |
| `data[].name_normalized` | string | yes |  |
| `data[].color` | string or null | yes |  |
| `data[].created_at` | string (date-time) | yes |  |
| `data[].deleted_at` | string (date-time) or null | yes |  |
| `data[].usage` | object |  |  |
| `data[].usage.contact` | number | yes |  |
| `data[].usage.account` | number | yes |  |
| `data[].usage.opportunity` | number | yes |  |
| `data[].usage.case` | number | yes |  |

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Create a tag

`POST https://staging-api.naruskacrm.com/v1/tags`

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `name` | string | yes | 1–100 characters |
| `color` | `gray`, `red`, `orange`, `yellow`, `green`, `teal`, `blue`, `purple`, `pink` or null |  |  |

### Response 201

Returns: [Tag](/api/reference/objects.md#tag).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Rename or recolour a tag (admins)

`PATCH https://staging-api.naruskacrm.com/v1/tags/{id}`

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `name` | string |  | 1–100 characters |
| `color` | `gray`, `red`, `orange`, `yellow`, `green`, `teal`, `blue`, `purple`, `pink` or null |  |  |

### Response 200

Returns: [Tag](/api/reference/objects.md#tag).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Delete a tag (admins)

`DELETE https://staging-api.naruskacrm.com/v1/tags/{id}`

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Response 204

Done.
No body.

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## A contact's tags

`GET https://staging-api.naruskacrm.com/v1/contacts/{id}/tags`

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of [Tag](/api/reference/objects.md#tag) | yes |  |

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Tag a contact

`POST https://staging-api.naruskacrm.com/v1/contacts/{id}/tags`

By tag_id, or by name: a tag that does not exist yet is created. Tagging twice is a no-op.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Request body

Body: object.

### Response 200

Returns: [Tag](/api/reference/objects.md#tag).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Untag a contact

`DELETE https://staging-api.naruskacrm.com/v1/contacts/{id}/tags/{tagId}`

Removing a tag that is not on the record is a no-op.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |
| `tagId` | path | string (uuid) | yes |  |

### Response 204

Done.
No body.

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## A account's tags

`GET https://staging-api.naruskacrm.com/v1/accounts/{id}/tags`

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of [Tag](/api/reference/objects.md#tag) | yes |  |

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Tag a account

`POST https://staging-api.naruskacrm.com/v1/accounts/{id}/tags`

By tag_id, or by name: a tag that does not exist yet is created. Tagging twice is a no-op.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Request body

Body: object.

### Response 200

Returns: [Tag](/api/reference/objects.md#tag).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Untag a account

`DELETE https://staging-api.naruskacrm.com/v1/accounts/{id}/tags/{tagId}`

Removing a tag that is not on the record is a no-op.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |
| `tagId` | path | string (uuid) | yes |  |

### Response 204

Done.
No body.

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## A opportunity's tags

`GET https://staging-api.naruskacrm.com/v1/opportunities/{id}/tags`

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of [Tag](/api/reference/objects.md#tag) | yes |  |

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Tag a opportunity

`POST https://staging-api.naruskacrm.com/v1/opportunities/{id}/tags`

By tag_id, or by name: a tag that does not exist yet is created. Tagging twice is a no-op.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Request body

Body: object.

### Response 200

Returns: [Tag](/api/reference/objects.md#tag).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Untag a opportunity

`DELETE https://staging-api.naruskacrm.com/v1/opportunities/{id}/tags/{tagId}`

Removing a tag that is not on the record is a no-op.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |
| `tagId` | path | string (uuid) | yes |  |

### Response 204

Done.
No body.

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## A case's tags

`GET https://staging-api.naruskacrm.com/v1/cases/{id}/tags`

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of [Tag](/api/reference/objects.md#tag) | yes |  |

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Tag a case

`POST https://staging-api.naruskacrm.com/v1/cases/{id}/tags`

By tag_id, or by name: a tag that does not exist yet is created. Tagging twice is a no-op.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Request body

Body: object.

### Response 200

Returns: [Tag](/api/reference/objects.md#tag).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Untag a case

`DELETE https://staging-api.naruskacrm.com/v1/cases/{id}/tags/{tagId}`

Removing a tag that is not on the record is a no-op.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |
| `tagId` | path | string (uuid) | yes |  |

### Response 204

Done.
No body.

Errors are problem details with a stable `code`: see [Errors](/errors.md).

