> For AI agents: this page is available as Markdown at <https://docs.absmartly.com/docs/APIs-and-SDKs/Web-Console-API/0100-014-query-experiment-metric-data.md>. The full documentation index is at <https://docs.absmartly.com/llms.txt>.

# Experiment metric results query

`POST /experiments/{experimentId}/metrics/{metricId}`

Base URL: your ABsmartly instance's API endpoint, e.g. `https://<your-subdomain>.absmartly.com/v1`

**Authentication:** send `Authorization: Api-Key <key>`, with an API key from **Settings → API Keys**, or a federated OIDC access token. See [Web Console API authentication](https://docs.absmartly.com/docs/APIs-and-SDKs/overview.md#web-console-api) and [Federated Authentication](https://docs.absmartly.com/docs/APIs-and-SDKs/Federated-Authentication/federated-oidc-tokens.md).

**Required Permissions**: `Experiment GetMetrics` or `Experiment Admin`

## Path parameters

| Name           | Type    | Required | Description                                 |
| -------------- | ------- | -------- | ------------------------------------------- |
| `experimentId` | integer | yes      |                                             |
| `metricId`     |         | yes      | The metric ID or 'main' for the main metric |

## Request body (`application/json`)

* `segment_source` (string). One of: `first_exposure`, `last_exposure`.
* `date_range` (array of string): The date range to filter the data by. This should be an array with two dates, the start and end date (inclusive). Dates should be specified in the format 'YYYY-MM-DD'. If not specified, API returns all data.

### Example request body

```json
{
  "segment_source": "first_exposure"
}
```

## Responses

### 200 The response contains a `columnNames` array that describes what each column represents, and a `rows` array with values for each column. Use the `columnNames` array to identify the index of the column you want to use.

* `ok` (boolean)
* `columnNames` (array of string)
* `columnTypes` (array of string)
* `rows` (array of array)
* `errors` (array of string)
* One of these shapes:
  * Option 1 (requires `columnNames`, `columnTypes`, `rows`)
  * Option 2 (requires `ok`, `errors`)

Example: Success

```json
{
  "columnNames": [
    "variant"
  ],
  "columnTypes": [
    "UInt8"
  ],
  "rows": []
}
```

### Errors

* `400` Bad Request
* `401` Unauthorized
* `403` Forbidden
* `404` Not Found

Source: <https://docs.absmartly.com/openapi/web-console-api.yaml> (operationId `0100_014queryExperimentMetricData`)
