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

# Get a segment

> Returns one segment, including `member_count`. For a dynamic segment
the count is computed from its filter at read time.

Requires the `contacts:read` scope.




## OpenAPI

````yaml /openapi.yaml get /segments/{id}
openapi: 3.1.0
info:
  title: Watx API
  version: '1'
  description: |
    The Watx public REST API. Send WhatsApp messages, manage contacts and
    segments, read conversations and messages, launch broadcasts, and register
    webhook endpoints.

    Every request authenticates with a workspace API key sent as a bearer
    token. A key acts on exactly one workspace and can only do what its scopes
    allow. Each operation below names the scope it requires.
  contact:
    name: Watx support
    email: support@watx.in
servers:
  - url: https://api.watx.in/v1
    description: Production
security:
  - apiKey: []
tags:
  - name: Account
    description: Check which workspace a key belongs to and what it can do.
  - name: Messages
    description: Send a WhatsApp message to a phone number.
  - name: Contacts
    description: Create, read, update and list contacts.
  - name: Conversations
    description: Read conversations and their messages.
  - name: Broadcasts
    description: Launch a template broadcast and follow its progress.
  - name: Segments
    description: Named audiences — static lists and saved filters.
  - name: Webhooks
    description: Register endpoints that receive events from your workspace.
paths:
  /segments/{id}:
    parameters:
      - $ref: '#/components/parameters/segmentId'
    get:
      tags:
        - Segments
      summary: Get a segment
      description: |
        Returns one segment, including `member_count`. For a dynamic segment
        the count is computed from its filter at read time.

        Requires the `contacts:read` scope.
      operationId: getSegment
      responses:
        '200':
          description: The segment and its member count.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Segment'
              example:
                data:
                  id: 8c1d2e3f-4a5b-4c6d-8e9f-0a1b2c3d4e5f
                  name: VIPs with an email
                  description: null
                  color: '#16a34a'
                  kind: dynamic
                  filter:
                    match: all
                    rules:
                      - field: tag
                        op: has
                        value: vip
                      - field: email
                        op: is_set
                  member_count: 42
                  created_at: '2026-09-02T07:30:00.000Z'
                  updated_at: '2026-09-02T07:30:00.000Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  parameters:
    segmentId:
      name: id
      in: path
      required: true
      description: The segment id.
      schema:
        type: string
        format: uuid
  schemas:
    Segment:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        description:
          type:
            - string
            - 'null'
        color:
          type: string
          description: Hex colour. Defaults to `#6366f1`.
        kind:
          type: string
          enum:
            - static
            - dynamic
        filter:
          description: The rules of a dynamic segment. Always `null` for a static one.
          oneOf:
            - $ref: '#/components/schemas/SegmentFilter'
            - type: 'null'
        member_count:
          type: integer
          description: Returned by `GET /segments/{id}` only.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    SegmentFilter:
      type: object
      description: The rules of a dynamic segment.
      properties:
        match:
          type: string
          enum:
            - all
            - any
          description: '`all` = every rule must match; `any` = at least one.'
        rules:
          type: array
          items:
            $ref: '#/components/schemas/SegmentRule'
    Error:
      type: object
      description: |
        Every failure uses this shape. Branch on `error.code`, which is stable;
        `error.message` is written for people and may be reworded.
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: |
                One of `bad_request`, `invalid_request`, `unauthorized`,
                `forbidden`, `not_found`, `rate_limited`, `internal`, or a
                domain code such as `whatsapp_not_configured`, `meta_error`,
                `template_malformed`, `plan_limit_reached`,
                `subscription_lapsed`.
              example: bad_request
            message:
              type: string
              example: '''phone'' is required'
    SegmentRule:
      type: object
      description: |
        One condition of a dynamic segment. A rule that is missing a value the
        operator needs is dropped before matching, and a filter with no usable
        rules matches nobody.
      required:
        - field
        - op
      properties:
        field:
          type: string
          description: |
            `tag`, `source`, `has_phone`, `name`, `email`, `company`,
            `created_at`, or `custom:<custom_field_id>` for a custom field.
          example: tag
        op:
          type: string
          enum:
            - has
            - not_has
            - is
            - is_not
            - contains
            - is_set
            - is_not_set
            - before
            - after
        value:
          type: string
          description: Not needed by `is_set` and `is_not_set`.
  responses:
    Unauthorized:
      description: |
        The key is missing, malformed, unknown, revoked or expired. All four
        answer the same way.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: unauthorized
              message: Missing or invalid API key
    Forbidden:
      description: The key is valid but was not granted the scope this operation requires.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: forbidden
              message: This API key is missing the 'messages:send' scope
    NotFound:
      description: |
        No such resource in this workspace. A resource belonging to another
        workspace answers the same way.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: not_found
              message: Contact not found
    RateLimited:
      description: |
        More than 120 requests in a minute for this key. `Retry-After` says how
        many seconds to wait.
      headers:
        Retry-After:
          description: Seconds until the window resets.
          schema:
            type: integer
        X-RateLimit-Limit:
          description: Requests allowed per window.
          schema:
            type: integer
        X-RateLimit-Remaining:
          description: Requests left in this window.
          schema:
            type: integer
        X-RateLimit-Reset:
          description: Unix time in seconds when the window resets.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: rate_limited
              message: Rate limit exceeded for this API key
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: |
        Your workspace API key, created in **Settings → API keys**, sent as
        `Authorization: Bearer <key>`. New keys start with `watx_live_`; keys
        issued before the rename start with `converse360_live_` and still work.

````