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

# Create segment

> Create a new contact segment with conditions



## OpenAPI

````yaml POST /segments
openapi: 3.0.3
info:
  title: NativeMessage API
  version: 1.0.0
  description: Complete API documentation for NativeMessage platform
  contact:
    name: NativeMessage Support
    email: support@nativemessage.com
servers:
  - url: https://api-message.nativehub.live/api/v1
    description: Production server
security:
  - BearerAuth: []
  - ApiKeyAuth: []
paths:
  /segments:
    post:
      tags:
        - Segments
      summary: Create segment
      description: Create a new contact segment with conditions
      operationId: createSegment
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - conditions
              properties:
                name:
                  type: string
                conditions:
                  type: object
              example:
                name: Premium Customers
                conditions:
                  tags:
                    segment: premium
                  region:
                    - dhaka
                    - chittagong
      responses:
        '201':
          description: Segment created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Segment'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    Segment:
      type: object
      properties:
        id:
          type: string
          format: uuid
        tenant_id:
          type: string
          format: uuid
        name:
          type: string
        conditions:
          type: object
        contact_count:
          type: integer
        created_at:
          type: string
          format: date-time
      example:
        id: e7f8a9b0-c1d2-3456-ef78-901234567890
        tenant_id: c3d4e5f6-a7b8-9012-cdef-123456789012
        name: Premium Customers
        conditions:
          tags:
            segment: premium
          region:
            - dhaka
            - chittagong
        contact_count: 1250
        created_at: '2026-02-05T10:00:00Z'
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
      example:
        error: Invalid request parameters
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````