---
openapi: 3.0.3
info:
  title: Braze REST API – Export segment details
  description: |
    ## Prerequisites

    To use this endpoint, you'll need an [API key]({{site.baseurl}}/api/basics#rest-api-key-permissions) with the `segments.details` permission.

    ## Rate limit

    We apply the default Braze rate limit of 250,000 requests per hour to this endpoint, as documented in [API rate limits]({{site.baseurl}}/api/api_limits/).
  version: 1.0.0
  contact:
    name: Braze Support
    url: https://www.braze.com/docs/braze_support/
  license:
    name: Braze Documentation
    url: https://www.braze.com/docs/api/home/
servers:
  - url: https://rest.iad-01.braze.com
    description: US-01
  - url: https://rest.iad-02.braze.com
    description: US-02
  - url: https://rest.iad-03.braze.com
    description: US-03
  - url: https://rest.iad-04.braze.com
    description: US-04
  - url: https://rest.iad-05.braze.com
    description: US-05
  - url: https://rest.iad-06.braze.com
    description: US-06
  - url: https://rest.iad-07.braze.com
    description: US-07
  - url: https://rest.iad-08.braze.com
    description: US-08
  - url: https://rest.us-10.braze.com
    description: US-10
  - url: https://rest.fra-01.braze.eu
    description: EU-01
  - url: https://rest.fra-02.braze.eu
    description: EU-02
  - url: https://rest.au-01.braze.com
    description: AU-01
  - url: https://rest.id-01.braze.com
    description: ID-01
  - url: https://rest.jp-01.braze.com
    description: JP-01
  - url: https://rest.kr-01.braze.com
    description: KR-01
security:
- BearerAuth: []
paths:
  "/segments/details":
    get:
      summary: Export segment details
      operationId: get_segments_details_get_segment_details
      parameters:
        - name: segment_id
          in: query
          required: true
          description: |
            See [Segment API identifier]({{site.baseurl}}/api/identifier_types/).

            The `segment_id` for a given segment can be found on the [API Keys]({{site.baseurl}}/user_guide/administer/global/workspace_settings/apis_and_identifiers/) page within your Braze account or you can use the [Export segment list endpoint]({{site.baseurl}}/api/endpoints/export/segments/get_segment/).
          schema:
            type: string
          example: segment_identifier
      responses:
        "200":
          description: |
            The request succeeded and the response body includes the segment details. No action needed.

            The following sample response shows an example of the response returned when you export segment details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SegmentDetailsResponse'
              examples:
                success:
                  summary: Segment details
                  value:
                    message: success
                    created_at: "2023-01-15T10:30:00+00:00"
                    updated_at: "2023-03-01T08:00:00+00:00"
                    name: Example segment
                    description: Users who have used these apps more than 5 times
                    text_description: Engaged users for the spring campaign
                    tags:
                      - example_tag_1
                      - example_tag_2
                    teams:
                      - Example team
                    estimated_size: 125000
                    estimated_size_updated_at: "2023-03-01T08:15:00+00:00"
                    filters:
                      AND:
                        - custom_attribute:
                            custom_attribute_name: favorite_shows
                            comparison: includes_value
                            value: Example Show
                        - email_subscription_status_filter:
                            comparison: is
                            value: subscribed
        "400":
          description: |
            Bad request. The `segment_id` is missing, isn't a string, or doesn't match a segment in this workspace. Pass a valid `segment_id` string. Find it on the [API Keys page]({{site.baseurl}}/user_guide/administer/global/workspace_settings/apis_and_identifiers/) or with the [Export segment list endpoint]({{site.baseurl}}/api/endpoints/export/segments/get_segment/).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_segment_id:
                  summary: Missing or invalid segment_id
                  value:
                    message: segment_id must be a string of the object api identifier
        "401":
          description: |
            Unauthorized. The REST API key is missing, malformed, or sent to the wrong REST endpoint. Send the key as `Authorization: Bearer YOUR_REST_API_KEY` to the correct [REST endpoint]({{site.baseurl}}/api/basics/#endpoints). For more causes, see [Errors and responses]({{site.baseurl}}/api/errors/#fatal-errors).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_api_key:
                  summary: Invalid API key
                  value:
                    message: 'Invalid API key: YOUR_REST_API_KEY'
        "403":
          description: Access denied. The REST API key doesn't have the required permission. Use a REST API key that has the `segments.details` permission.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                access_denied:
                  summary: Missing permission
                  value:
                    message: Access Denied
        "429":
          description: |
            Rate limited. You exceeded the rate limit for this endpoint. Slow your request rate and retry with exponential backoff. See [API rate limits]({{site.baseurl}}/api/api_limits/).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                over_rate_limit:
                  summary: Over rate limit
                  value:
                    message: You have exceeded your limit of 250000 requests per hour. Please contact your account executive to increase your limit. If you do not have their info, you may contact Braze directly at https://www.braze.com/contact/.
        5XX:
          description: |
            Internal server error. An unexpected error occurred on the Braze server. Retry with exponential backoff. If the error persists, contact [Support]({{site.baseurl}}/braze_support/).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: REST API key
      description: |
        REST API keys are created in the Braze dashboard at **Settings → APIs and
        Identifiers → API Keys**. The key must include the `segments.details` permission.
        Pass the key as `Authorization: Bearer YOUR_REST_API_KEY`.
  schemas:
    SegmentDetailsResponse:
      title: Export segment details response
      type: object
      properties:
        message:
          type: string
          description: Returns 'success' when the request completes without errors.
          example: success
        created_at:
          type: string
          description: The date created as ISO 8601 date.
          example: "2023-01-15T10:30:00+00:00"
        updated_at:
          type: string
          description: The date last updated as ISO 8601 date.
          example: "2023-03-01T08:00:00+00:00"
        name:
          type: string
          description: The segment name.
          example: Example segment
        description:
          type: string
          description: A human-readable description of filters.
          example: Users who have used these apps more than 5 times
        text_description:
          type: string
          description: The segment description.
          example: Engaged users for the spring campaign
        tags:
          type: array
          items:
            type: string
          description: The tag names associated with the segment formatted as strings.
          example:
            - example_tag_1
            - example_tag_2
        teams:
          type: array
          items:
            type: string
          description: The names of the Teams associated with the campaign.
          example:
            - Example team
        estimated_size:
          type: integer
          nullable: true
          description: |
            The latest estimated number of users in the segment, or `null` if Braze hasn't computed a size for the segment yet. For large workspaces, this value can be estimated from a sample of users.

            Braze computes this value asynchronously after a segment is created or its audience changes, and refreshes it once a day. After you create a segment or edit its audience, poll this endpoint until `estimated_size_updated_at` is later than the time of your change.
          example: 125000
        estimated_size_updated_at:
          type: string
          format: date-time
          nullable: true
          description: The time Braze last computed `estimated_size`, in ISO 8601 format, or `null` if Braze hasn't computed a size for the segment yet.
          example: "2023-03-01T08:15:00+00:00"
        filters:
          type: object
          description: |
            The segment's filters, as a tree of `AND` and `OR` conditions that use connected audience filter keys. Returns `{}` when the segment has no filters.

            This object uses the same format as the [connected audience object]({{site.baseurl}}/api/objects_filters/connected_audience), so you can pass it back unchanged as an `audience` value.
          example:
            AND:
              - custom_attribute:
                  custom_attribute_name: favorite_shows
                  comparison: includes_value
                  value: Example Show
              - email_subscription_status_filter:
                  comparison: is
                  value: subscribed
    ErrorResponse:
      title: Error
      type: object
      properties:
        message:
          type: string
          description: The error message describing why the request failed.
        errors:
          type: array
          description: Non-fatal errors encountered while processing the request. Data unaffected by these errors is still processed.
          items:
            type: object
            properties:
              type:
                type: string
                description: The error type.
