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

# Get Count of Users in Include and Exclude Segment

> Get count of users in an include and exclude segment



## OpenAPI

````yaml POST /api/segments/count
openapi: 3.0.0
info:
  title: Reach API
  version: 1.0.0
  description: API documentation for Reach platform
servers:
  - url: https://api.embedreach.com
    description: Production server
security: []
paths:
  /api/segments/count:
    post:
      tags:
        - Segments
      summary: Get Count of Users in Include and Exclude Segment
      description: Get count of users in an include and exclude segment
      parameters:
        - name: reach-tenant-id
          in: header
          required: false
          schema:
            type: string
            description: >-
              If using a platform scoped JWT, you can pass in a header to
              impersonate a specific tenant to impersonate the request as.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                includeSegments:
                  type: array
                  items:
                    type: string
                  description: The segments to include
                excludeSegments:
                  type: array
                  items:
                    type: string
                  description: The segments to exclude
                automationId:
                  type: string
                  description: The id of the automation
                search:
                  type: string
                  description: Search query to filter recipients by name, email, or phone
                limit:
                  type: number
                  minimum: 1
                  maximum: 1000
                  default: 100
                  description: >-
                    Maximum number of recipients to return (defaults to 100 for
                    performance)
                filter:
                  type: string
                  enum:
                    - all
                    - email
                    - phone
                  default: all
                  description: 'Filter recipients by contact method: all, email, or phone'
                cursor:
                  type: string
                  description: Cursor for pagination (from previous response)
      responses:
        '200':
          description: Status 200 response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      count:
                        type: number
                        description: The number of users in the segment
                      recipients:
                        type: array
                        items:
                          type: object
                          properties:
                            firstName:
                              type: string
                              nullable: true
                              description: The first name of the recipient
                            lastName:
                              type: string
                              nullable: true
                              description: The last name of the recipient
                            email:
                              type: string
                              nullable: true
                              description: The email of the recipient
                            phone:
                              type: string
                              nullable: true
                              description: The phone of the recipient
                            id:
                              type: string
                              nullable: true
                              description: The reach id of the recipient
                            externalId:
                              type: string
                              nullable: true
                              description: The external id of the recipient
                            emailOptedOut:
                              type: boolean
                              description: Whether the user has opted out of email
                            smsOptedOut:
                              type: boolean
                              description: Whether the user has opted out of SMS
                          required:
                            - firstName
                            - lastName
                            - email
                            - phone
                            - id
                            - externalId
                        description: The recipients in the segment (paginated)
                      pagination:
                        type: object
                        properties:
                          hasNextPage:
                            type: boolean
                            description: Whether there are more pages
                          cursor:
                            type: string
                            nullable: true
                            description: Cursor for the next page (null if no more pages)
                        required:
                          - hasNextPage
                          - cursor
                        description: Pagination metadata
                    required:
                      - count
                      - recipients
                      - pagination
                required:
                  - success
        '400':
          description: Bad Request - Validation or request error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                    default: false
                  message:
                    type: string
                    description: Error message describing what went wrong
                  errors:
                    type: array
                    items:
                      type: string
                    description: Optional array of specific validation errors
                required:
                  - message

````