---
title: "Assert Metrics for a Metric Block"
method: POST
path: "/extensions/roboledger/{graph_id}/operations/assert-metrics"
tags: ["RoboLedger: Information Blocks"]
---

# Assert Metrics for a Metric Block

`POST /extensions/roboledger/{graph_id}/operations/assert-metrics`

## Request

- Base URL: `https://api.robosystems.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.robosystems.ai/extensions/roboledger/{graph_id}/operations/assert-metrics`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer

Writes externally-observed metric values (usage counts, marketing numbers, hand-carried figures) into the period's standing factset_type='metric' FactSet with AssertedProvenance — the observation sibling of compute-metrics. One standing FactSet per (structure, entity, period_end); re-asserting a period replaces its facts. Structures carrying Derive rules are compute-owned and rejected: asserted and derived metric series keep disjoint structures. Observations must resolve to concepts on the structure's presentation catalog. Deterministic and non-AI — no credits consumed.

**Idempotency**: supply an `Idempotency-Key` header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.

## Path parameters

- `graph_id` string, required

## Headers

- `Idempotency-Key` string, nullable

## Request body

- AssertMetricsRequest: Request body for the `assert-metrics` operation. The observation sibling of `compute-metrics`: writes externally- observed values (usage counts, marketing numbers, hand-carried figures) into the period's standing `factset_type='metric'` FactSet with `AssertedProvenance`. Re-asserting a period replaces its facts — one standing FactSet per (structure, entity, period_end), the accumulating time series. Structures carrying `Derive` rules are compute-owned (`compute-metrics`) and rejected — asserted and derived metric series keep disjoint structures. Asserted series are actuals; there is no scenario axis.
  - `structure_id` string, required: Metric block structure (block_type='metric') to assert into.
  - `period_end` string, date, required: Period end the observations are for — instant concepts (a follower count at month end) land as of this date; duration concepts (monthly downloads) end on it.
  - `period_start` string, date, nullable: Window start for duration concepts and the standing FactSet's period_start. Instant concepts ignore it.
  - `entity_id` string, nullable: The entity the asserted values belong to, by id. Omit for the group parent.
  - `source_system` string, required: Identifier of the asserting system (e.g. 'content-machine') — recorded as the AssertedProvenance source_system.
  - `basis_note` string, nullable: Free-text basis / source reference for the observations.
  - `observations` MetricObservation[], required: Observed values, one per metric concept — duplicates rejected.
    - `qname` string, required: Metric element qname (e.g. rsx:GithubStars). Must resolve to a concept on the structure's presentation catalog.
    - `value` number, required: Observed value.

## Response `200`

Successful Response

- OperationEnvelopeAssertMetricsResponse
  - `operation` string, required: Kebab-case operation name
  - `operationId` string, required: op_-prefixed ULID for audit and SSE correlation
  - `status` 'completed' | 'pending' | 'failed', required: Operation lifecycle state
  - `result` AssertMetricsResponse: Response for the `assert-metrics` operation.
    - `structure_id` string, required
    - `entity_id` string, required
    - `period_end` string, date, required
    - `fact_set_id` string, required: Standing metric FactSet the observations were written to.
    - `asserted` AssertedMetricLite[]
      - `element_id` string, required: Metric element the fact was written for.
      - `element_qname` string, required: Metric element qname.
      - `name` string, required: Metric display name.
      - `value` number, required: Asserted value.
      - `unit` string, required: Fact unit — 'USD' for monetary, 'days' for days, else 'pure'.
      - `period_type` string, required: 'instant' or 'duration'.
      - `item_type` string, nullable: Format family from the metric element (monetary | ratio | percent | multiple | days). None means untyped; fall back to unit.
    - `replaced` boolean: True when a prior standing set existed for the period and its facts were replaced.
  - `at` string, required: ISO-8601 UTC timestamp
  - `createdBy` string, nullable: User ID that initiated the operation
  - `idempotentReplay` boolean: True when this envelope came from the idempotency cache — the underlying command did not execute again. False on fresh executions.

## Other responses

- `400`: Invalid request
- `401`: Authentication required
- `403`: Access denied
- `404`: Resource not found
- `409`: Idempotency-Key conflict — key reused with different body
- `422`: Validation error
- `429`: Rate limit exceeded
- `500`: Internal server error

---

[API](https://skmtc.dev/robosystems/apis/robosystems-api.md) · [All operations](https://skmtc.dev/robosystems/apis/robosystems-api/llms.txt) · [OpenAPI document](https://skmtc.dev/robosystems/apis/robosystems-api/revisions/e661e2d5ca6a?raw)
