# Listing Segments

<mark style="color:orange;">`POST`</mark> <mark style="color:red;">`http`</mark>`://api.ants.tech/access/api/segment/listing`

## Request

### Body

* `page` <mark style="color:red;">(\*)</mark> Page number of the listing
* `limit` <mark style="color:red;">(\*)</mark> Maximum number of items per page
* `search` Keyword to search the Segment (can be the segment name or ID)
* `columns` <mark style="color:red;">(\*)</mark>: Columns to be retrieved in the listing. Chosen from the list below:

| Name                     | Data Type | Example |
| ------------------------ | --------- | ------- |
| `c_user_id`              |           |         |
| `compute_schedule`       |           |         |
| `compute_schedule_end`   |           |         |
| `compute_schedule_start` |           |         |
| `ctime`                  |           |         |
| `item_type_id`           |           |         |
| `label_ids`              |           |         |
| `last_processed_date`    |           |         |
| `process_status`         |           |         |
| `response_code`          |           |         |
| `segment_display`        |           |         |
| `segment_id`             |           |         |
| `segment_size`           |           |         |
| `source_names`           |           |         |
| `status`                 |           |         |
| `storage_type`           |           |         |
| `u_user_id`              |           |         |
| `update_method`          |           |         |
| `utime`                  |           |         |

* `sort`\[optional]: Column to sort the listing result (default: `u_user_id`)
* `sd`\[optional]: Sort direction for the listing result (default: `desc`)
  * `desc`: Descending order
  * `asc`: Ascending order
* `filters`: Filter the listing based on conditions
  * `OR`: Filter conditions using OR logic
    * `AND`: Filter conditions using AND logic
      * `column`: Name of the column to filter
      * `data_type`: Data type of the column
      * `operator`: Operator used for filtering
      * `value`: Value to filter by

### Headers

| Name                                            | Description             |
| ----------------------------------------------- | ----------------------- |
| Authorization<mark style="color:red;">\*</mark> | Bearer `<ACCESS_TOKEN>` |

## Response

* `entries`: List of segments
* `meta`:
  * `perPage`: Number of items to limit when retrieving the list
  * `total`: Total number of segments

{% tabs %}
{% tab title="200: OK The request is succeeded, the server responds with the customer profile" %}

<pre class="language-json"><code class="lang-json">{
  "code": 200,
  "message": "Success",
  "data": {
    "meta": {
      "perPage": 100,
      "total": 110
    },
    "entries": [
      {
        "row_count": "110",
        "c_user_id": "Antsomi Product",
        "compute_schedule": "--",
        "compute_schedule_end": "04 July 2024 02:00:00",
        "compute_schedule_start": "2024-06-27T12:00:00.000Z",
        "ctime": "2024-06-27T11:26:54.373Z",
        "item_type_id": -1003,
        "label_ids": [],
        "last_processed_date": "2024-06-27T11:26:54.373Z",
        "process_status": 2,
        "response_code": null,
        "segment_display": "Unsubscribe Customer",
        "segment_id": 17202932,
        "segment_size": null,
        "source_names": null,
        "status": 1,
        "storage_type": "3",
        "u_user_id": "Antsomi Product",
        "update_method": "static",
        "utime": "2024-10-30T02:45:01.332Z",
        "segment_type": 4,
        "used_by_modules": [],
        "accepted_actions": {
          "EDIT": true,
          "CLONE": true,
          "DISABLE": true,
          "DELETE": true,
          "EDIT_NAME": true,
          "EDIT_CONDITION": true
        },
        "isEdit": true
<strong>      }
</strong>    ]
  },
  "duration": "0.594 ms"
}
      

</code></pre>

{% endtab %}

{% tab title="403: Forbidden The authorization process is failed, caused by an invalid token, an expired token or a token without the valid scope." %}

```json
{
    "code": 301,
    "message": "Permission denied",
    "data": "You don't have permission to access this request!"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.antsomi.com/api-guide/endpoint/segment-api/listing-segments.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
