> 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

Access Segments metrics

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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.inspector.dev/rest-api/segments.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
