Create a new metric.
Supports flat metrics, parent "category" metrics (set
selection_mode), and child sub-metrics (set
parent_metric_id). Name uniqueness is scoped to
(organization_id, workspace_id, parent_metric_id) so the same
label can exist in multiple workspaces (and under multiple parents).
Scope:
scope="workspace"(default) stamps the metric with the activeX-Workspace-Id(existing behavior).scope="organization"stampsworkspace_id=NULLso the metric appears in every workspace of the caller's org.
Children always inherit their parent's scope (workspace UUID or
NULL) - we override the request's workspace + scope when
parent_metric_id is set so a stale UI can't accidentally split
a tree across workspaces or scopes.
JWT access token. Use: Authorization: Bearer .
In: header
Header Parameters
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Schema for creating a metric.
Hierarchy:
parent_metric_idset => this is a child sub-metric.metric_typeis forced tobooleanserver-side;selection_modemust be None.selection_modeset => this is a parent category metric.parent_metric_idmust be None (max depth = 2).
Scope:
scope="workspace"(default) stamps the metric with the activeX-Workspace-Idso it only shows up inside that workspace.scope="organization"stampsworkspace_id=NULLso the metric is visible in every workspace of the org. Children always inherit their parent's scope; settingscopeon a child request body is ignored server-side.
Response Body
application/json
application/json
curl -X POST "https://example.com/api/v1/metrics" \ -H "Content-Type: application/json" \ -d '{ "name": "string" }'{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9", "scope": "workspace", "name": "string", "description": "string", "example": "string", "metric_type": "number", "metric_category": "quality", "trigger": "always", "enabled": true, "is_default": true, "metric_origin": "string", "supported_surfaces": [ "string" ], "enabled_surfaces": [ "string" ], "custom_data_type": "string", "custom_config": {}, "tags": [ "string" ], "capture_rationale": false, "parent_metric_id": "a4a6359f-6ade-48cb-af32-ccbc80976b98", "selection_mode": "single_choice", "allow_discovery": false, "compare_transcripts": false, "lifecycle": "active", "promoted_from_draft_at": "2019-08-24T14:15:22Z", "studio_notes": "string", "children": [ {} ], "created_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z", "created_by": "string"}Community & contact
- Found a bug or have a feature request? Open a GitHub issue.
- Join our Discord for faster replies!
