> ## 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 Segments by User External ID

> Get all segments a user belongs to by their external ID



## OpenAPI

````yaml GET /api/segments/user/{externalId}
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/user/{externalId}:
    get:
      tags:
        - Segments
      summary: Get Segments by User External ID
      description: Get all segments a user belongs to by their external ID
      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.
        - schema:
            type: string
            description: The external ID of the user
          required: true
          description: The external ID of the user
          name: externalId
          in: path
      responses:
        '200':
          description: Status 200 response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      segments:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              description: The id of the segment
                            name:
                              type: string
                              description: A friendly name for the segment
                            description:
                              type: string
                              description: A friendly name for the segment
                            conditions:
                              type: array
                              items:
                                anyOf:
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        enum:
                                          - property
                                      field:
                                        anyOf:
                                          - type: string
                                            enum:
                                              - userId
                                              - email
                                              - phone
                                              - firstName
                                              - lastName
                                              - hipaaConsent
                                          - type: string
                                      value:
                                        type: array
                                        items:
                                          anyOf:
                                            - type: string
                                            - type: number
                                            - type: boolean
                                            - type: string
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - relative
                                                value:
                                                  type: number
                                                  description: >-
                                                    Number of days to add/subtract from
                                                    today
                                                unit:
                                                  type: string
                                                  enum:
                                                    - days
                                                direction:
                                                  type: string
                                                  enum:
                                                    - before
                                                    - after
                                              required:
                                                - type
                                                - value
                                                - unit
                                                - direction
                                            - type: object
                                              properties:
                                                startDate:
                                                  anyOf:
                                                    - type: string
                                                      nullable: true
                                                    - type: object
                                                      properties:
                                                        type:
                                                          type: string
                                                          enum:
                                                            - relative
                                                        value:
                                                          type: number
                                                          description: >-
                                                            Number of days to add/subtract from
                                                            today
                                                        unit:
                                                          type: string
                                                          enum:
                                                            - days
                                                        direction:
                                                          type: string
                                                          enum:
                                                            - before
                                                            - after
                                                      required:
                                                        - type
                                                        - value
                                                        - unit
                                                        - direction
                                                    - nullable: true
                                                endDate:
                                                  anyOf:
                                                    - type: string
                                                      nullable: true
                                                    - type: object
                                                      properties:
                                                        type:
                                                          type: string
                                                          enum:
                                                            - relative
                                                        value:
                                                          type: number
                                                          description: >-
                                                            Number of days to add/subtract from
                                                            today
                                                        unit:
                                                          type: string
                                                          enum:
                                                            - days
                                                        direction:
                                                          type: string
                                                          enum:
                                                            - before
                                                            - after
                                                      required:
                                                        - type
                                                        - value
                                                        - unit
                                                        - direction
                                                    - nullable: true
                                              required:
                                                - startDate
                                                - endDate
                                        description: >-
                                          The value to compare the field against
                                          (string, number, boolean, date)
                                      operator:
                                        type: string
                                        enum:
                                          - equals
                                          - not_equals
                                          - greater_than
                                          - less_than
                                          - exists
                                          - not_exists
                                          - equals_month_day
                                          - equals_month_day_year
                                          - between_month_day
                                          - between_month_day_year
                                          - array_contains
                                          - contains
                                          - not_contains
                                          - in
                                    required:
                                      - field
                                      - value
                                      - operator
                                  - type: object
                                    properties:
                                      sql_segment_id:
                                        type: string
                                    required:
                                      - sql_segment_id
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        enum:
                                          - related_resource
                                      relatedResource:
                                        type: object
                                        properties:
                                          schemaId:
                                            type: string
                                          foreignKeyPath:
                                            type: string
                                        required:
                                          - schemaId
                                          - foreignKeyPath
                                      countOperator:
                                        type: string
                                        enum:
                                          - eq
                                          - gt
                                          - gte
                                          - lt
                                          - lte
                                      countValue:
                                        type: integer
                                        minimum: 0
                                      conditions:
                                        type: array
                                        items:
                                          type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - property
                                            field:
                                              anyOf:
                                                - type: string
                                                  enum:
                                                    - userId
                                                    - email
                                                    - phone
                                                    - firstName
                                                    - lastName
                                                    - hipaaConsent
                                                - type: string
                                            value:
                                              type: array
                                              items:
                                                anyOf:
                                                  - type: string
                                                  - type: number
                                                  - type: boolean
                                                  - type: string
                                                  - type: object
                                                    properties:
                                                      type:
                                                        type: string
                                                        enum:
                                                          - relative
                                                      value:
                                                        type: number
                                                        description: >-
                                                          Number of days to add/subtract from
                                                          today
                                                      unit:
                                                        type: string
                                                        enum:
                                                          - days
                                                      direction:
                                                        type: string
                                                        enum:
                                                          - before
                                                          - after
                                                    required:
                                                      - type
                                                      - value
                                                      - unit
                                                      - direction
                                                  - type: object
                                                    properties:
                                                      startDate:
                                                        anyOf:
                                                          - type: string
                                                            nullable: true
                                                          - type: object
                                                            properties:
                                                              type:
                                                                type: string
                                                                enum:
                                                                  - relative
                                                              value:
                                                                type: number
                                                                description: >-
                                                                  Number of days to add/subtract from
                                                                  today
                                                              unit:
                                                                type: string
                                                                enum:
                                                                  - days
                                                              direction:
                                                                type: string
                                                                enum:
                                                                  - before
                                                                  - after
                                                            required:
                                                              - type
                                                              - value
                                                              - unit
                                                              - direction
                                                          - nullable: true
                                                      endDate:
                                                        anyOf:
                                                          - type: string
                                                            nullable: true
                                                          - type: object
                                                            properties:
                                                              type:
                                                                type: string
                                                                enum:
                                                                  - relative
                                                              value:
                                                                type: number
                                                                description: >-
                                                                  Number of days to add/subtract from
                                                                  today
                                                              unit:
                                                                type: string
                                                                enum:
                                                                  - days
                                                              direction:
                                                                type: string
                                                                enum:
                                                                  - before
                                                                  - after
                                                            required:
                                                              - type
                                                              - value
                                                              - unit
                                                              - direction
                                                          - nullable: true
                                                    required:
                                                      - startDate
                                                      - endDate
                                              description: >-
                                                The value to compare the field against
                                                (string, number, boolean, date)
                                            operator:
                                              type: string
                                              enum:
                                                - equals
                                                - not_equals
                                                - greater_than
                                                - less_than
                                                - exists
                                                - not_exists
                                                - equals_month_day
                                                - equals_month_day_year
                                                - between_month_day
                                                - between_month_day_year
                                                - array_contains
                                                - contains
                                                - not_contains
                                                - in
                                          required:
                                            - field
                                            - value
                                            - operator
                                    required:
                                      - type
                                      - relatedResource
                                      - countOperator
                                      - countValue
                                      - conditions
                              description: The conditions to include in the segment
                            type:
                              type: string
                              enum:
                                - all_users
                                - managed
                                - custom
                                - one_off
                                - sql
                              description: The type of segment
                            createdAt:
                              type: string
                              nullable: true
                              description: The date and time the segment was created
                            updatedAt:
                              type: string
                              nullable: true
                              description: The date and time the segment was last updated
                          required:
                            - id
                            - name
                            - conditions
                            - type
                            - createdAt
                            - updatedAt
                        description: The segments the user belongs to
                    required:
                      - segments
                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

````