---
title: "Aggregate LLM Observability experimentation"
method: POST
path: "/api/v2/llm-obs/v1/experimentation/analytics"
tags: ["LLM Observability"]
---

# Aggregate LLM Observability experimentation

`POST /api/v2/llm-obs/v1/experimentation/analytics`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/llm-obs/v1/experimentation/analytics`
- Auth: API key in header `DD-API-KEY` and API key in header `DD-APPLICATION-KEY`

Execute an analytics aggregation over LLM Observability experimentation data.
Use this endpoint to compute metrics (for example average eval scores) grouped by fields such as `span_id` or `experiment_id`.

At least one `compute` definition and one `index` must be provided.

## Request body

- LLMObsExperimentationAnalyticsRequest: Request to run an analytics aggregation over LLM Observability experimentation data.
  - `data` LLMObsExperimentationAnalyticsDataRequest, required: Data object for an analytics request.
    - `attributes` LLMObsExperimentationAnalyticsDataAttributesRequest, required: Attributes for an analytics request.
      - `aggregate` LLMObsExperimentationAnalyticsAggregate, required: Analytics aggregation parameters.
        - `compute` LLMObsExperimentationAnalyticsCompute[], required: List of metric computations to perform.
          - `metric` string, required: Name of the metric to compute.
          - `name` string: Optional alias for this computation in the response.
        - `dataset_version` integer, nullable: Filter to a specific dataset version.
        - `group_by` LLMObsExperimentationAnalyticsGroupBy[]: Fields to group results by.
          - `field` string, required: Field name to group by.
        - `indexes` string[], required: Data indexes to query. At least one is required.
        - `limit` integer, nullable: Maximum number of results to return.
        - `search` LLMObsExperimentationAnalyticsSearch, required: Search query for filtering analytics data.
          - `query` string, required: Filter expression.
        - `time` LLMObsExperimentationAnalyticsTimeRange: Unix-millisecond time range for filtering analytics data.
          - `from` integer, required: Start of the time range in milliseconds since Unix epoch.
          - `to` integer, required: End of the time range in milliseconds since Unix epoch.
    - `type` 'experimentation', required: Resource type for experimentation search and analytics operations.

## Response `200`

OK

- LLMObsExperimentationAnalyticsResponse: Response to an analytics query.
  - `data` LLMObsExperimentationAnalyticsDataResponse, required: JSON:API data object for an analytics response.
    - `attributes` LLMObsExperimentationAnalyticsDataAttributesResponse, required: Attributes of an analytics response.
      - `hit_count` integer, required: Total number of events matched by the query before grouping.
      - `result` LLMObsExperimentationAnalyticsResult, required: Analytics query result containing all buckets.
        - `values` LLMObsExperimentationAnalyticsValue[], required: List of result buckets.
          - `by` object: The group-by field values for this bucket.
          - `metrics` object, required: Computed metric values for this bucket.
    - `id` string, required: Server-generated identifier for this analytics result.
    - `type` 'experimentation', required: Resource type for experimentation search and analytics operations.

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `429`: Too many requests
- `500`: Internal Server Error

---

[API](https://skmtc.dev/datadog/apis/datadog-api-v2-collection.md) - [All operations](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/llms.txt) - [OpenAPI document](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/revisions/da68bf029e4c?raw)
