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

# List Segments

> List all segments in your workspace. Returns summary data including member counts. Supports pagination.



## OpenAPI

````yaml https://www.greenflash.ai/api/openapi get /segments
openapi: 3.1.0
info:
  title: Greenflash API Reference
  version: 1.0.0
  description: >-
    Greenflash endpoints for capturing interactions, managing prompts, and
    identifying users.
servers:
  - url: https://www.greenflash.ai/api/v1
    description: Greenflash API v1
security: []
tags:
  - name: Interactions
    description: Capture interactions between users and AI
  - name: Business Events
    description: Capture business events
  - name: Analytics
    description: Understand chat and agentic interactions analyses
  - name: Inbox
    description: Review flagged conversations
  - name: Segments
    description: Manage user segments
  - name: Prompts
    description: Manage prompts
  - name: Chat
    description: Stream chat and agentic conversations
  - name: Models
    description: Manage AI models
  - name: Products
    description: Manage products
  - name: Users
    description: Manage users
  - name: Organizations
    description: Manage organizations
paths:
  /segments:
    get:
      tags:
        - Segments
      summary: List Segments
      description: >-
        List all segments in your workspace. Returns summary data including
        member counts. Supports pagination.
      parameters:
        - schema:
            type: number
            minimum: 1
            description: 'Page number (default: 1).'
          required: false
          description: 'Page number (default: 1).'
          name: page
          in: query
        - schema:
            type: number
            minimum: 1
            maximum: 100
            description: 'Number of results per page (default: 50, max: 100).'
          required: false
          description: 'Number of results per page (default: 50, max: 100).'
          name: pageSize
          in: query
      responses:
        '200':
          description: Segments retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListSegmentsResponse'
              example:
                - id: 123e4567-e89b-12d3-a456-426614174000
                  name: Power Users
                  type: system
                  presetId: power-users
                  memberCount: 234
                  isFavorited: true
                - id: 223e4567-e89b-12d3-a456-426614174001
                  name: Enterprise Customers
                  type: custom
                  presetId: null
                  memberCount: 89
                  isFavorited: false
                - id: 323e4567-e89b-12d3-a456-426614174002
                  name: Frustrated Users
                  type: system
                  presetId: frustrated-users
                  memberCount: 42
                  isFavorited: true
        '400':
          description: Bad request - invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Whether the API call was successful (false for errors).
                  error:
                    type: string
                    description: Error message describing what went wrong.
                description: Error response for list segments operations.
              example:
                success: false
                error: 'Invalid parameter: pageSize must be between 1 and 100'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Whether the API call was successful (false for errors).
                  error:
                    type: string
                    description: Error message describing what went wrong.
                description: Error response for list segments operations.
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Greenflash from 'greenflash';

            const client = new Greenflash({
              apiKey: process.env['GREENFLASH_API_KEY'], // This is the default and can be omitted
            });

            const listSegmentsResponse = await client.segments.list();

            console.log(listSegmentsResponse);
        - lang: Python
          source: |-
            import os
            from greenflash import Greenflash

            client = Greenflash(
                api_key=os.environ.get("GREENFLASH_API_KEY"),  # This is the default and can be omitted
            )
            list_segments_response = client.segments.list()
            print(list_segments_response)
components:
  schemas:
    ListSegmentsResponse:
      type: array
      items:
        $ref: '#/components/schemas/SegmentSummary'
      description: Array of segments.
    SegmentSummary:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: The segment ID.
        name:
          type: string
          description: The segment name.
        type:
          type: string
          enum:
            - system
            - custom
          description: Whether the segment is system-defined or custom.
        presetId:
          type:
            - string
            - 'null'
          description: Preset identifier for system segments.
        memberCount:
          type: number
          description: Number of participants in this segment.
        isFavorited:
          type: boolean
          description: Whether the segment is favorited.
      required:
        - id
        - name
        - type
        - presetId
        - memberCount
        - isFavorited
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````