Metrics API
Metrics budgets (create, update, delete, status) and commitment/consumption readouts.
17 routes
Response metadata: x-api-version, x-request-id, and traceresponse apply to normal routed responses and are omitted from the per-operation header tables below.
GET/api/metrics/budgets
request access
List all defined budgets.
Request-tier read.
Permissions
| Access class | Credential | Scoping |
|---|---|---|
request | An authenticated session or API bearer token is required. | The access class is enforced first; site and environment scopes narrow resources on scoped operations. |
HTTP request
GET https://<your-host>/api/metrics/budgets
Path parameters
This operation has no path parameters.
Query parameters
| Name | Type | Requirement | Description |
|---|---|---|---|
limit | integer | Optional | Maximum number of results requested. |
offset | integer | Optional | Number of results to skip before returning the page. |
Request headers
| Name | Type | Requirement | Description |
|---|---|---|---|
Authorization | string | Optional | Human credential alternative: supply one Bearer rys_... session token, ryk_... API token, or validated identity-provider JWT here. Do not combine it with X-Ryuki-Session-Id or the session cookie; conflicting carriers fail closed. |
X-Ryuki-Session-Id | string | Optional | Opaque rys_... session-token carrier used by the portal for mutations. Administrative session UUIDs cannot authenticate. Supply exactly one credential carrier per request. |
traceparent | string | Optional | Optional correlation input. When the second dash-separated segment has 32 characters, Ryuki reuses it as the request correlation identifier; this is not full W3C validation. |
Request body
This operation does not accept a request body.
Response
| Status | Description | Body |
|---|---|---|
200 | OK | Value |
200 response body
Structure: Value.
| Name | Type | Requirement | Description |
|---|---|---|---|
budgets | JSON value | Required | Value of budgets returned in the response body. |
durable | boolean | Required | Value of durable returned in the response body. |
total | JSON value | Required | Total number of matching items before the returned page is applied. |
limit | JSON value | Required | Page-size limit applied to this response. |
offset | JSON value | Required | Number of matching items skipped before this response page. |
Returns a paginated JSON object with total/limit/offset keys.
Errors
JSON failures use one of the platform error envelopes and include the request correlation metadata when routing reaches the API middleware. See Errors for the exact shapes, authentication failures, retry guidance, and transport-level exceptions.
Examples
Request
curl --silent --show-error --globoff \
--request GET \
--header 'Authorization: Bearer <token>' \
'https://<your-host>/api/metrics/budgets'
Schematic response body
Illustrative shape generated from the extracted field types, not a recorded live response. Values are placeholders; null marks a field whose type could not be resolved.
Success status: 200
{
"budgets": null,
"durable": false,
"total": null,
"limit": null,
"offset": null
}
POST/api/metrics/budgets
execute access
Define a budget threshold on a metric.
Execute-tier. 503 when no database is configured.
Permissions
| Access class | Credential | Scoping |
|---|---|---|
execute | An authenticated session or API bearer token is required. | The access class is enforced first; site and environment scopes narrow resources on scoped operations. |
HTTP request
POST https://<your-host>/api/metrics/budgets
Path parameters
This operation has no path parameters.
Query parameters
This operation has no query parameters.
Request headers
| Name | Type | Requirement | Description |
|---|---|---|---|
Authorization | string | Optional | Human credential alternative: supply one Bearer rys_... session token, ryk_... API token, or validated identity-provider JWT here. Do not combine it with X-Ryuki-Session-Id or the session cookie; conflicting carriers fail closed. |
Content-Type | string | Required | Required by the resolved Axum Json<T> request extractor; send application/json. |
X-Ryuki-Session-Id | string | Optional | Opaque rys_... session-token carrier used by the portal for mutations. Administrative session UUIDs cannot authenticate. Supply exactly one credential carrier per request. |
Idempotency-Key | string | Optional | Optional at-most-once retry key for human mutations. When omitted, the idempotency middleware passes the request through without deduplication. |
traceparent | string | Optional | Optional correlation input. When the second dash-separated segment has 32 characters, Ryuki reuses it as the request correlation identifier; this is not full W3C validation. |
Request body
JSON structure: MetricBudgetCreateRequest.
| Name | Type | Requirement | Description |
|---|---|---|---|
metric_key | string | Required | Value of metric_key in the JSON request body. |
site | string | Optional | Site code targeted by the request. |
environment | string | Optional | Environment targeted by the request. |
threshold | number | Required | Value of threshold in the JSON request body. |
comparison | string | Optional | "above" (cost/usage cap, default) or "below" (capacity floor). |
Response
| Status | Description | Body |
|---|---|---|
200 | OK | Value |
200 response body
Structure: Value.
| Name | Type | Requirement | Description |
|---|---|---|---|
id | JSON value | Required | Identifier of the returned resource. |
created | boolean | Required | Value of created returned in the response body. |
Errors
JSON failures use one of the platform error envelopes and include the request correlation metadata when routing reaches the API middleware. See Errors for the exact shapes, authentication failures, retry guidance, and transport-level exceptions.
Examples
Request
curl --silent --show-error --globoff \
--request POST \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '{"metric_key":"<string>","threshold":0.0}' \
'https://<your-host>/api/metrics/budgets'
Schematic response body
Illustrative shape generated from the extracted field types, not a recorded live response. Values are placeholders; null marks a field whose type could not be resolved.
Success status: 200
{
"id": null,
"created": false
}
GET/api/metrics/budgets/status
request access
Evaluate every ENABLED budget against its metric series, reporting current and projected breaches.
Request-tier read. 503 when no database is configured.
Permissions
| Access class | Credential | Scoping |
|---|---|---|
request | An authenticated session or API bearer token is required. | The access class is enforced first; site and environment scopes narrow resources on scoped operations. |
HTTP request
GET https://<your-host>/api/metrics/budgets/status
Path parameters
This operation has no path parameters.
Query parameters
This operation has no query parameters.
Request headers
| Name | Type | Requirement | Description |
|---|---|---|---|
Authorization | string | Optional | Human credential alternative: supply one Bearer rys_... session token, ryk_... API token, or validated identity-provider JWT here. Do not combine it with X-Ryuki-Session-Id or the session cookie; conflicting carriers fail closed. |
X-Ryuki-Session-Id | string | Optional | Opaque rys_... session-token carrier used by the portal for mutations. Administrative session UUIDs cannot authenticate. Supply exactly one credential carrier per request. |
traceparent | string | Optional | Optional correlation input. When the second dash-separated segment has 32 characters, Ryuki reuses it as the request correlation identifier; this is not full W3C validation. |
Request body
This operation does not accept a request body.
Response
| Status | Description | Body |
|---|---|---|
200 | OK | Value |
200 response body
Structure: Value.
| Name | Type | Requirement | Description |
|---|---|---|---|
budgets | JSON value | Required | Value of budgets returned in the response body. |
breached_count | JSON value | Required | Value of breached_count returned in the response body. |
errored_count | JSON value | Required | Value of errored_count returned in the response body. |
overall_status | JSON value | Required | Value of overall_status returned in the response body. |
Errors
JSON failures use one of the platform error envelopes and include the request correlation metadata when routing reaches the API middleware. See Errors for the exact shapes, authentication failures, retry guidance, and transport-level exceptions.
Examples
Request
curl --silent --show-error --globoff \
--request GET \
--header 'Authorization: Bearer <token>' \
'https://<your-host>/api/metrics/budgets/status'
Schematic response body
Illustrative shape generated from the extracted field types, not a recorded live response. Values are placeholders; null marks a field whose type could not be resolved.
Success status: 200
{
"budgets": null,
"breached_count": null,
"errored_count": null,
"overall_status": null
}
DELETE/api/metrics/budgets/{id}
execute access
Remove a budget definition (swarm #19, CRUD completion).
Execute-tier (same as create). 404 if absent; 503 no DB.
Permissions
| Access class | Credential | Scoping |
|---|---|---|
execute | An authenticated session or API bearer token is required. | The access class is enforced first; site and environment scopes narrow resources on scoped operations. |
HTTP request
DELETE https://<your-host>/api/metrics/budgets/{id}
Path parameters
| Name | Type | Requirement | Description |
|---|---|---|---|
id | string | Required | Identifier of the target resource in the request path. |
Query parameters
This operation has no query parameters.
Request headers
| Name | Type | Requirement | Description |
|---|---|---|---|
Authorization | string | Optional | Human credential alternative: supply one Bearer rys_... session token, ryk_... API token, or validated identity-provider JWT here. Do not combine it with X-Ryuki-Session-Id or the session cookie; conflicting carriers fail closed. |
X-Ryuki-Session-Id | string | Optional | Opaque rys_... session-token carrier used by the portal for mutations. Administrative session UUIDs cannot authenticate. Supply exactly one credential carrier per request. |
Idempotency-Key | string | Optional | Optional at-most-once retry key for human mutations. When omitted, the idempotency middleware passes the request through without deduplication. |
traceparent | string | Optional | Optional correlation input. When the second dash-separated segment has 32 characters, Ryuki reuses it as the request correlation identifier; this is not full W3C validation. |
Request body
This operation does not accept a request body.
Response
| Status | Description | Body |
|---|---|---|
200 | OK | Value |
200 response body
Structure: Value.
| Name | Type | Requirement | Description |
|---|---|---|---|
deleted | JSON value | Required | Value of deleted returned in the response body. |
Errors
JSON failures use one of the platform error envelopes and include the request correlation metadata when routing reaches the API middleware. See Errors for the exact shapes, authentication failures, retry guidance, and transport-level exceptions.
Examples
Request
curl --silent --show-error --globoff \
--request DELETE \
--header 'Authorization: Bearer <token>' \
--header 'Idempotency-Key: <idempotency-key>' \
'https://<your-host>/api/metrics/budgets/<id>'
Schematic response body
Illustrative shape generated from the extracted field types, not a recorded live response. Values are placeholders; null marks a field whose type could not be resolved.
Success status: 200
{
"deleted": null
}
PUT/api/metrics/budgets/{id}
execute access
Update a budget's mutable fields (threshold, comparison, enabled); omitted fields are left unchanged (PATCH semantics, swarm #19).
Execute-tier (same as create/delete). 404 if absent; 503 no DB. The identity/scope fields are immutable here — recreate to re-scope.
Permissions
| Access class | Credential | Scoping |
|---|---|---|
execute | An authenticated session or API bearer token is required. | The access class is enforced first; site and environment scopes narrow resources on scoped operations. |
HTTP request
PUT https://<your-host>/api/metrics/budgets/{id}
Path parameters
| Name | Type | Requirement | Description |
|---|---|---|---|
id | string | Required | Identifier of the target resource in the request path. |
Query parameters
This operation has no query parameters.
Request headers
| Name | Type | Requirement | Description |
|---|---|---|---|
Authorization | string | Optional | Human credential alternative: supply one Bearer rys_... session token, ryk_... API token, or validated identity-provider JWT here. Do not combine it with X-Ryuki-Session-Id or the session cookie; conflicting carriers fail closed. |
Content-Type | string | Required | Required by the resolved Axum Json<T> request extractor; send application/json. |
X-Ryuki-Session-Id | string | Optional | Opaque rys_... session-token carrier used by the portal for mutations. Administrative session UUIDs cannot authenticate. Supply exactly one credential carrier per request. |
Idempotency-Key | string | Optional | Optional at-most-once retry key for human mutations. When omitted, the idempotency middleware passes the request through without deduplication. |
traceparent | string | Optional | Optional correlation input. When the second dash-separated segment has 32 characters, Ryuki reuses it as the request correlation identifier; this is not full W3C validation. |
Request body
JSON structure: MetricBudgetUpdateRequest.
| Name | Type | Requirement | Description |
|---|---|---|---|
threshold | number | Optional | Value of threshold in the JSON request body. |
comparison | string | Optional | Value of comparison in the JSON request body. |
enabled | boolean | Optional | Whether the requested capability should be enabled. |
Response
| Status | Description | Body |
|---|---|---|
200 | OK | Value |
200 response body
Structure: Value.
| Name | Type | Requirement | Description |
|---|---|---|---|
updated | JSON value | Required | Value of updated returned in the response body. |
Errors
JSON failures use one of the platform error envelopes and include the request correlation metadata when routing reaches the API middleware. See Errors for the exact shapes, authentication failures, retry guidance, and transport-level exceptions.
Examples
Request
curl --silent --show-error --globoff \
--request PUT \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '{}' \
'https://<your-host>/api/metrics/budgets/<id>'
Schematic response body
Illustrative shape generated from the extracted field types, not a recorded live response. Values are placeholders; null marks a field whose type could not be resolved.
Success status: 200
{
"updated": null
}
GET/api/metrics/commitment
request access
Model the cost of a reserved/committed capacity level vs pure on-demand for a metric.
metric_key, on_demand_rate, commitment_rate, and committed_units are required; usage defaults to the metric's mean. Request-tier read. 503 when no database is configured.
Permissions
| Access class | Credential | Scoping |
|---|---|---|
request | An authenticated session or API bearer token is required. | The access class is enforced first; site and environment scopes narrow resources on scoped operations. |
HTTP request
GET https://<your-host>/api/metrics/commitment
Path parameters
This operation has no path parameters.
Query parameters
| Name | Type | Requirement | Description |
|---|---|---|---|
metric_key | string | Optional | Value supplied for the metric_key query parameter. |
site | string | Optional | Site identifier used to scope or filter the operation. |
environment | string | Optional | Environment identifier used to scope or filter the operation. |
on_demand_rate | number | Optional | Value supplied for the on_demand_rate query parameter. |
commitment_rate | number | Optional | Value supplied for the commitment_rate query parameter. |
committed_units | number | Optional | Value supplied for the committed_units query parameter. |
usage | number | Optional | Optional usage override; when absent, the series mean is used. |
Request headers
| Name | Type | Requirement | Description |
|---|---|---|---|
Authorization | string | Optional | Human credential alternative: supply one Bearer rys_... session token, ryk_... API token, or validated identity-provider JWT here. Do not combine it with X-Ryuki-Session-Id or the session cookie; conflicting carriers fail closed. |
X-Ryuki-Session-Id | string | Optional | Opaque rys_... session-token carrier used by the portal for mutations. Administrative session UUIDs cannot authenticate. Supply exactly one credential carrier per request. |
traceparent | string | Optional | Optional correlation input. When the second dash-separated segment has 32 characters, Ryuki reuses it as the request correlation identifier; this is not full W3C validation. |
Request body
This operation does not accept a request body.
Response
| Status | Description | Body |
|---|---|---|
200 | OK | Value |
200 response body
Structure: Value.
| Name | Type | Requirement | Description |
|---|---|---|---|
metric_key | JSON value | Required | Value of metric_key returned in the response body. |
site | JSON value | Required | Value of site returned in the response body. |
environment | JSON value | Required | Value of environment returned in the response body. |
usage_source | JSON value | Required | Value of usage_source returned in the response body. |
model | JSON value | Required | Value of model returned in the response body. |
Errors
JSON failures use one of the platform error envelopes and include the request correlation metadata when routing reaches the API middleware. See Errors for the exact shapes, authentication failures, retry guidance, and transport-level exceptions.
Examples
Request
curl --silent --show-error --globoff \
--request GET \
--header 'Authorization: Bearer <token>' \
'https://<your-host>/api/metrics/commitment'
Schematic response body
Illustrative shape generated from the extracted field types, not a recorded live response. Values are placeholders; null marks a field whose type could not be resolved.
Success status: 200
{
"metric_key": null,
"site": null,
"environment": null,
"usage_source": null,
"model": null
}
GET/api/metrics/insights
request access
Anomaly + waste detection over one metric series (pure ryuki_engine::metric_anomaly).
metric_key is required; site/ environment scope the (single, coherent) series; z is the anomaly z-threshold; waste_threshold/waste_fraction configure waste detection. Request-tier read. 503 when no database is configured; 500 on a query error (never a falsely-empty result).
Permissions
| Access class | Credential | Scoping |
|---|---|---|
request | An authenticated session or API bearer token is required. | The access class is enforced first; site and environment scopes narrow resources on scoped operations. |
HTTP request
GET https://<your-host>/api/metrics/insights
Path parameters
This operation has no path parameters.
Query parameters
| Name | Type | Requirement | Description |
|---|---|---|---|
metric_key | string | Optional | Value supplied for the metric_key query parameter. |
site | string | Optional | Site identifier used to scope or filter the operation. |
environment | string | Optional | Environment identifier used to scope or filter the operation. |
z | number | Optional | Anomaly z-score threshold (default 3.0). |
waste_threshold | number | Optional | Waste threshold: samples at or below this count toward waste (default 10.0). |
waste_fraction | number | Optional | Fraction of samples at/below the threshold to flag waste (default 0.8). |
Request headers
| Name | Type | Requirement | Description |
|---|---|---|---|
Authorization | string | Optional | Human credential alternative: supply one Bearer rys_... session token, ryk_... API token, or validated identity-provider JWT here. Do not combine it with X-Ryuki-Session-Id or the session cookie; conflicting carriers fail closed. |
X-Ryuki-Session-Id | string | Optional | Opaque rys_... session-token carrier used by the portal for mutations. Administrative session UUIDs cannot authenticate. Supply exactly one credential carrier per request. |
traceparent | string | Optional | Optional correlation input. When the second dash-separated segment has 32 characters, Ryuki reuses it as the request correlation identifier; this is not full W3C validation. |
Request body
This operation does not accept a request body.
Response
| Status | Description | Body |
|---|---|---|
200 | OK | Value |
200 response body
Structure: Value.
| Name | Type | Requirement | Description |
|---|---|---|---|
metric_key | JSON value | Required | Value of metric_key returned in the response body. |
site | JSON value | Required | Value of site returned in the response body. |
environment | JSON value | Required | Value of environment returned in the response body. |
sample_count | JSON value | Required | Value of sample_count returned in the response body. |
summary | JSON value | Required | Value of summary returned in the response body. |
anomalies | JSON value | Required | Value of anomalies returned in the response body. |
waste | JSON value | Required | Value of waste returned in the response body. |
Errors
JSON failures use one of the platform error envelopes and include the request correlation metadata when routing reaches the API middleware. See Errors for the exact shapes, authentication failures, retry guidance, and transport-level exceptions.
Examples
Request
curl --silent --show-error --globoff \
--request GET \
--header 'Authorization: Bearer <token>' \
'https://<your-host>/api/metrics/insights'
Schematic response body
Illustrative shape generated from the extracted field types, not a recorded live response. Values are placeholders; null marks a field whose type could not be resolved.
Success status: 200
{
"metric_key": null,
"site": null,
"environment": null,
"sample_count": null,
"summary": null,
"anomalies": null,
"waste": null
}
POST/api/metrics/insights/generate
execute access
Run detection over a metric series and PERSIST the resulting suggestions into aiops_suggestions (the existing suggestion surface).
Execute-tier (it writes). Each suggestion is deduped: it is skipped when an OPEN (New/Reviewed) suggestion with the same site+title already exists, so repeated calls do not pile up duplicates. Returns the suggestions that were newly persisted. 503 when no database is configured.
Permissions
| Access class | Credential | Scoping |
|---|---|---|
execute | An authenticated session or API bearer token is required. | The access class is enforced first; site and environment scopes narrow resources on scoped operations. |
HTTP request
POST https://<your-host>/api/metrics/insights/generate
Path parameters
This operation has no path parameters.
Query parameters
| Name | Type | Requirement | Description |
|---|---|---|---|
metric_key | string | Optional | Value supplied for the metric_key query parameter. |
site | string | Optional | Site identifier used to scope or filter the operation. |
environment | string | Optional | Environment identifier used to scope or filter the operation. |
z | number | Optional | Anomaly z-score threshold (default 3.0). |
waste_threshold | number | Optional | Waste threshold: samples at or below this count toward waste (default 10.0). |
waste_fraction | number | Optional | Fraction of samples at/below the threshold to flag waste (default 0.8). |
Request headers
| Name | Type | Requirement | Description |
|---|---|---|---|
Authorization | string | Optional | Human credential alternative: supply one Bearer rys_... session token, ryk_... API token, or validated identity-provider JWT here. Do not combine it with X-Ryuki-Session-Id or the session cookie; conflicting carriers fail closed. |
X-Ryuki-Session-Id | string | Optional | Opaque rys_... session-token carrier used by the portal for mutations. Administrative session UUIDs cannot authenticate. Supply exactly one credential carrier per request. |
Idempotency-Key | string | Optional | Optional at-most-once retry key for human mutations. When omitted, the idempotency middleware passes the request through without deduplication. |
traceparent | string | Optional | Optional correlation input. When the second dash-separated segment has 32 characters, Ryuki reuses it as the request correlation identifier; this is not full W3C validation. |
Request body
This operation does not accept a request body.
Response
| Status | Description | Body |
|---|---|---|
200 | OK | Value |
200 response body
Structure: Value.
| Name | Type | Requirement | Description |
|---|---|---|---|
metric_key | JSON value | Required | Value of metric_key returned in the response body. |
site | JSON value | Required | Value of site returned in the response body. |
generated | JSON value | Required | Value of generated returned in the response body. |
persisted | JSON value | Required | Value of persisted returned in the response body. |
suggestions | JSON value | Required | Value of suggestions returned in the response body. |
Errors
JSON failures use one of the platform error envelopes and include the request correlation metadata when routing reaches the API middleware. See Errors for the exact shapes, authentication failures, retry guidance, and transport-level exceptions.
Examples
Request
curl --silent --show-error --globoff \
--request POST \
--header 'Authorization: Bearer <token>' \
--header 'Idempotency-Key: <idempotency-key>' \
'https://<your-host>/api/metrics/insights/generate'
Schematic response body
Illustrative shape generated from the extracted field types, not a recorded live response. Values are placeholders; null marks a field whose type could not be resolved.
Success status: 200
{
"metric_key": null,
"site": null,
"generated": null,
"persisted": null,
"suggestions": null
}
POST/api/metrics/samples
execute access
Record one time-series metric sample.
Execute-tier (operators/collectors push samples). 503 when no database is configured.
Permissions
| Access class | Credential | Scoping |
|---|---|---|
execute | An authenticated session or API bearer token is required. | The access class is enforced first; site and environment scopes narrow resources on scoped operations. |
HTTP request
POST https://<your-host>/api/metrics/samples
Path parameters
This operation has no path parameters.
Query parameters
This operation has no query parameters.
Request headers
| Name | Type | Requirement | Description |
|---|---|---|---|
Authorization | string | Optional | Human credential alternative: supply one Bearer rys_... session token, ryk_... API token, or validated identity-provider JWT here. Do not combine it with X-Ryuki-Session-Id or the session cookie; conflicting carriers fail closed. |
Content-Type | string | Required | Required by the resolved Axum Json<T> request extractor; send application/json. |
X-Ryuki-Session-Id | string | Optional | Opaque rys_... session-token carrier used by the portal for mutations. Administrative session UUIDs cannot authenticate. Supply exactly one credential carrier per request. |
Idempotency-Key | string | Optional | Optional at-most-once retry key for human mutations. When omitted, the idempotency middleware passes the request through without deduplication. |
traceparent | string | Optional | Optional correlation input. When the second dash-separated segment has 32 characters, Ryuki reuses it as the request correlation identifier; this is not full W3C validation. |
Request body
JSON structure: MetricSampleRequest.
| Name | Type | Requirement | Description |
|---|---|---|---|
metric_key | string | Required | Value of metric_key in the JSON request body. |
site | string | Optional | Site code targeted by the request. |
environment | string | Optional | Environment targeted by the request. |
value | number | Required | Value of value in the JSON request body. |
observed_at | string | Optional | Value of observed_at in the JSON request body. |
Response
| Status | Description | Body |
|---|---|---|
200 | OK | Value |
200 response body
Structure: Value.
| Name | Type | Requirement | Description |
|---|---|---|---|
id | JSON value | Required | Identifier of the returned resource. |
recorded | boolean | Required | Value of recorded returned in the response body. |
Errors
JSON failures use one of the platform error envelopes and include the request correlation metadata when routing reaches the API middleware. See Errors for the exact shapes, authentication failures, retry guidance, and transport-level exceptions.
Examples
Request
curl --silent --show-error --globoff \
--request POST \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '{"metric_key":"<string>","value":0.0}' \
'https://<your-host>/api/metrics/samples'
Schematic response body
Illustrative shape generated from the extracted field types, not a recorded live response. Values are placeholders; null marks a field whose type could not be resolved.
Success status: 200
{
"id": null,
"recorded": false
}
GET/api/metrics/series
request access
Return one metric's ordered series plus a summary, trend, and a linear forecast (pure ryuki_engine::metric_forecast).
metric_key is required; site/environment narrow the scope; horizon (default 3, capped 100) is the number of points to project. Request-tier read (metrics are non-sensitive aggregates). 503 when no database is configured.
Permissions
| Access class | Credential | Scoping |
|---|---|---|
request | An authenticated session or API bearer token is required. | The access class is enforced first; site and environment scopes narrow resources on scoped operations. |
HTTP request
GET https://<your-host>/api/metrics/series
Path parameters
This operation has no path parameters.
Query parameters
| Name | Type | Requirement | Description |
|---|---|---|---|
metric_key | string | Optional | Value supplied for the metric_key query parameter. |
site | string | Optional | Site identifier used to scope or filter the operation. |
environment | string | Optional | Environment identifier used to scope or filter the operation. |
horizon | integer | Optional | Value supplied for the horizon query parameter. |
Request headers
| Name | Type | Requirement | Description |
|---|---|---|---|
Authorization | string | Optional | Human credential alternative: supply one Bearer rys_... session token, ryk_... API token, or validated identity-provider JWT here. Do not combine it with X-Ryuki-Session-Id or the session cookie; conflicting carriers fail closed. |
X-Ryuki-Session-Id | string | Optional | Opaque rys_... session-token carrier used by the portal for mutations. Administrative session UUIDs cannot authenticate. Supply exactly one credential carrier per request. |
traceparent | string | Optional | Optional correlation input. When the second dash-separated segment has 32 characters, Ryuki reuses it as the request correlation identifier; this is not full W3C validation. |
Request body
This operation does not accept a request body.
Response
| Status | Description | Body |
|---|---|---|
200 | OK | Value |
200 response body
Structure: Value.
| Name | Type | Requirement | Description |
|---|---|---|---|
metric_key | JSON value | Required | Value of metric_key returned in the response body. |
site | JSON value | Required | Value of site returned in the response body. |
environment | JSON value | Required | Value of environment returned in the response body. |
series | JSON value | Required | Value of series returned in the response body. |
summary | JSON value | Required | Value of summary returned in the response body. |
trend | JSON value | Required | Value of trend returned in the response body. |
forecast | JSON value | Required | Value of forecast returned in the response body. |
Errors
JSON failures use one of the platform error envelopes and include the request correlation metadata when routing reaches the API middleware. See Errors for the exact shapes, authentication failures, retry guidance, and transport-level exceptions.
Examples
Request
curl --silent --show-error --globoff \
--request GET \
--header 'Authorization: Bearer <token>' \
'https://<your-host>/api/metrics/series'
Schematic response body
Illustrative shape generated from the extracted field types, not a recorded live response. Values are placeholders; null marks a field whose type could not be resolved.
Success status: 200
{
"metric_key": null,
"site": null,
"environment": null,
"series": null,
"summary": null,
"trend": null,
"forecast": null
}
GET/api/metrics/series/aggregated
request access
Time-bucketed (hourly/daily/weekly/monthly) MIN/MAX/MEAN/COUNT rollups of a metric series for historical trend analysis.
Mirrors metrics_series's gating + #2 coherent-scope handling. Buckets are NON-EMPTY only (no gap filling); weekly is the ISO-8601 Monday-start week at UTC. request-tier (a metrics read). The scan is bounded to the last limit buckets' worth of time.
Permissions
| Access class | Credential | Scoping |
|---|---|---|
request | An authenticated session or API bearer token is required. | The access class is enforced first; site and environment scopes narrow resources on scoped operations. |
HTTP request
GET https://<your-host>/api/metrics/series/aggregated
Path parameters
This operation has no path parameters.
Query parameters
| Name | Type | Requirement | Description |
|---|---|---|---|
metric_key | string | Optional | Value supplied for the metric_key query parameter. |
site | string | Optional | Site identifier used to scope or filter the operation. |
environment | string | Optional | Environment identifier used to scope or filter the operation. |
granularity | string | Optional | hourly | daily | weekly | monthly (allowlisted → a Postgres date_trunc field). |
limit | integer | Optional | Max buckets (default 365, clamped 1..=2000). Also bounds the scan window. |
Request headers
| Name | Type | Requirement | Description |
|---|---|---|---|
Authorization | string | Optional | Human credential alternative: supply one Bearer rys_... session token, ryk_... API token, or validated identity-provider JWT here. Do not combine it with X-Ryuki-Session-Id or the session cookie; conflicting carriers fail closed. |
X-Ryuki-Session-Id | string | Optional | Opaque rys_... session-token carrier used by the portal for mutations. Administrative session UUIDs cannot authenticate. Supply exactly one credential carrier per request. |
traceparent | string | Optional | Optional correlation input. When the second dash-separated segment has 32 characters, Ryuki reuses it as the request correlation identifier; this is not full W3C validation. |
Request body
This operation does not accept a request body.
Response
| Status | Description | Body |
|---|---|---|
200 | OK | Value |
200 response body
Structure: Value.
| Name | Type | Requirement | Description |
|---|---|---|---|
metric_key | JSON value | Required | Value of metric_key returned in the response body. |
granularity | JSON value | Required | Value of granularity returned in the response body. |
site | JSON value | Required | Value of site returned in the response body. |
environment | JSON value | Required | Value of environment returned in the response body. |
buckets | JSON value | Required | Value of buckets returned in the response body. |
Errors
JSON failures use one of the platform error envelopes and include the request correlation metadata when routing reaches the API middleware. See Errors for the exact shapes, authentication failures, retry guidance, and transport-level exceptions.
Examples
Request
curl --silent --show-error --globoff \
--request GET \
--header 'Authorization: Bearer <token>' \
'https://<your-host>/api/metrics/series/aggregated'
Schematic response body
Illustrative shape generated from the extracted field types, not a recorded live response. Values are placeholders; null marks a field whose type could not be resolved.
Success status: 200
{
"metric_key": null,
"granularity": null,
"site": null,
"environment": null,
"buckets": null
}
GET/api/metrics/slo
request access
List SLO definitions.
Request-tier read.
Permissions
| Access class | Credential | Scoping |
|---|---|---|
request | An authenticated session or API bearer token is required. | The access class is enforced first; site and environment scopes narrow resources on scoped operations. |
HTTP request
GET https://<your-host>/api/metrics/slo
Path parameters
This operation has no path parameters.
Query parameters
This operation has no query parameters.
Request headers
| Name | Type | Requirement | Description |
|---|---|---|---|
Authorization | string | Optional | Human credential alternative: supply one Bearer rys_... session token, ryk_... API token, or validated identity-provider JWT here. Do not combine it with X-Ryuki-Session-Id or the session cookie; conflicting carriers fail closed. |
X-Ryuki-Session-Id | string | Optional | Opaque rys_... session-token carrier used by the portal for mutations. Administrative session UUIDs cannot authenticate. Supply exactly one credential carrier per request. |
traceparent | string | Optional | Optional correlation input. When the second dash-separated segment has 32 characters, Ryuki reuses it as the request correlation identifier; this is not full W3C validation. |
Request body
This operation does not accept a request body.
Response
| Status | Description | Body |
|---|---|---|
200 | OK | Value |
200 response body
Structure: Value.
| Name | Type | Requirement | Description |
|---|---|---|---|
slos | JSON value | Required | Value of slos returned in the response body. |
durable | boolean | Required | Value of durable returned in the response body. |
Errors
JSON failures use one of the platform error envelopes and include the request correlation metadata when routing reaches the API middleware. See Errors for the exact shapes, authentication failures, retry guidance, and transport-level exceptions.
Examples
Request
curl --silent --show-error --globoff \
--request GET \
--header 'Authorization: Bearer <token>' \
'https://<your-host>/api/metrics/slo'
Schematic response body
Illustrative shape generated from the extracted field types, not a recorded live response. Values are placeholders; null marks a field whose type could not be resolved.
Success status: 200
{
"slos": null,
"durable": false
}
POST/api/metrics/slo
execute access
Define an SLO.
Execute-tier. 503 when no DB. good_metric_key/total_metric_key MUST be COUNTER-style event-count metrics — the status endpoint SUMs them over the window, which is only meaningful for additive samples (a gauge would produce nonsense compliance).
Permissions
| Access class | Credential | Scoping |
|---|---|---|
execute | An authenticated session or API bearer token is required. | The access class is enforced first; site and environment scopes narrow resources on scoped operations. |
HTTP request
POST https://<your-host>/api/metrics/slo
Path parameters
This operation has no path parameters.
Query parameters
This operation has no query parameters.
Request headers
| Name | Type | Requirement | Description |
|---|---|---|---|
Authorization | string | Optional | Human credential alternative: supply one Bearer rys_... session token, ryk_... API token, or validated identity-provider JWT here. Do not combine it with X-Ryuki-Session-Id or the session cookie; conflicting carriers fail closed. |
Content-Type | string | Required | Required by the resolved Axum Json<T> request extractor; send application/json. |
X-Ryuki-Session-Id | string | Optional | Opaque rys_... session-token carrier used by the portal for mutations. Administrative session UUIDs cannot authenticate. Supply exactly one credential carrier per request. |
Idempotency-Key | string | Optional | Optional at-most-once retry key for human mutations. When omitted, the idempotency middleware passes the request through without deduplication. |
traceparent | string | Optional | Optional correlation input. When the second dash-separated segment has 32 characters, Ryuki reuses it as the request correlation identifier; this is not full W3C validation. |
Request body
JSON structure: SloCreateRequest.
| Name | Type | Requirement | Description |
|---|---|---|---|
name | string | Required | Client-supplied name for the resource or operation. |
target | number | Required | Value of target in the JSON request body. |
window_days | integer | Optional | Value of window_days in the JSON request body. |
good_metric_key | string | Required | Value of good_metric_key in the JSON request body. |
total_metric_key | string | Required | Value of total_metric_key in the JSON request body. |
site | string | Optional | Site code targeted by the request. |
environment | string | Optional | Environment targeted by the request. |
Response
| Status | Description | Body |
|---|---|---|
200 | OK | Value |
200 response body
Structure: Value.
| Name | Type | Requirement | Description |
|---|---|---|---|
id | JSON value | Required | Identifier of the returned resource. |
created | boolean | Required | Value of created returned in the response body. |
Errors
JSON failures use one of the platform error envelopes and include the request correlation metadata when routing reaches the API middleware. See Errors for the exact shapes, authentication failures, retry guidance, and transport-level exceptions.
Examples
Request
curl --silent --show-error --globoff \
--request POST \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '{"name":"<string>","target":0.0,"good_metric_key":"<string>","total_metric_key":"<string>"}' \
'https://<your-host>/api/metrics/slo'
Schematic response body
Illustrative shape generated from the extracted field types, not a recorded live response. Values are placeholders; null marks a field whose type could not be resolved.
Success status: 200
{
"id": null,
"created": false
}
GET/api/metrics/slo/status
request access
Evaluate every enabled SLO over its window (sum good/total from metric_samples, compute attainment + error-budget burn).
Request-tier. Alerting-safe: the one batch aggregate fails the request loud (never a false compliant), and a window with no events is insufficient-data.
Permissions
| Access class | Credential | Scoping |
|---|---|---|
request | An authenticated session or API bearer token is required. | The access class is enforced first; site and environment scopes narrow resources on scoped operations. |
HTTP request
GET https://<your-host>/api/metrics/slo/status
Path parameters
This operation has no path parameters.
Query parameters
This operation has no query parameters.
Request headers
| Name | Type | Requirement | Description |
|---|---|---|---|
Authorization | string | Optional | Human credential alternative: supply one Bearer rys_... session token, ryk_... API token, or validated identity-provider JWT here. Do not combine it with X-Ryuki-Session-Id or the session cookie; conflicting carriers fail closed. |
X-Ryuki-Session-Id | string | Optional | Opaque rys_... session-token carrier used by the portal for mutations. Administrative session UUIDs cannot authenticate. Supply exactly one credential carrier per request. |
traceparent | string | Optional | Optional correlation input. When the second dash-separated segment has 32 characters, Ryuki reuses it as the request correlation identifier; this is not full W3C validation. |
Request body
This operation does not accept a request body.
Response
| Status | Description | Body |
|---|---|---|
200 | OK | Value |
200 response body
Structure: Value.
| Name | Type | Requirement | Description |
|---|---|---|---|
slos | JSON value | Required | Value of slos returned in the response body. |
breached_count | JSON value | Required | Value of breached_count returned in the response body. |
errored_count | JSON value | Required | Value of errored_count returned in the response body. |
overall_status | JSON value | Required | Value of overall_status returned in the response body. |
Errors
JSON failures use one of the platform error envelopes and include the request correlation metadata when routing reaches the API middleware. See Errors for the exact shapes, authentication failures, retry guidance, and transport-level exceptions.
Examples
Request
curl --silent --show-error --globoff \
--request GET \
--header 'Authorization: Bearer <token>' \
'https://<your-host>/api/metrics/slo/status'
Schematic response body
Illustrative shape generated from the extracted field types, not a recorded live response. Values are placeholders; null marks a field whose type could not be resolved.
Success status: 200
{
"slos": null,
"breached_count": null,
"errored_count": null,
"overall_status": null
}
DELETE/api/metrics/slo/{id}
execute access
Remove an SLO definition (swarm #20, CRUD completion).
Execute-tier. 404 if absent; 503 no DB.
Permissions
| Access class | Credential | Scoping |
|---|---|---|
execute | An authenticated session or API bearer token is required. | The access class is enforced first; site and environment scopes narrow resources on scoped operations. |
HTTP request
DELETE https://<your-host>/api/metrics/slo/{id}
Path parameters
| Name | Type | Requirement | Description |
|---|---|---|---|
id | string | Required | Identifier of the target resource in the request path. |
Query parameters
This operation has no query parameters.
Request headers
| Name | Type | Requirement | Description |
|---|---|---|---|
Authorization | string | Optional | Human credential alternative: supply one Bearer rys_... session token, ryk_... API token, or validated identity-provider JWT here. Do not combine it with X-Ryuki-Session-Id or the session cookie; conflicting carriers fail closed. |
X-Ryuki-Session-Id | string | Optional | Opaque rys_... session-token carrier used by the portal for mutations. Administrative session UUIDs cannot authenticate. Supply exactly one credential carrier per request. |
Idempotency-Key | string | Optional | Optional at-most-once retry key for human mutations. When omitted, the idempotency middleware passes the request through without deduplication. |
traceparent | string | Optional | Optional correlation input. When the second dash-separated segment has 32 characters, Ryuki reuses it as the request correlation identifier; this is not full W3C validation. |
Request body
This operation does not accept a request body.
Response
| Status | Description | Body |
|---|---|---|
200 | OK | Value |
200 response body
Structure: Value.
| Name | Type | Requirement | Description |
|---|---|---|---|
deleted | JSON value | Required | Value of deleted returned in the response body. |
Errors
JSON failures use one of the platform error envelopes and include the request correlation metadata when routing reaches the API middleware. See Errors for the exact shapes, authentication failures, retry guidance, and transport-level exceptions.
Examples
Request
curl --silent --show-error --globoff \
--request DELETE \
--header 'Authorization: Bearer <token>' \
--header 'Idempotency-Key: <idempotency-key>' \
'https://<your-host>/api/metrics/slo/<id>'
Schematic response body
Illustrative shape generated from the extracted field types, not a recorded live response. Values are placeholders; null marks a field whose type could not be resolved.
Success status: 200
{
"deleted": null
}
PUT/api/metrics/slo/{id}
execute access
Update an SLO's mutable fields (name, target, window_days, enabled); omitted fields are left unchanged (PATCH semantics, swarm #20).
Execute-tier. 404 if absent; 503 no DB. The metric keys and scope are immutable here — recreate to re-target or re-scope.
Permissions
| Access class | Credential | Scoping |
|---|---|---|
execute | An authenticated session or API bearer token is required. | The access class is enforced first; site and environment scopes narrow resources on scoped operations. |
HTTP request
PUT https://<your-host>/api/metrics/slo/{id}
Path parameters
| Name | Type | Requirement | Description |
|---|---|---|---|
id | string | Required | Identifier of the target resource in the request path. |
Query parameters
This operation has no query parameters.
Request headers
| Name | Type | Requirement | Description |
|---|---|---|---|
Authorization | string | Optional | Human credential alternative: supply one Bearer rys_... session token, ryk_... API token, or validated identity-provider JWT here. Do not combine it with X-Ryuki-Session-Id or the session cookie; conflicting carriers fail closed. |
Content-Type | string | Required | Required by the resolved Axum Json<T> request extractor; send application/json. |
X-Ryuki-Session-Id | string | Optional | Opaque rys_... session-token carrier used by the portal for mutations. Administrative session UUIDs cannot authenticate. Supply exactly one credential carrier per request. |
Idempotency-Key | string | Optional | Optional at-most-once retry key for human mutations. When omitted, the idempotency middleware passes the request through without deduplication. |
traceparent | string | Optional | Optional correlation input. When the second dash-separated segment has 32 characters, Ryuki reuses it as the request correlation identifier; this is not full W3C validation. |
Request body
JSON structure: SloUpdateRequest.
| Name | Type | Requirement | Description |
|---|---|---|---|
name | string | Optional | Client-supplied name for the resource or operation. |
target | number | Optional | Value of target in the JSON request body. |
window_days | integer | Optional | Value of window_days in the JSON request body. |
enabled | boolean | Optional | Whether the requested capability should be enabled. |
Response
| Status | Description | Body |
|---|---|---|
200 | OK | Value |
200 response body
Structure: Value.
| Name | Type | Requirement | Description |
|---|---|---|---|
updated | JSON value | Required | Value of updated returned in the response body. |
Errors
JSON failures use one of the platform error envelopes and include the request correlation metadata when routing reaches the API middleware. See Errors for the exact shapes, authentication failures, retry guidance, and transport-level exceptions.
Examples
Request
curl --silent --show-error --globoff \
--request PUT \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '{}' \
'https://<your-host>/api/metrics/slo/<id>'
Schematic response body
Illustrative shape generated from the extracted field types, not a recorded live response. Values are placeholders; null marks a field whose type could not be resolved.
Success status: 200
{
"updated": null
}
GET/api/metrics/what-if
request access
Project a metric forward under a hypothetical growth factor and report whether/when it would breach a capacity/cost ceiling (pure ryuki_engine::metric_planning).
metric_key and ceiling are required. Request-tier read. 503 when no database is configured; 500 on a query error.
Permissions
| Access class | Credential | Scoping |
|---|---|---|
request | An authenticated session or API bearer token is required. | The access class is enforced first; site and environment scopes narrow resources on scoped operations. |
HTTP request
GET https://<your-host>/api/metrics/what-if
Path parameters
This operation has no path parameters.
Query parameters
| Name | Type | Requirement | Description |
|---|---|---|---|
metric_key | string | Optional | Value supplied for the metric_key query parameter. |
site | string | Optional | Site identifier used to scope or filter the operation. |
environment | string | Optional | Environment identifier used to scope or filter the operation. |
horizon | integer | Optional | Periods to project forward (default 6, capped 100). |
growth | number | Optional | Hypothetical load/cost multiplier on the projection (default 1.0). |
ceiling | number | Optional | Capacity/cost ceiling to test the projection against (required). |
Request headers
| Name | Type | Requirement | Description |
|---|---|---|---|
Authorization | string | Optional | Human credential alternative: supply one Bearer rys_... session token, ryk_... API token, or validated identity-provider JWT here. Do not combine it with X-Ryuki-Session-Id or the session cookie; conflicting carriers fail closed. |
X-Ryuki-Session-Id | string | Optional | Opaque rys_... session-token carrier used by the portal for mutations. Administrative session UUIDs cannot authenticate. Supply exactly one credential carrier per request. |
traceparent | string | Optional | Optional correlation input. When the second dash-separated segment has 32 characters, Ryuki reuses it as the request correlation identifier; this is not full W3C validation. |
Request body
This operation does not accept a request body.
Response
| Status | Description | Body |
|---|---|---|
200 | OK | Value |
200 response body
Structure: Value.
| Name | Type | Requirement | Description |
|---|---|---|---|
metric_key | JSON value | Required | Value of metric_key returned in the response body. |
site | JSON value | Required | Value of site returned in the response body. |
environment | JSON value | Required | Value of environment returned in the response body. |
ceiling | JSON value | Required | Value of ceiling returned in the response body. |
growth_factor | JSON value | Required | Value of growth_factor returned in the response body. |
breaches | JSON value | Required | Value of breaches returned in the response body. |
first_breach_at | JSON value | Required | Value of first_breach_at returned in the response body. |
peak_projected | JSON value | Required | Value of peak_projected returned in the response body. |
headroom | JSON value | Required | Value of headroom returned in the response body. |
projected | JSON value | Required | Value of projected returned in the response body. |
Errors
JSON failures use one of the platform error envelopes and include the request correlation metadata when routing reaches the API middleware. See Errors for the exact shapes, authentication failures, retry guidance, and transport-level exceptions.
Examples
Request
curl --silent --show-error --globoff \
--request GET \
--header 'Authorization: Bearer <token>' \
'https://<your-host>/api/metrics/what-if'
Schematic response body
Illustrative shape generated from the extracted field types, not a recorded live response. Values are placeholders; null marks a field whose type could not be resolved.
Success status: 200
{
"metric_key": null,
"site": null,
"environment": null,
"ceiling": null,
"growth_factor": null,
"breaches": null,
"first_breach_at": null,
"peak_projected": null,
"headroom": null,
"projected": null
}