Skip to main content
GET
/
simulations
/
{simulation_id}
/
metrics
/
{metric_output_id}
Get simulation metric output(s)
curl --request GET \
  --url https://api.coval.dev/v1/simulations/{simulation_id}/metrics/{metric_output_id} \
  --header 'X-API-Key: <api-key>'
import requests

url = "https://api.coval.dev/v1/simulations/{simulation_id}/metrics/{metric_output_id}"

headers = {"X-API-Key": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};

fetch('https://api.coval.dev/v1/simulations/{simulation_id}/metrics/{metric_output_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.coval.dev/v1/simulations/{simulation_id}/metrics/{metric_output_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.coval.dev/v1/simulations/{simulation_id}/metrics/{metric_output_id}"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("X-API-Key", "<api-key>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.coval.dev/v1/simulations/{simulation_id}/metrics/{metric_output_id}")
.header("X-API-Key", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.coval.dev/v1/simulations/{simulation_id}/metrics/{metric_output_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "metric": {
    "metric_output_id": "01JCQR8Z9PQSTNVWXY12345678",
    "metric_id": "abc123xyz789",
    "status": "COMPLETED",
    "metric_version_ulid": "01JCQR8Z9PQSTNVWXY12345678",
    "value": 0.85,
    "explanation": "The agent never confirmed the caller's address before ending the call.",
    "subvalues_by_timestamp": [
      {
        "start_offset": 0,
        "end_offset": 2.5,
        "output_type": "float",
        "float_value": 0.85,
        "string_value": "",
        "role": "assistant",
        "message_index": 3
      }
    ],
    "result": {
      "llm": {
        "answer_explanation": "The agent never confirmed the caller's address before ending the call.",
        "prompt": "Did the agent confirm the caller's address?"
      }
    },
    "runtime_metadata": {}
  }
}
{
"error": {
"code": "UNAUTHENTICATED",
"message": "Missing API Key",
"details": [
{
"field": "X-API-Key",
"description": "X-API-Key header is required"
}
]
}
}
{
"error": {
"code": "NOT_FOUND",
"message": "Agent not found",
"details": [
{
"field": "agent_id",
"description": "Agent 'gk3jK9mPq2xRt5vW8yZaBc' does not exist"
}
]
}
}
{
"error": {
"code": "INTERNAL",
"message": "Internal server error",
"details": [
{
"description": "An unexpected error occurred. Please contact support."
}
]
}
}

Authorizations

X-API-Key
string
header
required

API key for authentication.

Path Parameters

simulation_id
string
required

The simulation ID

Required string length: 22 - 27
metric_output_id
string
required

Either a 26-char MetricOutput ULID or a 22-char Metric definition ID. See endpoint description for response shape per ID type.

Required string length: 22 - 26

Response

Metric output details. Single object when called with a 26-char ULID, collection object when called with a 22-char metric_id.

Single metric output (returned when {metric_output_id} is a 26-char ULID)

metric
object
required