---
title: Query zone metrics
description: "Returns one metric for every zone on a page URL, ranked by value. A zone is identified by the CSS selector of its element. Results reflect the authenticated…"
product: general
lang: en
last_updated: 2026-10-05
token_estimate: 2553
---
# Query zone metrics

## Query zone metrics

**POST** `/v1/projects/{project_id}/zoning/zone-metrics`

Full URL: `https://developer-api.amplitude.com/v1/projects/{project_id}/zoning/zone-metrics`

> 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`.

**Servers:**
- Production (US): `https://developer-api.amplitude.com/v1/projects/{project_id}/zoning/zone-metrics`
- Production (EU): `https://developer-api.eu.amplitude.com/v1/projects/{project_id}/zoning/zone-metrics`

Query zone metrics

Returns one metric for every zone on a page URL, ranked by value. A zone
is identified by the CSS selector of its element. Results reflect the
authenticated caller's project access and data access controls.

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 last 30 days in the project timezone. The
span of `time_range` cannot exceed 90 days.

## 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]+$ |

## Body (application/json)

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| page_url | string | Yes | https://example.com/pricing | Page URL to analyze. Accepts `http` and `https` URLs; a URL without a scheme is treated as `https`. The query string and fragment are removed before matching, so `https://example.com/pricing?utm=x` and `https://example.com/pricing` are the same page. Constraints: min length: 1, max length: 2048 |
| url_match | string | No | is | How `page_url` is matched against the page URL recorded on each event. `is` matches the exact URL; `contains` matches any URL containing it. Allowed values: is, contains |
| 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 |
| metric | string | No | click_rate_pageview | Metric computed per zone. Rates are fractions (`0.18` is 18%). - `click_rate_pageview`: page views with a click in the zone, divided by page views. - `click_rate_session`: sessions with a click in the zone, divided by sessions. - `rage_click_rate_pageview`: page views with a rage click in the zone, divided by page views. - `rage_click_rate_session`: sessions with a rage click in the zone, divided by sessions. - `click_distribution`: clicks in the zone, divided by all clicks on the page. - `click_recurrence`: clicks in the zone, divided by page views. Can exceed 1. - `rage_click_recurrence`: rage clicks in the zone, divided by page views. Can exceed 1. - `exposure_rate`: page views where the zone was visible, divided by page views. - `attractiveness_rate`: page views where the zone was visible and clicked, divided by page views where it was visible. Can exceed 1. - `revenue_per_click`: revenue attributed to the zone, divided by sessions that clicked it, in the project's revenue unit. Allowed values: click_rate_pageview, click_rate_session, rage_click_rate_pageview, rage_click_rate_session, click_distribution, click_recurrence, rage_click_recurrence, exposure_rate, attractiveness_rate, revenue_per_click |
| zone_ids | string[] | No | — | Restrict the result to these zones. A zone id is the CSS selector of the element, as returned in `zones[].zone_id`. Omit to rank every zone on the page. |
| limit | integer | No | 20 | Maximum number of zones returned after ranking by `value`. Constraints: min: 1, max: 200 |

## Response (application/json)

**200** — Zone metrics computed successfully.

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| data | object | Yes | — | One metric for every zone on a page, ranked by `value` descending. Results reflect the caller's data access. |
| data.id | string | Yes | — | Identifier for this computation. |
| data.object | string | Yes | — | Resource-type discriminator. Always `zone_metrics`. |
| data.project_id | string | Yes | — | Constraints: pattern: ^[0-9]+$ |
| data.page_url | string | Yes | — | The page URL after normalization. |
| data.url_match | string | Yes | is | How `page_url` is matched against the page URL recorded on each event. `is` matches the exact URL; `contains` matches any URL containing it. Allowed values: is, contains |
| data.metric | string | Yes | click_rate_pageview | Metric computed per zone. Rates are fractions (`0.18` is 18%). - `click_rate_pageview`: page views with a click in the zone, divided by page views. - `click_rate_session`: sessions with a click in the zone, divided by sessions. - `rage_click_rate_pageview`: page views with a rage click in the zone, divided by page views. - `rage_click_rate_session`: sessions with a rage click in the zone, divided by sessions. - `click_distribution`: clicks in the zone, divided by all clicks on the page. - `click_recurrence`: clicks in the zone, divided by page views. Can exceed 1. - `rage_click_recurrence`: rage clicks in the zone, divided by page views. Can exceed 1. - `exposure_rate`: page views where the zone was visible, divided by page views. - `attractiveness_rate`: page views where the zone was visible and clicked, divided by page views where it was visible. Can exceed 1. - `revenue_per_click`: revenue attributed to the zone, divided by sessions that clicked it, in the project's revenue unit. Allowed values: click_rate_pageview, click_rate_session, rage_click_rate_pageview, rage_click_rate_session, click_distribution, click_recurrence, rage_click_recurrence, exposure_rate, attractiveness_rate, revenue_per_click |
| data.time_range | object | Yes | — | — |
| data.time_range.start | string | Yes | — | Inclusive start date (project timezone unless `timezone` is set on query). Constraints: format: date |
| data.time_range.end | string | Yes | — | Inclusive end date. Constraints: format: date |
| data.timezone | string | Yes | — | IANA timezone used to resolve `time_range` day boundaries (the project timezone). |
| data.zone_count | integer | Yes | — | Number of zones returned. Constraints: min: 0 |
| data.total_zone_count | integer | Yes | — | Number of zones with data before `limit` was applied. Constraints: min: 0 |
| data.truncated | boolean | Yes | — | `true` when `total_zone_count` exceeds `zone_count`. |
| data.zones | object[] | Yes | — | — |
| data.zones.zone_id | string | Yes | — | CSS selector identifying the zone. |
| data.zones.value | number | Yes | — | The metric value for this zone. Rates are fractions and are returned uncapped. |
| data.warnings | string[] | Yes | — | Non-fatal conditions. Includes a warning when the numbers behind a rate were computed from differently aged cache snapshots, which can push a rate above its natural bound. |

```json
{
  "data": {
    "id": "string",
    "object": "zone_metrics",
    "project_id": "string",
    "page_url": "string",
    "url_match": "is",
    "metric": "click_rate_pageview",
    "time_range": {
      "start": "2024-01-01",
      "end": "2024-01-01"
    },
    "timezone": "string",
    "zone_count": 0,
    "total_zone_count": 0,
    "truncated": true,
    "zones": [
      {
        "zone_id": "string",
        "value": 0
      }
    ],
    "warnings": [
      "string"
    ]
  }
}
```

**400**

**401**

**403**

**404**

**422**

**429**

**500**

**502**

**503**

**504**

## Code samples

### cURL

```bash
curl -X POST "https://developer-api.amplitude.com/v1/projects/12345/zoning/zone-metrics" \
  -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/zoning/zone-metrics",
    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/zoning/zone-metrics", {
  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/zoning/zone-metrics");
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/zoning/zone-metrics", 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/zoning/zone-metrics"))
      .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/zoning/zone-metrics")
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
```

