---
title: "Get Project Metrics"
method: POST
path: "/v1/private/projects/{id}/metrics"
tags: ["Projects"]
---

# Get Project Metrics

`POST /v1/private/projects/{id}/metrics`

Gets specified metrics for a project

## Path parameters

- `id` string, uuid, required

## Request body

- ProjectMetricRequestPublic
  - `metric_type` 'FEEDBACK_SCORES' | 'TRACE_COUNT' | 'TOKEN_USAGE' | 'DURATION' | 'COST' | 'GUARDRAILS_FAILED_COUNT' | 'THREAD_COUNT' | 'THREAD_DURATION' | 'THREAD_FEEDBACK_SCORES' | 'SPAN_FEEDBACK_SCORES' | 'SPAN_COUNT' | 'SPAN_DURATION' | 'SPAN_TOKEN_USAGE' | 'TRACE_AVERAGE_DURATION' | 'TRACE_ERROR_RATE' | 'SPAN_AVERAGE_DURATION' | 'SPAN_COST' | 'SPAN_ERROR_RATE' | 'THREAD_AVERAGE_DURATION' | 'THREAD_COST'
  - `interval` 'HOURLY' | 'DAILY' | 'WEEKLY' | 'TOTAL'
  - `interval_start` string, date-time
  - `interval_end` string, date-time
  - `span_filters` SpanFilterPublic[]
    - `field` string
    - `operator` 'contains' | 'not_contains' | 'starts_with' | 'ends_with' | '=' | '!=' | '>' | '>=' | '<' | '<=' | 'is_empty' | 'is_not_empty' | 'in' | 'not_in'
    - `key` string
    - `value` string
  - `trace_filters` TraceFilterPublic[]
    - `field` string
    - `operator` 'contains' | 'not_contains' | 'starts_with' | 'ends_with' | '=' | '!=' | '>' | '>=' | '<' | '<=' | 'is_empty' | 'is_not_empty' | 'in' | 'not_in'
    - `key` string
    - `value` string
  - `thread_filters` TraceThreadFilterPublic[]
    - `field` string
    - `operator` 'contains' | 'not_contains' | 'starts_with' | 'ends_with' | '=' | '!=' | '>' | '>=' | '<' | '<=' | 'is_empty' | 'is_not_empty' | 'in' | 'not_in'
    - `key` string
    - `value` string
  - `breakdown` BreakdownConfigPublic
    - `field` 'none' | 'tags' | 'metadata' | 'name' | 'error_info' | 'error_type' | 'model' | 'provider' | 'type' | 'guardrail_name'
    - `metadata_key` string
    - `sub_metric` string

## Response `200`

Project Metrics

- ProjectMetricResponsePublic
  - `project_id` string, uuid
  - `metric_type` 'FEEDBACK_SCORES' | 'TRACE_COUNT' | 'TOKEN_USAGE' | 'DURATION' | 'COST' | 'GUARDRAILS_FAILED_COUNT' | 'THREAD_COUNT' | 'THREAD_DURATION' | 'THREAD_FEEDBACK_SCORES' | 'SPAN_FEEDBACK_SCORES' | 'SPAN_COUNT' | 'SPAN_DURATION' | 'SPAN_TOKEN_USAGE' | 'TRACE_AVERAGE_DURATION' | 'TRACE_ERROR_RATE' | 'SPAN_AVERAGE_DURATION' | 'SPAN_COST' | 'SPAN_ERROR_RATE' | 'THREAD_AVERAGE_DURATION' | 'THREAD_COST'
  - `interval` 'HOURLY' | 'DAILY' | 'WEEKLY' | 'TOTAL'
  - `results` ResultsNumberPublic[]
    - `name` string
    - `data` DataPointNumberPublic[]
      - `time` string, date-time, required
      - `value` number

## Other responses

- `400` — Bad Request
- `404` — Not Found

## Changes

- **2026-07-24** `b9b9c770fc73` — 1 info
  - added the new `guardrail_name` enum value to the request property `breakdown/field`
- **2026-05-08** `b9100cf75dd3` — 6 info
  - added the new `in` enum value to the request property `span_filters/items/operator`
  - added the new `in` enum value to the request property `thread_filters/items/operator`
  - added the new `in` enum value to the request property `trace_filters/items/operator`
  - added the new `not_in` enum value to the request property `span_filters/items/operator`
  - …2 more
- **2026-05-04** `d606e84c75e4` — 6 breaking
  - removed the enum value `in` of the request property `span_filters/items/operator`
  - removed the enum value `in` of the request property `thread_filters/items/operator`
  - removed the enum value `in` of the request property `trace_filters/items/operator`
  - removed the enum value `not_in` of the request property `span_filters/items/operator`
  - …2 more

[Change history](https://skmtc.dev/comet-ml/apis/opik-rest-api/changes/v1/private/projects/:id/metrics/post.md)

---

[API](https://skmtc.dev/comet-ml/apis/opik-rest-api.md) · [All operations](https://skmtc.dev/comet-ml/apis/opik-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/comet-ml/opik-rest-api/revisions/1a1bcfd67f99/schema)
