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

# List Segments

> List all segments or retrieve a single segment by ID

<Note>
  Segments are a small, closed set of values accepted by WE, so this endpoint returns **all** of them in a single response — there is **no pagination**.

  Provide the optional `id` query parameter to filter by a specific segment. The response is **always an array**, even when filtering by `id` (it returns an array containing a single item).
</Note>

<Info>
  The `name` field is localized based on the authenticated user's locale: when the locale is English (`en`), the English name is returned, falling back to the default name when no translation is available.
</Info>

## Query Parameters

<ParamField query="id" type="integer">
  The ID of the segment to retrieve. When provided, the response contains only the matching segment (as a single-item array).
</ParamField>

## Response

<ResponseField name="Response" type="array">
  List of segments

  <Expandable title="segment object">
    <ResponseField name="id" type="integer">
      Unique identifier of the segment.
    </ResponseField>

    <ResponseField name="name" type="string">
      Name of the segment, localized according to the authenticated user's locale.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json 200 theme={null}
  [
    {
      "id": 1,
      "name": "Banking"
    },
    {
      "id": 2,
      "name": "Retail"
    }
  ]
  ```

  ```json 404 theme={null}
  {
    "message": "Segment not found"
  }
  ```

  ```json 400 theme={null}
  {
    "message": "Error listing segments"
  }
  ```
</ResponseExample>
