---
title: Query chart
description: "Computes and returns normalized results for a saved chart. v1 supports event segmentation , sessions , funnels , and retention chart types; other chart types…"
product: general
token_estimate: 3526
---
# Query chart

> For AI agents: a documentation index is available at [/docs/llms.txt](/docs/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

## Query chart

**POST** `/v1/projects/{project_id}/charts/{chart_id}/query`

Full URL: `https://developer-api.amplitude.com/v1/projects/{project_id}/charts/{chart_id}/query`

**Servers:**
- Production: `https://developer-api.amplitude.com/v1/projects/{project_id}/charts/{chart_id}/query`
- Staging: `https://developer-api.stag2.amplitude.com/v1/projects/{project_id}/charts/{chart_id}/query`

Query chart

Computes and returns normalized results for a saved chart. v1 supports
`event_segmentation`, `sessions`, `funnels`, and `retention` chart types;
other chart types return `422` with `error_code: unsupported_chart_type`.
Results reflect the authenticated caller's project access and chart
permissions.

This POST computes a result and does not mutate state. It is therefore a
read operation and does not require an `Idempotency-Key`.

Omitting `time_range` uses the chart's saved range; if the chart has no
saved range, the server defaults to the last 30 days.

Query is synchronous with bounded defaults. Expensive queries may return
`504` when exceeding the server timeout; async query jobs are planned for
a follow-up slice. Retryable responses may include retry advice where
their endpoint-specific error contract provides it.

## Authorizations

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| Authorization | string | Yes | — | http |

## Path parameters

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| project_id (path) | string | Yes | 12345 | Amplitude project identifier, backed by the canonical app ID. Constraints: pattern: ^[0-9]+$ |
| chart_id (path) | string | Yes | — | Saved chart identifier. Constraints: min length: 1 |

## Body (application/json)

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| time_range | object | No | — | — |
| time_range.start | string | Yes | — | Inclusive start date (project timezone unless `timezone` is set on query). Constraints: format: date |
| time_range.end | string | Yes | — | Inclusive end date. Constraints: format: date |
| timezone | string | No | America/New_York | IANA timezone identifier (e.g. `America/New_York`). |
| exclude_incomplete_datapoints | boolean | No | false | When true, excludes the current incomplete interval from results. |
| group_by_limit | integer | No | 10 | Maximum number of breakdown groups returned per series. Constraints: min: 1, max: 1000 |
| time_series_limit | integer | No | 100 | Maximum number of time buckets per series. `0` collapses each series to a single scalar aggregate. Constraints: min: 0, max: 1000 |

## Response (application/json)

**200** — Query completed successfully.

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| data | object | Yes | — | — |
| data.id | string | Yes | — | Identifier for this query execution. |
| data.object | string | Yes | — | Resource-type discriminator. Always `analytics_result`. |
| data.source_type | string | Yes | — | Source artifact type. v1 supports `chart` only. `dashboard` and `query` are reserved for future slices. Allowed values: chart |
| data.source_id | string | Yes | — | Identifier of the source chart. |
| data.project_id | string | Yes | — | Constraints: pattern: ^[0-9]+$ |
| data.computed_at | string | Yes | — | Constraints: format: date-time |
| data.timezone | string | Yes | — | IANA timezone used for computation. |
| data.result_kind | string | Yes | — | High-level shape of the normalized result payload. Adapters set this explicitly per supported chart type; `unknown` means the server could not classify the result shape safely. Allowed values: timeseries, scalar, funnel, retention, table, unknown |
| data.metric_semantics | object | Yes | — | — |
| data.metric_semantics.additive | boolean | Yes | — | When false, values must not be summed across time intervals or groups without understanding deduplication semantics. |
| data.metric_semantics.recommended_aggregate | string | Yes | — | Recommended aggregation method for downstream consumers. Non-additive metrics (e.g. unique users) must not be summed across intervals. `unknown` is used when the adapter cannot determine a safe aggregate; treat values as non-additive in that case. Allowed values: sum, last, mean, deduped_total, none, unknown |
| data.metric_semantics.notes | string | No | — | Human-readable guidance for interpreting values. Constraints: nullable |
| data.data | object | Yes | — | Normalized result payload. Populated fields depend on `result_kind`. Timeseries and funnel results use `dimensions` and `series`. Table results use `columns` and `rows`. |
| data.data.dimensions | object[] | No | — | — |
| data.data.dimensions.id | string | Yes | — | — |
| data.data.dimensions.label | string | Yes | — | — |
| data.data.dimensions.role | string | Yes | — | Role of this dimension in the result. Allowed values: time, segment, breakdown, step |
| data.data.series | object[] | No | — | — |
| data.data.series.id | string | Yes | — | — |
| data.data.series.label | string | Yes | — | — |
| data.data.series.points | object[] | Yes | — | — |
| data.data.series.points.x | oneOf | Yes | — | Dimension value (typically an ISO date or category label). Constraints: string, number |
| data.data.series.points.y | number | Yes | — | Metric value at this point. Constraints: nullable |
| data.data.series.points.complete | boolean | No | — | When false, the interval is incomplete (current bucket). Only present when `exclude_incomplete_datapoints` is false. |
| data.data.series.aggregate | object | No | — | Optional pre-computed aggregate for the series. |
| data.data.series.aggregate.value | number | Yes | — | Constraints: nullable |
| data.data.series.aggregate.method | string | Yes | — | — |
| data.data.columns | string[] | No | — | Column headers for table-shaped results. |
| data.data.rows | oneOf[][] | No | — | — |
| data.metadata | object | Yes | — | Echo of effective query parameters and chart context. |
| data.metadata.chart_type | string | No | — | Public chart type discriminator (snake_case). All values may appear on list/get; query returns `422` (`unsupported_chart_type`) for types outside the v1 supported matrix. Unsupported or unrecognized chart types are surfaced as `unknown`. New chart types may be added over time. Clients should treat `unknown` as "a chart type this API version does not model yet". Allowed values: event_segmentation, sessions, funnels, retention, composition, revenue_ltv, stickiness, data_table, engagement_matrix, metric_explorer, growth_accounting, impact, users, unknown |
| data.metadata.chart_name | string | No | — | — |
| data.metadata.time_range | object | No | — | — |
| data.metadata.time_range.start | string | Yes | — | Inclusive start date (project timezone unless `timezone` is set on query). Constraints: format: date |
| data.metadata.time_range.end | string | Yes | — | Inclusive end date. Constraints: format: date |
| data.metadata.exclude_incomplete_datapoints | boolean | No | — | — |
| data.metadata.group_by_limit | integer | No | — | — |
| data.metadata.time_series_limit | integer | No | — | — |
| data.warnings | string[] | Yes | — | Non-fatal issues encountered during query execution. |
| data.truncated | oneOf | No | — | Constraints: object, null |
| data.truncated.group_by_limit | integer | No | — | Applied group-by limit when breakdown was truncated. |
| data.truncated.time_series_limit | integer | No | — | Applied time-series limit when buckets were truncated. |
| data.truncated.reason | string | No | — | Human-readable explanation of truncation. |

```json
{
  "data": {
    "id": "string",
    "object": "analytics_result",
    "source_type": "chart",
    "source_id": "string",
    "project_id": "string",
    "computed_at": "2024-01-01T00:00:00Z",
    "timezone": "string",
    "result_kind": "timeseries",
    "metric_semantics": {
      "additive": true,
      "recommended_aggregate": "sum",
      "notes": "string"
    },
    "data": {
      "dimensions": [
        {
          "id": "string",
          "label": "string",
          "role": "time"
        }
      ],
      "series": [
        {
          "id": "string",
          "label": "string",
          "points": [
            {
              "x": {},
              "y": 0,
              "complete": true
            }
          ],
          "aggregate": {
            "value": 0,
            "method": "string"
          }
        }
      ],
      "columns": [
        "string"
      ],
      "rows": [
        [
          {}
        ]
      ]
    },
    "metadata": {
      "chart_type": "event_segmentation",
      "chart_name": "string",
      "time_range": {
        "start": "2024-01-01",
        "end": "2024-01-01"
      },
      "exclude_incomplete_datapoints": true,
      "group_by_limit": 0,
      "time_series_limit": 0
    },
    "warnings": [
      "string"
    ],
    "truncated": {
      "group_by_limit": 0,
      "time_series_limit": 0,
      "reason": "string"
    }
  }
}
```

**400**

**401**

**403**

**404**

**422** — Chart type is not supported for public query in this version. The
request was understood but cannot be processed. Returned with
`error_code: unsupported_chart_type`; `detail` names the chart type
and the currently supported set.


| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| type | string | Yes | — | Constraints: format: uri |
| title | string | Yes | — | — |
| status | integer | Yes | — | Constraints: min: 400, max: 599 |
| detail | string | No | — | Constraints: nullable |
| instance | string | No | — | Constraints: format: uri, nullable |
| error_code | string | Yes | — | — |
| retryable | boolean | Yes | — | — |
| retry_after_seconds | integer | No | — | Constraints: nullable, min: 0 |
| validation_errors | object[] | No | — | Constraints: nullable |

```json
{
  "type": "https://example.com",
  "title": "Chart type is not supported for public query in this version. The\nrequest was understood but cannot be processed. Returned with\n`error_code: unsupported_chart_type`; `detail` names the chart type\nand the currently supported set.\n",
  "status": 422,
  "detail": "string",
  "instance": "https://example.com",
  "error_code": "string",
  "retryable": true,
  "retry_after_seconds": 0,
  "validation_errors": [
    {
      "field": "string",
      "message": "string",
      "code": "string"
    }
  ]
}
```

**429**

**500**

**502**

**504** — Query exceeded the synchronous timeout.

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| type | string | Yes | — | Constraints: format: uri |
| title | string | Yes | — | — |
| status | integer | Yes | — | Constraints: min: 400, max: 599 |
| detail | string | No | — | Constraints: nullable |
| instance | string | No | — | Constraints: format: uri, nullable |
| error_code | string | Yes | — | — |
| retryable | boolean | Yes | — | — |
| retry_after_seconds | integer | No | — | Constraints: nullable, min: 0 |
| validation_errors | object[] | No | — | Constraints: nullable |

```json
{
  "type": "https://example.com",
  "title": "Query exceeded the synchronous timeout.",
  "status": 504,
  "detail": "string",
  "instance": "https://example.com",
  "error_code": "string",
  "retryable": true,
  "retry_after_seconds": 0,
  "validation_errors": [
    {
      "field": "string",
      "message": "string",
      "code": "string"
    }
  ]
}
```

## Code samples

### cURL

```bash
curl -X POST "https://developer-api.amplitude.com/v1/projects/12345/charts/{chart_id}/query" \
  -H "Content-Type: application/json" \
  -H "Authorization: YOUR_API_KEY"
```

### Python

```python
import requests

response = requests.post(
    "https://developer-api.amplitude.com/v1/projects/12345/charts/{chart_id}/query",
    headers={
        "Content-Type": "application/json",
        "Authorization": "YOUR_API_KEY"
    }
)
data = response.json()
```

### JavaScript

```javascript
const response = await fetch("https://developer-api.amplitude.com/v1/projects/12345/charts/{chart_id}/query", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "YOUR_API_KEY"
  }
});
const data = await response.json();
```

### PHP

```php
<?php
$ch = curl_init("https://developer-api.amplitude.com/v1/projects/12345/charts/{chart_id}/query");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Content-Type: application/json",
    "Authorization: YOUR_API_KEY"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
```

### Go

```go
package main

import (
  "bytes"
  "net/http"
)

func main() {
req, _ := http.NewRequest("POST", "https://developer-api.amplitude.com/v1/projects/12345/charts/{chart_id}/query", nil)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "YOUR_API_KEY")
  client := &http.Client{}
  resp, _ := client.Do(req)
  defer resp.Body.Close()
}
```

### Java

```java
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
      .uri(URI.create("https://developer-api.amplitude.com/v1/projects/12345/charts/{chart_id}/query"))
      .method("POST", HttpRequest.BodyPublishers.noBody())
.header("Content-Type", "application/json")
      .header("Authorization", "YOUR_API_KEY")
      .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
```

### Ruby

```ruby
require "net/http"
require "json"

uri = URI("https://developer-api.amplitude.com/v1/projects/12345/charts/{chart_id}/query")
request = Net::HTTP::Post.new(uri)
request["Content-Type"] = "application/json"
request["Authorization"] = "YOUR_API_KEY"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
  http.request(request)
end
```

