{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/roark/json-schema/roark-metric-collection-job-metric-values-response-schema.json",
  "title": "MetricCollectionJobMetricValuesResponse",
  "description": "Metric values produced by a specific metric collection job. Grouped by metric definition, same shape as the per-call metrics endpoint.",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/roark-openapi.json#/components/schemas/MetricCollectionJobMetricValuesResponse",
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "metricDefinitionId": {
        "type": "string",
        "format": "uuid",
        "description": "Unique identifier for the metric definition"
      },
      "slug": {
        "type": "string",
        "description": "Stable metric slug"
      },
      "metricId": {
        "type": "string",
        "description": "Alias of `slug` retained for backwards compatibility. Same value as `slug`."
      },
      "name": {
        "type": "string",
        "description": "Name of the metric"
      },
      "description": {
        "type": "string",
        "description": "Description of what the metric measures"
      },
      "type": {
        "type": "string",
        "enum": [
          "COUNT",
          "NUMERIC",
          "BOOLEAN",
          "SCALE",
          "TEXT",
          "CLASSIFICATION",
          "OFFSET"
        ],
        "description": "Type of value this metric produces"
      },
      "scope": {
        "type": "string",
        "enum": [
          "GLOBAL",
          "PER_PARTICIPANT"
        ],
        "description": "Whether metric is global or per-participant"
      },
      "unit": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Name of the unit"
          },
          "symbol": {
            "type": [
              "string",
              "null"
            ],
            "description": "Symbol for the unit"
          }
        },
        "required": [
          "name",
          "symbol"
        ],
        "description": "Unit information if applicable"
      },
      "values": {
        "type": "array",
        "items": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "value": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "string"
                    }
                  ],
                  "description": "The metric value (type depends on outputType). Present only on SUCCESS rows; omitted for NOT_APPLICABLE / DATA_MISSING / ERROR."
                },
                "callId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the call this value was computed on. Only set when the response spans multiple conversations (e.g. job-scoped metric values)."
                },
                "chatId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the chat this value was computed on. Only set when the response spans multiple conversations (e.g. job-scoped metric values)."
                },
                "captureStatus": {
                  "type": "string",
                  "enum": [
                    "SUCCESS",
                    "NOT_APPLICABLE",
                    "DATA_MISSING",
                    "ERROR"
                  ],
                  "description": "Result state of this metric computation. SUCCESS carries a real `value`; NOT_APPLICABLE / DATA_MISSING / ERROR do not (the `value` field is omitted). Non-SUCCESS rows only appear when the request includes ?status=all."
                },
                "errorMessage": {
                  "type": "string",
                  "description": "Error detail when captureStatus is ERROR — e.g. provider down, LLM timeout. Undefined for other statuses."
                },
                "context": {
                  "type": "string",
                  "enum": [
                    "CALL",
                    "SEGMENT",
                    "SEGMENT_RANGE"
                  ],
                  "description": "Context level: CALL (entire conversation), SEGMENT (single segment), SEGMENT_RANGE (between/across segments)"
                },
                "participantRole": {
                  "type": "string",
                  "enum": [
                    "agent",
                    "customer"
                  ],
                  "description": "Role of participant (only for PER_PARTICIPANT metrics)"
                },
                "valueReasoning": {
                  "type": "string",
                  "description": "Explanation for the metric value (especially useful for AI-computed metrics)"
                },
                "confidence": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1,
                  "description": "Confidence score (0-1) for the computed value. Defaults to 1.0 for deterministic metrics. Omitted on non-SUCCESS rows."
                },
                "computedAt": {
                  "type": "string",
                  "format": "date-time",
                  "description": "ISO 8601 timestamp when the metric was computed"
                },
                "policyIds": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "description": "IDs of metric policies that triggered this metric computation"
                },
                "segment": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Segment ID"
                    },
                    "text": {
                      "type": "string",
                      "description": "Segment text content"
                    },
                    "startOffsetMs": {
                      "type": "number",
                      "description": "Start time offset in milliseconds"
                    },
                    "endOffsetMs": {
                      "type": "number",
                      "description": "End time offset in milliseconds"
                    }
                  },
                  "required": [
                    "id",
                    "text",
                    "startOffsetMs",
                    "endOffsetMs"
                  ],
                  "description": "Segment information (for SEGMENT context metrics)"
                },
                "fromSegment": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Segment ID"
                    },
                    "text": {
                      "type": "string",
                      "description": "Segment text content"
                    },
                    "startOffsetMs": {
                      "type": "number",
                      "description": "Start time offset in milliseconds"
                    },
                    "endOffsetMs": {
                      "type": "number",
                      "description": "End time offset in milliseconds"
                    }
                  },
                  "required": [
                    "id",
                    "text",
                    "startOffsetMs",
                    "endOffsetMs"
                  ],
                  "description": "Starting segment information (for SEGMENT_RANGE context metrics)"
                },
                "toSegment": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Segment ID"
                    },
                    "text": {
                      "type": "string",
                      "description": "Segment text content"
                    },
                    "startOffsetMs": {
                      "type": "number",
                      "description": "Start time offset in milliseconds"
                    },
                    "endOffsetMs": {
                      "type": "number",
                      "description": "End time offset in milliseconds"
                    }
                  },
                  "required": [
                    "id",
                    "text",
                    "startOffsetMs",
                    "endOffsetMs"
                  ],
                  "description": "Ending segment information (for SEGMENT_RANGE context metrics)"
                },
                "evidenceSpans": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "fromSegment": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Segment ID"
                          },
                          "text": {
                            "type": "string",
                            "description": "Segment text content"
                          },
                          "startOffsetMs": {
                            "type": "number",
                            "description": "Start time offset in milliseconds"
                          },
                          "endOffsetMs": {
                            "type": "number",
                            "description": "End time offset in milliseconds"
                          }
                        },
                        "required": [
                          "id",
                          "text",
                          "startOffsetMs",
                          "endOffsetMs"
                        ],
                        "description": "First segment of the span"
                      },
                      "toSegment": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Segment ID"
                          },
                          "text": {
                            "type": "string",
                            "description": "Segment text content"
                          },
                          "startOffsetMs": {
                            "type": "number",
                            "description": "Start time offset in milliseconds"
                          },
                          "endOffsetMs": {
                            "type": "number",
                            "description": "End time offset in milliseconds"
                          }
                        },
                        "required": [
                          "id",
                          "text",
                          "startOffsetMs",
                          "endOffsetMs"
                        ],
                        "description": "Last segment of the span (the same as fromSegment for one line)"
                      },
                      "reason": {
                        "type": "string",
                        "description": "The judge's one-line account of what happens here"
                      }
                    },
                    "required": [
                      "fromSegment",
                      "toSegment"
                    ]
                  },
                  "description": "For CALL-context values of LLM judge metrics that cited where their evidence is: the transcript spans that decided the value, most decisive first. Omitted otherwise."
                }
              },
              "required": [
                "captureStatus",
                "context",
                "computedAt"
              ],
              "title": "Standard metric value",
              "description": "A metric value entry. Applies to every metric."
            },
            {
              "type": "object",
              "properties": {
                "value": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "string"
                    }
                  ],
                  "description": "The metric value (type depends on outputType). Present only on SUCCESS rows; omitted for NOT_APPLICABLE / DATA_MISSING / ERROR."
                },
                "callId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the call this value was computed on. Only set when the response spans multiple conversations (e.g. job-scoped metric values)."
                },
                "chatId": {
                  "type": "string",
                  "format": "uuid",
                  "description": "ID of the chat this value was computed on. Only set when the response spans multiple conversations (e.g. job-scoped metric values)."
                },
                "captureStatus": {
                  "type": "string",
                  "enum": [
                    "SUCCESS",
                    "NOT_APPLICABLE",
                    "DATA_MISSING",
                    "ERROR"
                  ],
                  "description": "Result state of this metric computation. SUCCESS carries a real `value`; NOT_APPLICABLE / DATA_MISSING / ERROR do not (the `value` field is omitted). Non-SUCCESS rows only appear when the request includes ?status=all."
                },
                "errorMessage": {
                  "type": "string",
                  "description": "Error detail when captureStatus is ERROR — e.g. provider down, LLM timeout. Undefined for other statuses."
                },
                "context": {
                  "type": "string",
                  "enum": [
                    "CALL",
                    "SEGMENT",
                    "SEGMENT_RANGE"
                  ],
                  "description": "Context level: CALL (entire conversation), SEGMENT (single segment), SEGMENT_RANGE (between/across segments)"
                },
                "participantRole": {
                  "type": "string",
                  "enum": [
                    "agent",
                    "customer"
                  ],
                  "description": "Role of participant (only for PER_PARTICIPANT metrics)"
                },
                "valueReasoning": {
                  "type": "string",
                  "description": "Explanation for the metric value (especially useful for AI-computed metrics)"
                },
                "confidence": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1,
                  "description": "Confidence score (0-1) for the computed value. Defaults to 1.0 for deterministic metrics. Omitted on non-SUCCESS rows."
                },
                "computedAt": {
                  "type": "string",
                  "format": "date-time",
                  "description": "ISO 8601 timestamp when the metric was computed"
                },
                "policyIds": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "description": "IDs of metric policies that triggered this metric computation"
                },
                "segment": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Segment ID"
                    },
                    "text": {
                      "type": "string",
                      "description": "Segment text content"
                    },
                    "startOffsetMs": {
                      "type": "number",
                      "description": "Start time offset in milliseconds"
                    },
                    "endOffsetMs": {
                      "type": "number",
                      "description": "End time offset in milliseconds"
                    }
                  },
                  "required": [
                    "id",
                    "text",
                    "startOffsetMs",
                    "endOffsetMs"
                  ],
                  "description": "Segment information (for SEGMENT context metrics)"
                },
                "fromSegment": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Segment ID"
                    },
                    "text": {
                      "type": "string",
                      "description": "Segment text content"
                    },
                    "startOffsetMs": {
                      "type": "number",
                      "description": "Start time offset in milliseconds"
                    },
                    "endOffsetMs": {
                      "type": "number",
                      "description": "End time offset in milliseconds"
                    }
                  },
                  "required": [
                    "id",
                    "text",
                    "startOffsetMs",
                    "endOffsetMs"
                  ],
                  "description": "Starting segment information (for SEGMENT_RANGE context metrics)"
                },
                "toSegment": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "description": "Segment ID"
                    },
                    "text": {
                      "type": "string",
                      "description": "Segment text content"
                    },
                    "startOffsetMs": {
                      "type": "number",
                      "description": "Start time offset in milliseconds"
                    },
                    "endOffsetMs": {
                      "type": "number",
                      "description": "End time offset in milliseconds"
                    }
                  },
                  "required": [
                    "id",
                    "text",
                    "startOffsetMs",
                    "endOffsetMs"
                  ],
                  "description": "Ending segment information (for SEGMENT_RANGE context metrics)"
                },
                "evidenceSpans": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "fromSegment": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Segment ID"
                          },
                          "text": {
                            "type": "string",
                            "description": "Segment text content"
                          },
                          "startOffsetMs": {
                            "type": "number",
                            "description": "Start time offset in milliseconds"
                          },
                          "endOffsetMs": {
                            "type": "number",
                            "description": "End time offset in milliseconds"
                          }
                        },
                        "required": [
                          "id",
                          "text",
                          "startOffsetMs",
                          "endOffsetMs"
                        ],
                        "description": "First segment of the span"
                      },
                      "toSegment": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Segment ID"
                          },
                          "text": {
                            "type": "string",
                            "description": "Segment text content"
                          },
                          "startOffsetMs": {
                            "type": "number",
                            "description": "Start time offset in milliseconds"
                          },
                          "endOffsetMs": {
                            "type": "number",
                            "description": "End time offset in milliseconds"
                          }
                        },
                        "required": [
                          "id",
                          "text",
                          "startOffsetMs",
                          "endOffsetMs"
                        ],
                        "description": "Last segment of the span (the same as fromSegment for one line)"
                      },
                      "reason": {
                        "type": "string",
                        "description": "The judge's one-line account of what happens here"
                      }
                    },
                    "required": [
                      "fromSegment",
                      "toSegment"
                    ]
                  },
                  "description": "For CALL-context values of LLM judge metrics that cited where their evidence is: the transcript spans that decided the value, most decisive first. Omitted otherwise."
                },
                "propertyVerdicts": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "propertyName": {
                        "type": "string",
                        "description": "The call property checked, as sent at ingest"
                      },
                      "expectedValue": {
                        "type": "string",
                        "description": "The value supplied at ingest, frozen at scoring time"
                      },
                      "observedValue": {
                        "type": "string",
                        "description": "What the transcript said instead. Only present when verdict is MISMATCH."
                      },
                      "verdict": {
                        "type": "string",
                        "enum": [
                          "MATCH",
                          "MISMATCH",
                          "TRANSCRIPTION_ERROR",
                          "NOT_MENTIONED"
                        ],
                        "description": "How this property resolved against the transcript. NOT_MENTIONED means the subject never came up and is not a mismatch."
                      },
                      "reasoning": {
                        "type": "string",
                        "description": "Judge reasoning for this verdict"
                      },
                      "segment": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "description": "Segment ID"
                          },
                          "text": {
                            "type": "string",
                            "description": "Segment text content"
                          },
                          "startOffsetMs": {
                            "type": "number",
                            "description": "Start time offset in milliseconds"
                          },
                          "endOffsetMs": {
                            "type": "number",
                            "description": "End time offset in milliseconds"
                          }
                        },
                        "required": [
                          "id",
                          "text",
                          "startOffsetMs",
                          "endOffsetMs"
                        ],
                        "description": "The transcript segment this property was referred to in: the conflicting value for MISMATCH, the confirming reference for MATCH. Omitted for NOT_MENTIONED and when the verdict could not be anchored."
                      }
                    },
                    "required": [
                      "propertyName",
                      "expectedValue",
                      "verdict"
                    ]
                  },
                  "description": "Per-property verdicts for the Property Mismatch metric, in the order the properties were checked. Omitted for every other metric."
                }
              },
              "required": [
                "captureStatus",
                "context",
                "computedAt"
              ],
              "title": "Property verification metric value",
              "description": "Returned for the Property Mismatch metric (`property_transcript_mismatch`): the standard entry plus the per-property verdict breakdown."
            }
          ]
        },
        "description": "Array of metric values (multiple for PER_PARTICIPANT metrics, or multiple segments/turns)"
      }
    },
    "required": [
      "metricDefinitionId",
      "slug",
      "metricId",
      "name",
      "description",
      "type",
      "scope",
      "values"
    ],
    "description": "Metric data grouped by metric definition"
  }
}