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

# List segments

> Returns all active (non-archived) segments configured for your brand.



## OpenAPI

````yaml /api-reference/openapi.json get /segments
openapi: 3.1.0
info:
  title: Sotto API
  version: 1.0.0
  description: >-
    The Sotto API provides programmatic access to manage users, send messages,
    upload files, configure webhooks, and read your segments and custom data
    fields. All requests are authenticated with an HMAC-SHA256 signature. See
    the **Authentication** guide for signing details.
  contact:
    name: Sotto Support
    email: support@bigco.ai
servers:
  - url: https://api.bigco.ai/api/v1
    description: Production
security:
  - hmacSignature: []
tags:
  - name: Users
    description: Create, retrieve, update, and delete users.
  - name: Messages
    description: Send messages to a user.
  - name: Files
    description: Upload media files for use in messages.
  - name: Brand
    description: Retrieve information about your brand.
  - name: Webhooks
    description: Subscribe to and manage event callbacks.
  - name: Segments
    description: Read the audience segments configured for your brand.
  - name: Custom Data
    description: Read the custom data fields configured for your brand.
paths:
  /segments:
    get:
      tags:
        - Segments
      summary: List segments
      description: Returns all active (non-archived) segments configured for your brand.
      operationId: getSegments
      responses:
        '200':
          description: Your brand's segments.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SegmentAPI'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    SegmentAPI:
      type: object
      properties:
        id:
          type: integer
          example: 123
        brand_id:
          type: integer
          example: 37876
        name:
          type: string
          description: The segment name, unique within your brand.
          example: Loyal customers
        description:
          type:
            - string
            - 'null'
          example: Customers with 3+ orders
        source:
          type: string
          description: Where the segment originated (e.g. `USER_DEFINED`, `KLAVIYO`).
          example: USER_DEFINED
        type:
          type: string
          description: The segment type (e.g. `STANDARD`, `POINT IN TIME`).
          example: STANDARD
        is_active:
          type: boolean
          example: true
        is_archived:
          type: boolean
          default: false
          example: false
        is_pinned:
          type:
            - boolean
            - 'null'
          example: false
        color_id:
          type:
            - integer
            - 'null'
          example: 3
        ltv:
          type:
            - number
            - 'null'
          description: Average lifetime value of users in the segment.
          example: 250
        average_order_value:
          type:
            - number
            - 'null'
          example: 75.5
        average_purchase_frequency:
          type:
            - number
            - 'null'
          example: 2.4
        criteria:
          type: array
          items:
            $ref: '#/components/schemas/SegmentCriteriaAPI'
        date_created:
          type: string
          format: date-time
          example: '2024-01-12T15:21:51Z'
        date_last_updated:
          type: string
          format: date-time
          example: '2024-01-12T15:21:51Z'
      required:
        - id
        - brand_id
        - name
        - source
        - type
        - is_active
        - is_archived
        - criteria
        - date_created
        - date_last_updated
    SegmentCriteriaAPI:
      type: object
      properties:
        attribute:
          $ref: '#/components/schemas/SegmentAttributeAPI'
        operator_type:
          type: integer
          description: Numeric code for the comparison operator.
        and_group_num:
          type: integer
          description: >-
            Criteria sharing an `and_group_num` are AND-ed together; separate
            groups are OR-ed.
        str_field_value:
          type:
            - string
            - array
            - 'null'
          items:
            type: string
        bool_field_value:
          type:
            - boolean
            - array
            - 'null'
          items:
            type: boolean
        int_field_value:
          type:
            - integer
            - array
            - 'null'
          items:
            type: integer
        float_field_value:
          type:
            - number
            - array
            - 'null'
          items:
            type: number
        date_field_value:
          type:
            - string
            - array
            - 'null'
          items:
            type: string
            format: date-time
      required:
        - attribute
        - operator_type
        - and_group_num
    Error:
      type: object
      properties:
        detail:
          type: object
          properties:
            type:
              type: string
              description: Machine-readable error type.
              example: not_authenticated
            msg:
              type: string
              description: Human-readable error message.
              example: HMAC signature verification failed
          required:
            - type
            - msg
      required:
        - detail
    SegmentAttributeAPI:
      type: object
      properties:
        dimension_type:
          type: integer
          description: Numeric code for the attribute's dimension.
        field_name:
          type: string
          example: age
        field_type:
          type: integer
          description: Numeric code for the attribute's field type.
      required:
        - dimension_type
        - field_name
        - field_type
  responses:
    Unauthorized:
      description: Unauthorized — HMAC signature verification failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail:
              type: not_authenticated
              msg: HMAC signature verification failed
    InternalServerError:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail:
              type: UNCAUGHT_ERROR
              msg: Internal server error
  securitySchemes:
    hmacSignature:
      type: apiKey
      in: header
      name: x-bigco-hmac-sha256
      description: >-
        Base64-encoded HMAC-SHA256 signature of the request. Every request must
        also include the `x-bigco-hmac-username` and `x-date` headers, and
        POST/PUT requests must include `x-digest`. See the Authentication guide
        for the full signing procedure.

````