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

# create segment

> Creates a new segment. Requires the `segments:write` scope.



## OpenAPI

````yaml /api/v2/openapi.json post /segments
openapi: 3.1.0
info:
  title: Klipy API
  version: '2'
  description: Klipy public CRM API, version 2.
servers:
  - url: https://api.klipy.ai/api/v2
security:
  - ApiKeyHeader: []
  - BearerAuth: []
paths:
  /segments:
    post:
      tags:
        - segments
      summary: create segment
      description: Creates a new segment. Requires the `segments:write` scope.
      operationId: create_segments
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                color:
                  type: string
                description:
                  type: string
                name:
                  type: string
                variant:
                  type: string
      responses:
        '201':
          $ref: '#/components/responses/Created'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  responses:
    Created:
      description: Resource created.
      headers:
        Location:
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SuccessEnvelope'
    Unauthorized:
      description: Authentication failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Forbidden:
      description: Insufficient scope or forbidden operation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    ValidationFailed:
      description: Request body validation failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    RateLimited:
      description: Rate limit exceeded.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    InternalError:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  schemas:
    SuccessEnvelope:
      type: object
      properties:
        data:
          type: object
        meta:
          $ref: '#/components/schemas/Meta'
        object:
          type: string
    ErrorEnvelope:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            details:
              type: array
              items:
                type: object
            message:
              type: string
        meta:
          $ref: '#/components/schemas/Meta'
        object:
          type: string
    Meta:
      type: object
      properties:
        api_version:
          type: string
        request_id:
          type: string
        timestamp:
          type: string
          format: date-time
  securitySchemes:
    ApiKeyHeader:
      type: apiKey
      in: header
      name: X-Klipy-Api-Key
    BearerAuth:
      type: http
      scheme: bearer

````