> For the complete documentation index, see [llms.txt](https://docs.inspector.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.inspector.dev/rest-api/segments.md).

# Segments

Transactions metrics are always related to an App. This means that all endpoints have the same root so it could be helpful to wrap your api call under the same base URI:

&#x20;`https://app.inspector.dev`**`/api/apps/:id`**

## Segments List

<mark style="color:green;">`GET`</mark> `/api/apps/:id/segments`

Get the list of Segments in the given interval.

#### Path Parameters

| Name                                 | Type    | Description      |
| ------------------------------------ | ------- | ---------------- |
| id<mark style="color:red;">\*</mark> | Integer | App's identifier |

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Body**

| Name                                              | Type   | Description                             |
| ------------------------------------------------- | ------ | --------------------------------------- |
| `filter.start`<mark style="color:red;">`*`</mark> | string | ISO-8601 date format                    |
| `filter.end`                                      | string | ISO-8601 date format                    |
| `filter.types`                                    | array  | Filter the transactions list by servers |
| `filter.query_string`                             | string | Filter by Segment's label               |

**Response**

{% tabs %}
{% tab title="200" %}

```json
[
    {
        type: "mysql",
        segments: [
            {
                type: "mysql",
                start: 123,
                duration: 42.8,
                group_hash: "4fbb4fa36bad346bbe8a26827a244e70",
                hash: "37d6f2a1bd370759ff46cc63266603b81b60da4774bfa9a72af7bf26ba3d4fb1",
                memory_peak: 16.98,
                label: "SELECT * FROM users",
                app_id: 389,
                timestamp: "2024-10-04 16:52:02",
                hits: 60,
            },
            
            ...,
        ],
    },
    
    ...,
]
```

{% endtab %}
{% endtabs %}
