# 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 %}


---

# 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.inspector.dev/rest-api/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.
