# Retrieve metric history

Returns historical transaction metric buckets over up to 90 days, grouped by one dimension.

Source: https://zerocopy.sh/docs/reference/management-api/retrieve-metric-history

`GET https://console.zerocopy.sh/api/v1/metrics/series`

Authentication: API key, one of: `Authorization: Bearer` header.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `metric` | query | `"transactions"` or `"landed_rate"` or `"failed_rate"` or `"expired_rate"` or `"slots_to_land"` or `"edge_time"` or `"tips"` or `"priority_fees"` | yes |  |
| `group_by` | query | `"key"` or `"metro"` or `"outcome"` or `"path"` or `"source"` or `"kind"` | no |  |
| `quantile` | query | `0.5` or `0.9` or `0.99` | no | Default `0.5`. |
| `range` | query | `"1h"` or `"24h"` or `"7d"` or `"30d"` | no | Default `"24h"`. |
| `from` | query | string (date-time) | no |  |
| `to` | query | string (date-time) | no |  |
| `key_id` | query | string or array of string | no |  |
| `metro` | query | string or array of string | no |  |
| `outcome` | query | `"landed"` or `"failed"` or `"expired"` or array of `"landed"` or `"failed"` or `"expired"` | no |  |

## Responses

### 200

Current transaction history, matching the console Metrics page

Content type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `metric` | `"transactions"` or `"landed_rate"` or `"failed_rate"` or `"expired_rate"` or `"slots_to_land"` or `"edge_time"` or `"tips"` or `"priority_fees"` | yes |  |
| `unit` | `"transactions"` or `"percent"` or `"slots"` or `"microseconds"` or `"lamports"` | yes |  |
| `quantile` | `0.5` or `0.9` or `0.99` | no |  |
| `step_seconds` | integer | yes | maximum: `9007199254740991`. |
| `from` | string (date-time) | yes | RFC 3339 time |
| `to` | string (date-time) | yes | RFC 3339 time |
| `series` | array of object | yes |  |
| `series[].labels` | object | yes |  |
| `series[].points` | array of array | yes |  |

```json title="Three-minute custom window by outcome"
{
  "metric": "transactions",
  "unit": "transactions",
  "step_seconds": 60,
  "from": "2026-11-13T02:11:00.000Z",
  "to": "2026-11-13T02:14:00.000Z",
  "series": [
    {
      "labels": {
        "outcome": "landed"
      },
      "points": [
        [
          1794535860000,
          17
        ],
        [
          1794535920000,
          21
        ],
        [
          1794535980000,
          19
        ]
      ]
    },
    {
      "labels": {
        "outcome": "failed"
      },
      "points": [
        [
          1794535860000,
          1
        ],
        [
          1794535920000,
          2
        ],
        [
          1794535980000,
          1
        ]
      ]
    },
    {
      "labels": {
        "outcome": "expired"
      },
      "points": [
        [
          1794535860000,
          2
        ],
        [
          1794535920000,
          1
        ],
        [
          1794535980000,
          1
        ]
      ]
    }
  ]
}
```

### 400

A refusal; `code` is stable

Content type: `application/problem+json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `title` | string | yes |  |
| `status` | integer | yes | minimum: `-9007199254740991`. maximum: `9007199254740991`. |
| `code` | string | yes | Stable, for programs to branch on |
| `detail` | string | yes |  |
| `request_id` | string | yes |  |
| `errors` | array of object | no |  |
| `errors[].path` | string | yes |  |
| `errors[].message` | string | yes |  |

```json title="Invalid request"
{
  "title": "Bad request",
  "status": 400,
  "code": "invalid_request",
  "detail": "The request does not match the schema.",
  "request_id": "8d4ac3b9-e451-4ca4-9a7f-b3928f0b1672"
}
```

### 401

A refusal; `code` is stable

Content type: `application/problem+json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `title` | string | yes |  |
| `status` | integer | yes | minimum: `-9007199254740991`. maximum: `9007199254740991`. |
| `code` | string | yes | Stable, for programs to branch on |
| `detail` | string | yes |  |
| `request_id` | string | yes |  |
| `errors` | array of object | no |  |
| `errors[].path` | string | yes |  |
| `errors[].message` | string | yes |  |

```json title="Unknown, revoked or expired management key"
{
  "title": "Unauthorized",
  "status": 401,
  "code": "unauthorized",
  "detail": "The management key is unknown, revoked or expired.",
  "request_id": "8d4ac3b9-e451-4ca4-9a7f-b3928f0b1672"
}
```

### 403

A refusal; `code` is stable

Content type: `application/problem+json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `title` | string | yes |  |
| `status` | integer | yes | minimum: `-9007199254740991`. maximum: `9007199254740991`. |
| `code` | string | yes | Stable, for programs to branch on |
| `detail` | string | yes |  |
| `request_id` | string | yes |  |
| `errors` | array of object | no |  |
| `errors[].path` | string | yes |  |
| `errors[].message` | string | yes |  |

```json title="IP restriction"
{
  "title": "Forbidden",
  "status": 403,
  "code": "forbidden_ip",
  "detail": "This key does not allow requests from this address.",
  "request_id": "8d4ac3b9-e451-4ca4-9a7f-b3928f0b1672"
}
```

### 404

A refusal; `code` is stable

Content type: `application/problem+json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `title` | string | yes |  |
| `status` | integer | yes | minimum: `-9007199254740991`. maximum: `9007199254740991`. |
| `code` | string | yes | Stable, for programs to branch on |
| `detail` | string | yes |  |
| `request_id` | string | yes |  |
| `errors` | array of object | no |  |
| `errors[].path` | string | yes |  |
| `errors[].message` | string | yes |  |

```json title="Unknown route"
{
  "title": "Not found",
  "status": 404,
  "code": "not_found",
  "detail": "No such route.",
  "request_id": "8d4ac3b9-e451-4ca4-9a7f-b3928f0b1672"
}
```

### 429

A refusal; `code` is stable

Content type: `application/problem+json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `title` | string | yes |  |
| `status` | integer | yes | minimum: `-9007199254740991`. maximum: `9007199254740991`. |
| `code` | string | yes | Stable, for programs to branch on |
| `detail` | string | yes |  |
| `request_id` | string | yes |  |
| `errors` | array of object | no |  |
| `errors[].path` | string | yes |  |
| `errors[].message` | string | yes |  |

```json title="Management read limit"
{
  "title": "Too many requests",
  "status": 429,
  "code": "rate_limited",
  "detail": "This key may make 600 such requests a minute.",
  "request_id": "8d4ac3b9-e451-4ca4-9a7f-b3928f0b1672"
}
```

```json title="Concurrent analytics limit"
{
  "title": "Too many requests",
  "status": 429,
  "code": "analytics_busy",
  "detail": "This team already has two analytics reads running.",
  "request_id": "8d4ac3b9-e451-4ca4-9a7f-b3928f0b1672"
}
```

## Code samples

```rust title="Rust"
// src/bin/management_metric_history.rs
use serde_json::Value;
use swqos_examples::swqos::{Result, required};

#[tokio::main]
async fn main() -> Result<()> {
    let response = reqwest::Client::new()
        .get("https://console.zerocopy.sh/api/v1/metrics/series?metric=transactions&range=24h&group_by=outcome")
        .bearer_auth(required("MANAGEMENT_API_KEY")?)
        .send()
        .await?;
    let status = response.status();
    let body = response.text().await?;
    let reply: Value = serde_json::from_str(&body)
        .map_err(|error| format!("HTTP {status}: {error}; body: {body}"))?;
    if !status.is_success() {
        return Err(format!("HTTP {status}: {reply}").into());
    }
    println!("{}", serde_json::to_string_pretty(&reply)?);
    Ok(())
}
```

```go title="Go"
// management-metric-history/main.go
package main

import (
	"encoding/json"
	"fmt"
	"log"
	"net/http"

	swqos "swqos-examples"
)

func main() {
	if err := run(); err != nil {
		log.Fatal(err)
	}
}

func run() error {
	apiKey, err := swqos.Required("MANAGEMENT_API_KEY")
	if err != nil {
		return err
	}
	request, err := http.NewRequest(http.MethodGet,
		"https://console.zerocopy.sh/api/v1/metrics/series?metric=transactions&range=24h&group_by=outcome", nil)
	if err != nil {
		return err
	}
	request.Header.Set("Authorization", "Bearer "+apiKey)
	response, err := http.DefaultClient.Do(request)
	if err != nil {
		return err
	}
	defer response.Body.Close()
	var reply any
	if err := json.NewDecoder(response.Body).Decode(&reply); err != nil {
		return fmt.Errorf("HTTP %d: %w", response.StatusCode, err)
	}
	if response.StatusCode < 200 || response.StatusCode >= 300 {
		return fmt.Errorf("HTTP %d: %v", response.StatusCode, reply)
	}
	output, err := json.MarshalIndent(reply, "", "  ")
	if err != nil {
		return err
	}
	fmt.Println(string(output))
	return nil
}
```

```ts title="TypeScript"
// management-metric-history.ts
const apiKey = process.env.MANAGEMENT_API_KEY
if (!apiKey) throw new Error('set MANAGEMENT_API_KEY')

const query = new URLSearchParams({
  metric: 'transactions',
  range: '24h',
  group_by: 'outcome',
})
const response = await fetch(
  `https://console.zerocopy.sh/api/v1/metrics/series?${query}`,
  { headers: { authorization: `Bearer ${apiKey}` } },
)
const body = await response.text()
let reply: unknown
try {
  reply = JSON.parse(body)
} catch {
  throw new Error(`HTTP ${response.status}: invalid JSON; body: ${body}`)
}
if (!response.ok) {
  throw new Error(`HTTP ${response.status}: ${JSON.stringify(reply)}`)
}
console.log(JSON.stringify(reply, null, 2))

export {}
```
