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

# List Hub Segments

> List the segments an audience on this hub can be restricted to.

Each entry carries the segment id -- the value an event's ``segment_id``
takes -- and the name it is administered under. Cursor-paginated by id;
follow ``links.next`` while ``meta.has_more`` is true.

Only currently-enabled segments are listed. A disabled segment matches
nobody, so an audience restricted to one would reach nobody.

Requires an active owner, admin or moderator membership on this hub,
presented as a member session token. Any other caller is rejected.



## OpenAPI

````yaml /openapi/mio-openapi.json get /api/v1/hubs/{hub_id}/segments
openapi: 3.1.0
info:
  description: >-
    Production API reference for Membership.io. Use the authored guides for
    workflows and the generated endpoint pages for exact parameters and schemas.
  title: Membership.io API
  version: 0.1.0
servers:
  - description: Production
    url: https://api.member.dev
security:
  - bearerAuth: []
paths:
  /api/v1/hubs/{hub_id}/segments:
    get:
      tags:
        - segments-hub
      summary: List Hub Segments
      description: |-
        List the segments an audience on this hub can be restricted to.

        Each entry carries the segment id -- the value an event's ``segment_id``
        takes -- and the name it is administered under. Cursor-paginated by id;
        follow ``links.next`` while ``meta.has_more`` is true.

        Only currently-enabled segments are listed. A disabled segment matches
        nobody, so an audience restricted to one would reach nobody.

        Requires an active owner, admin or moderator membership on this hub,
        presented as a member session token. Any other caller is rejected.
      operationId: segments_hub.get_segments_hub_get_hubs_by_hub_id_segments
      parameters:
        - in: path
          name: hub_id
          required: true
          schema:
            title: Hub Id
            type: string
        - in: query
          name: page[after]
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Page[After]
        - in: query
          name: page[size]
          required: false
          schema:
            default: 20
            maximum: 100
            minimum: 1
            title: Page[Size]
            type: integer
      responses:
        '200':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/HubSegmentListResponse'
          description: Successful Response
        '401':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Not authenticated
        '403':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Forbidden
        '404':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Hub not found
        '422':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    HubSegmentListResponse:
      additionalProperties: false
      description: List response for the hub-scoped segments listing.
      properties:
        data:
          items:
            $ref: '#/components/schemas/HubSegmentResource'
          title: Data
          type: array
        links:
          additionalProperties: true
          title: Links
          type: object
        meta:
          additionalProperties: true
          title: Meta
          type: object
      required:
        - data
        - meta
        - links
      title: HubSegmentListResponse
      type: object
    JsonApiErrorResponse:
      description: Error JSON:API response.
      properties:
        errors:
          items:
            $ref: '#/components/schemas/JsonApiError'
          title: Errors
          type: array
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
      required:
        - errors
      title: JsonApiErrorResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    HubSegmentResource:
      additionalProperties: false
      properties:
        attributes:
          $ref: '#/components/schemas/HubSegmentAttributes'
        id:
          title: Id
          type: string
        type:
          const: segment
          default: segment
          title: Type
          type: string
      required:
        - id
        - attributes
      title: HubSegmentResource
      type: object
    JsonApiError:
      properties:
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
        detail:
          anyOf:
            - type: string
            - type: 'null'
          title: Detail
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
        source:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Source
        status:
          title: Status
          type: string
        title:
          title: Title
          type: string
      required:
        - status
        - title
      title: JsonApiError
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
    HubSegmentAttributes:
      additionalProperties: false
      description: Attributes of a segment as offered to an elevated hub contact.
      properties:
        name:
          title: Name
          type: string
      required:
        - name
      title: HubSegmentAttributes
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT or mio_sk API key
      description: >-
        Send platform JWTs, contact JWTs, or team API keys as `Authorization:
        Bearer <token>`.
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.