> For the complete documentation index, see [llms.txt](https://docs.concurrence.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.concurrence.com/developer-guide/platform-api/safety/metric-store.md).

# Metric Store

Trigger Metric Store setup, refresh, and poll run status through the Platform API.

The Metric Store endpoints let workspace administrators trigger schema setup, on-demand data refresh, and poll the status of those operations.

All endpoints are scoped to a workspace and require an authenticated API key with the appropriate role.

## Base Path

```
/v1/{workspace_id}/metric-store
```

## Endpoints

### Trigger Setup

```
POST /v1/{workspace_id}/metric-store/setup
```

Triggers the one-time Metric Store schema and registry initialization. This operation is idempotent.

**Required permission:** `workspace.update`

**Rate limit:** Write rate limit applies.

**Response:** `202 Accepted`

| Field    | Type    | Description                                                |
| -------- | ------- | ---------------------------------------------------------- |
| `run_id` | integer | Identifier for the triggered run. Use this to poll status. |

**Error responses:**

| Status                    | Condition                                                            |
| ------------------------- | -------------------------------------------------------------------- |
| `503 Service Unavailable` | The setup job is not configured for this environment.                |
| `502 Bad Gateway`         | The request to trigger the job failed or returned no run identifier. |

***

### Trigger Refresh

```
POST /v1/{workspace_id}/metric-store/refresh
```

Triggers an on-demand refresh of the canonical Metric Store models.

**Required permission:** `workspace.update`

**Rate limit:** Write rate limit applies.

**Response:** `202 Accepted`

| Field    | Type    | Description                                                |
| -------- | ------- | ---------------------------------------------------------- |
| `run_id` | integer | Identifier for the triggered run. Use this to poll status. |

**Error responses:**

| Status                    | Condition                                                            |
| ------------------------- | -------------------------------------------------------------------- |
| `503 Service Unavailable` | The refresh job is not configured for this environment.              |
| `502 Bad Gateway`         | The request to trigger the job failed or returned no run identifier. |

***

### Get Run Status

```
GET /v1/{workspace_id}/metric-store/runs/{run_id}
```

Returns the current status of a Metric Store setup or refresh run.

**Required permission:** `workspace.view`

**Response:** `200 OK`

| Field              | Type           | Description                                                                                                   |
| ------------------ | -------------- | ------------------------------------------------------------------------------------------------------------- |
| `run_id`           | integer        | The run identifier.                                                                                           |
| `life_cycle_state` | string or null | Current lifecycle state of the run (e.g., `PENDING`, `RUNNING`, `TERMINATED`).                                |
| `result_state`     | string or null | Final result state when the run has completed (e.g., `SUCCESS`, `FAILED`). Null while the run is in progress. |
| `state_message`    | string or null | Human-readable message describing the current state.                                                          |

**Error responses:**

| Status            | Condition                                                 |
| ----------------- | --------------------------------------------------------- |
| `404 Not Found`   | The run identifier does not belong to a Metric Store job. |
| `502 Bad Gateway` | The status check failed.                                  |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.concurrence.com/developer-guide/platform-api/safety/metric-store.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
