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

# Create Label

> Create a new label in the specified workspace.

### JSON Request Example

```json theme={null}
{
  "name": "Important",
  "color": "#FF5733"
}
```

***

### 📝 Field Requirements

| Field   | Type             | Required | Notes                                                        |
| ------- | ---------------- | -------- | ------------------------------------------------------------ |
| `name`  | string (max 255) | Yes      | Label name (must be unique within the workspace).            |
| `color` | string (max 7)   | No       | Hex color code (e.g., #FF5733). Defaults to null if omitted. |

***

### 💡 Notes

* Label names must be unique within each workspace
* The `color` field accepts standard hex color codes with the `#` prefix
* Labels can be used to organize and categorize contacts


## OpenAPI

````yaml POST /workspaces/{workspace}/labels
openapi: 3.1.0
info:
  title: Lancepilot API
  description: API for Lancepilot
  version: 1.0.0
  license:
    name: MIT
servers:
  - url: https://lancepilot.com/api/v3
security:
  - bearerAuth: []
paths:
  /workspaces/{workspace}/labels:
    post:
      tags:
        - Labels
      summary: Create Label
      description: Create a new label in the specified workspace.
      parameters:
        - name: workspace
          in: path
          description: ID of the workspace.
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: Label creation parameters.
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
              properties:
                name:
                  type: string
                  maxLength: 255
                  description: Unique name per workspace.
                color:
                  type: string
                  maxLength: 7
                  nullable: true
                  description: 'Hex color code (e.g., #FF5733). Optional.'
                  example: '#FF5733'
            examples:
              basic:
                summary: Basic Label
                value:
                  name: Important
                  color: '#FF5733'
      responses:
        '201':
          $ref: '#/components/responses/201'
        '401':
          $ref: '#/components/responses/401'
        '422':
          $ref: '#/components/responses/422'
components:
  responses:
    '201':
      description: ''
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: integer
                example: 201
              message:
                type: string
                example: Resource created successfully.
              data:
                type: object
                description: Created resource data.
            required:
              - status
              - message
              - data
    '401':
      description: ''
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                example: Unauthenticated.
            required:
              - message
    '422':
      description: ''
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                example: Validation error
              errors:
                type: object
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````