---
title: Read Single Metric Value
description: Read Single Metric Value
product: general
token_estimate: 1321
---
# Read Single Metric Value

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

## Read Single Metric Value

**GET** `/console/v1/metrics`

Full URL: `https://statsigapi.net/console/v1/metrics`

Read Single Metric Value

## Authorizations

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| STATSIG-API-KEY | string | Yes | — | apiKey (header) |

## Query parameters

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| id (query) | string | Yes | — | The unique identifier of the metric with format <metric_id>::<type> |
| date (query) | string | Yes | 2024-01-01 | Expected valid date in the form of YYYY-MM-DD |

## Response (application/json)

**200** — Get metric data on given date response

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| message | string | Yes | — | A simple string explaining the result of the operation. |
| data | object[] | Yes | — | — |
| data.value | number | Yes | — | Metric value for the given unit_type Constraints: format: double |
| data.unit_type | string | Yes | — | Unit of the metric: stableID, userID, and other custom ids |
| data.row_count | number | No | — | Row count for imported metric, optional Constraints: format: double |
| data.numerator | number | No | — | Numerator of a ratio metric, optional Constraints: format: double |
| data.denominator | number | No | — | Denominator of a ratio metric, optional Constraints: format: double |
| pagination | object | Yes | — | Pagination metadata for checking if there is next page for example. |
| pagination.itemsPerPage | number | Yes | — | Constraints: format: double |
| pagination.pageNumber | number | Yes | — | Constraints: format: double |
| pagination.nextPage | string | Yes | — | Constraints: nullable |
| pagination.previousPage | string | Yes | — | Constraints: nullable |
| pagination.totalItems | number | No | — | Constraints: format: double |
| pagination.all | string | No | — | — |

```json
{
  "message": "Metric read successfully.",
  "data": [
    {
      "value": 0,
      "unit_type": "overall",
      "numerator": null,
      "denominator": null,
      "metric_name": "TestMetricCapi",
      "metric_type": "sum"
    },
    {
      "value": 0,
      "unit_type": "userID",
      "numerator": null,
      "denominator": null,
      "metric_name": "TestMetricCapi",
      "metric_type": "sum"
    }
  ]
}
```

**401** — This endpoint only accepts an active CONSOLE key, but an invalid key was sent. Key: console-xxxXXXxxxXXXxxx

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| status | integer | Yes | — | Allowed values: 401 |
| message | string | Yes | — | — |

```json
{
  "status": 401,
  "message": "This endpoint only accepts an active CONSOLE key, but an invalid key was sent. Key: console-xxxXXXxxxXXXxxx"
}
```

## Code samples

### cURL

```bash
curl -X GET "https://statsigapi.net/console/v1/metrics?date=2024-01-01" \
  -H "Content-Type: application/json" \
  -H "STATSIG-API-KEY: YOUR_API_KEY"
```

### Python

```python
import requests

response = requests.get(
    "https://statsigapi.net/console/v1/metrics?date=2024-01-01",
    headers={
        "Content-Type": "application/json",
        "STATSIG-API-KEY": "YOUR_API_KEY"
    }
)
data = response.json()
```

### JavaScript

```javascript
const response = await fetch("https://statsigapi.net/console/v1/metrics?date=2024-01-01", {
  method: "GET",
  headers: {
    "Content-Type": "application/json",
    "STATSIG-API-KEY": "YOUR_API_KEY"
  }
});
const data = await response.json();
```

### PHP

```php
<?php
$ch = curl_init("https://statsigapi.net/console/v1/metrics?date=2024-01-01");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Content-Type: application/json",
    "STATSIG-API-KEY: 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("GET", "https://statsigapi.net/console/v1/metrics?date=2024-01-01", nil)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("STATSIG-API-KEY", "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://statsigapi.net/console/v1/metrics?date=2024-01-01"))
      .method("GET", HttpRequest.BodyPublishers.noBody())
.header("Content-Type", "application/json")
      .header("STATSIG-API-KEY", "YOUR_API_KEY")
      .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
```

### Ruby

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

uri = URI("https://statsigapi.net/console/v1/metrics?date=2024-01-01")
request = Net::HTTP::Get.new(uri)
request["Content-Type"] = "application/json"
request["STATSIG-API-KEY"] = "YOUR_API_KEY"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
  http.request(request)
end
```

