---
title: "Get Metrics"
method: GET
path: "/agents/{agent_id}/metrics"
tags: ["/agents/{id}/query"]
---

# Get Metrics

`GET /agents/{agent_id}/metrics`

Returns usage and user-provided feedback data. This information can be used for data-driven improvements and optimization.

## Path parameters

- `agent_id` string, uuid, required — Agent ID of the agent to get metrics for

## Query parameters

- `conversation_ids` string[] — Filter messages by conversation ids.
- `user_emails` string[] — Filter messages by users.
- `created_after` string, date-time — Filters messages that are created after the specified timestamp.
- `created_before` string, date-time — Filters messages that are created before specified timestamp. If both `created_after` and `created_before` are not provided, then `created_before` will be set to the current time and `created_after` will be set to the `created_before` - 2 days. If only `created_after` is provided, then `created_before` will be set to the `created_after` + 2 days. If only `created_before` is provided, then `created_after` will be set to the `created_before` - 2 days. If both `created_after` and `created_before` are provided, and the difference between them is more than 2 days, then `created_after` will be set to the `created_before` - 2 days.
- `limit` integer — Limits the number of messages to return.
- `offset` integer — Offset for pagination.

## Response `200`

Successful Response

- MetricsResponse
  - `messages` unknown[] — List of messages.
    - unknown
  - `total_count` integer, required — Total number of messages.
  - `next_offset` integer — Offset for the next page. If there are no more messages to get, then this is not set.

## Other responses

- `422` — Validation Error

## Changes

- **2025-03-11** `194878b194cd` — 2 info
  - added the new optional `query` request parameter `conversation_ids`
  - added the new optional `query` request parameter `user_emails`
- **2025-01-14** `448bcb901d30` — 1 info
  - api operation id `get_metrics_for_an_agent_agents__agent_id__metrics_get` removed and replaced with `Get_Metrics_agents__agent_id__metrics_get`
- **2025-01-14** `4dd01a1cc34b` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/contextualai/apis/endpoints/changes/agents/:agent_id/metrics/get.md)

---

[API](https://skmtc.dev/contextualai/apis/endpoints.md) · [All operations](https://skmtc.dev/contextualai/apis/endpoints/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/contextualai/endpoints/revisions/ca7f807eec8b/schema)
