---
title: "Retrieve branch metrics"
method: POST
path: "/organizations/{organizationID}/projects/{projectID}/branches/{branchID}/metrics"
tags: ["Branches", "Metrics"]
---

# Retrieve branch metrics

`POST /organizations/{organizationID}/projects/{projectID}/branches/{branchID}/metrics`

Returns time-series data for one or more metrics of a branch.

## Path parameters

- `organizationID` string, required
- `projectID` string, required
- `branchID` string, required

## Request body

- BranchMetricsRequest
  - `start` string, date-time, required — Start time
  - `end` string, date-time, required — End time
  - `metrics` BranchMetricName[], required — List of metric names to query.
  - `instances` string[] — List of instance IDs to query
  - `aggregations` string[], required — List of aggregations to get, this is how the data-points within the interval are aggregated. Each one will generate a separate time-series per metric in the response.

## Response `200`

Metrics for a branch

- BranchMetrics — A collection of metrics (cpu, memory, disk,...) for each of the instances of a branch
  - `start` string, date-time, required
  - `end` string, date-time, required
  - `results` BranchMetricResult[], required — One entry per requested metric, in the order the metrics were requested.
    - `metric` string, required — Name of the queried metric.
    - `unit` string, required — Unit of the metric (percentage, bytes, ms, etc.)
    - `series` MetricSeries[], required
      - `instanceID` string, required — ID of the instance
      - `aggregation` 'avg' | 'max' | 'min', required — The aggregation used to generate this time-series
      - `values` object[], required
        - `timestamp` string, date-time, required
        - `value` number, required

## Other responses

- `400` — Generic error response for most error conditions
- `401` — Error response when authentication or authorization fails
- `404` — Generic error response for most error conditions
- `5XX` — Unexpected Error
- `default` — Unexpected Error

---

[API](https://skmtc.net/xataio/apis/xata-api.md) · [All operations](https://skmtc.net/xataio/apis/xata-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/xataio/xata-api/versions/bbeb83bf32d6/schema)
