> ## Documentation Index
> Fetch the complete documentation index at: https://docs.clustr-ai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Tag

> Add a tag to a record type's field

Send the `subject_type` the tag is for (`account`, `person` or `path`). The tag
goes in that record type's field (Account tags, Connector tags or Intro tags),
which is created if it does not exist yet. Read the fields from
[List Tag Groups](https://docs.clustr-ai.com/api-reference/list-tag-groups.md). Set `closes` to make the tag
close the warm intro it is on (`path` only).

> [!NOTE]
>
> **A new tag goes to the end of its field.** A field holds at most 50
> tags.

```bash cURL theme={null}
curl -X POST "https://api.clustr-ai.com/api/public/tags" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "subject_type": "path",
    "name": "Meeting booked",
    "color": "#22C55E"
  }'
```

```json 201 theme={null}
{
  "success": true,
  "data": {
    "tag": {
      "clustr_tag_id": "tag_968c66ve82kmx7trzhw7mfdb1p",
      "clustr_group_id": "tgrp_nxpeqa83he48rcpj09cjm6vd6x",
      "id": "cbfd0074-57bd-4fa7-a5fc-8bb5392b16c9",
      "group_id": "2b7c9d10-4e5f-4a61-9c22-8d3f1a7b0e44",
      "name": "Meeting booked",
      "color": "#22C55E",
      "position": 3,
      "closes": false
    }
  }
}
```

```json 400 theme={null}
{
  "success": false,
  "error": { "message": "subject_type must be account, person or path", "code": "BAD_REQUEST" }
}
```

```json 422 theme={null}
{
  "success": false,
  "error": { "message": "a tag field can hold at most 50 tags", "code": "UNPROCESSABLE_ENTITY" }
}
```


## OpenAPI

````yaml POST /tags
openapi: 3.1.0
info:
  title: Clustr Public API
  description: >
    Programmatic access to your Clustr network: import connectors, search warm
    intros (opportunities), and manage target accounts.


    ## Authentication

    All endpoints require a Bearer token (API key) in the `Authorization`
    header.


    ```

    Authorization: Bearer <your_api_key>

    ```


    API keys can be created and managed from the [API settings
    page](https://app.clustr-ai.com/api).
  version: '1.0'
  contact:
    name: Clustr Support
    url: https://clustr-ai.com
servers:
  - url: https://api.clustr-ai.com/api/public
    description: Production
security:
  - BearerAuth: []
paths:
  /tags:
    post:
      tags:
        - Tags
      summary: Create Tag
      description: >
        Send `subject_type`, `name`, `color` and optionally `closes`. The tag
        goes in that record

        type's tag field (Account, Connector or Intro tags), made if the
        workspace has none yet.

        A field holds at most 50 tags (422 past that), and a new tag goes to the
        end.
      operationId: createTag
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTagRequest'
      responses:
        '201':
          description: The new tag
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    properties:
                      tag:
                        $ref: '#/components/schemas/Tag'
        '400':
          description: Invalid name or color
        '401':
          description: Invalid or missing API key
        '404':
          description: No such tag field in this workspace
        '422':
          description: A tag field can hold at most 50 tags
components:
  schemas:
    CreateTagRequest:
      type: object
      description: >-
        Send `subject_type`, `name`, `color` and optionally `closes`. The tag
        goes in that record type's tag field, made if the workspace has none
        yet. A field holds at most 50 tags.
      required:
        - subject_type
        - name
        - color
      properties:
        subject_type:
          type: string
          enum:
            - account
            - person
            - path
          description: >-
            Which records the tag labels: `account`, `person` (a connector) or
            `path` (a warm intro).
        name:
          type: string
          maxLength: 50
          description: 1-50 characters.
        color:
          type: string
          maxLength: 20
          example: '#3B82F6'
          description: >-
            A hex colour, such as `#3B82F6`. Clustr caps its saturation and
            clamps its lightness

            for display, so a neon value shows calmer than you sent it.
        closes:
          type: boolean
          default: false
          description: >-
            For opportunity (`path`) tags: this tag closes the opportunity it is
            on. Paths

            carrying it sort last and show a neutral pill, and they stay visible
            and filterable.
    Tag:
      type: object
      description: One term inside a tag field.
      required:
        - id
        - group_id
        - name
        - color
      properties:
        clustr_tag_id:
          type: string
          description: >-
            The tag's Clustr ID, for example `tag_275zx5fj2f0nka3hnyk651zr1e`.
            Use it to refer to this tag.

            Every tag write and the `tag` search filter take it.
          example: tag_275zx5fj2f0nka3hnyk651zr1e
        clustr_group_id:
          type: string
          description: >-
            The Clustr ID of the tag field it lives in, for example
            `tgrp_s4t5tk9wn7mx8n3hry88wv0rqa`. A tag

            cannot move between fields.
          example: tgrp_s4t5tk9wn7mx8n3hry88wv0rqa
        id:
          type: string
          format: uuid
          description: >-
            Kept for integrations built before Clustr IDs. New integrations
            should use `clustr_tag_id`.
        group_id:
          type: string
          format: uuid
          description: >-
            Kept for integrations built before Clustr IDs. New integrations
            should use `clustr_group_id`.
        group_name:
          type: string
          description: That field's name, so a flat list says which field a tag is in.
        subject_type:
          type: string
          enum:
            - account
            - person
            - path
          description: 'The field''s subject type: `account`, `person` or `path`.'
        name:
          type: string
          maxLength: 50
        color:
          type: string
          maxLength: 20
          example: '#3B82F6'
        position:
          type: integer
        closes:
          type: boolean
          description: >-
            For opportunity (`path`) tags: `true` means the conversation on this
            path is over. A path carrying it sorts last, shows a neutral pill
            and stays visible.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: The API key you created on the API settings page of the Clustr app.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.