Revert metric version
curl --request POST \
--url https://api.coval.dev/v1/metrics/{metric_id}/versions/{version_id}/revert \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.coval.dev/v1/metrics/{metric_id}/versions/{version_id}/revert"
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.coval.dev/v1/metrics/{metric_id}/versions/{version_id}/revert', 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/metrics/{metric_id}/versions/{version_id}/revert",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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/metrics/{metric_id}/versions/{version_id}/revert"
req, _ := http.NewRequest("POST", 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.post("https://api.coval.dev/v1/metrics/{metric_id}/versions/{version_id}/revert")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coval.dev/v1/metrics/{metric_id}/versions/{version_id}/revert")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"metric": {
"name": "metrics/abc123def456ghi789jklm",
"id": "abc123def456ghi789jklm",
"metric_name": "Customer Satisfaction",
"description": "Evaluates customer satisfaction",
"prompt": "Did the agent resolve the issue?",
"categories": [
"positive",
"neutral",
"negative"
],
"min_value": 1,
"max_value": 10,
"metadata_field_key": "satisfaction_score",
"regex_pattern": "(hello|hi)",
"role": "agent",
"min_pause_duration_seconds": 0.5,
"include_traces": true,
"runtime_config": {
"model_version": "openai:gpt-4.1-mini-2025-04-14",
"thinking_enabled": true
},
"target_condition": {
"comparison_operator": "in",
"target_values": [
"YES"
]
},
"tags": [
"production",
"llm"
],
"created_by": "<string>",
"create_time": "2023-11-07T05:31:56Z",
"update_time": "2023-11-07T05:31:56Z",
"current_version": {
"ulid": "01KKWQYSF737ZN6X1Q1RYX8M2D",
"version_number": 3
}
}
}{
"error": {
"code": "INVALID_ARGUMENT",
"message": "Invalid revert request",
"details": [
{
"field": "version_id",
"description": "Target version is already the current version"
}
]
}
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Authentication failed",
"details": [
{
"field": "X-API-Key",
"description": "Invalid or missing API key"
}
]
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Metric not found",
"details": [
{
"field": "metric_id",
"description": "No metric found with this ID"
}
]
}
}{
"error": {
"code": "INTERNAL",
"message": "Internal server error"
}
}Versions
Revert metric version
Re-apply a prior version’s scoring configuration to the live metric. A revert is forward-only: it mints a new version (change_type=revert) and advances the metric, so the response reflects the metric’s new live config. Reverting to the version the metric already points at is rejected with 400.
POST
/
metrics
/
{metric_id}
/
versions
/
{version_id}
/
revert
Revert metric version
curl --request POST \
--url https://api.coval.dev/v1/metrics/{metric_id}/versions/{version_id}/revert \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.coval.dev/v1/metrics/{metric_id}/versions/{version_id}/revert"
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.coval.dev/v1/metrics/{metric_id}/versions/{version_id}/revert', 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/metrics/{metric_id}/versions/{version_id}/revert",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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/metrics/{metric_id}/versions/{version_id}/revert"
req, _ := http.NewRequest("POST", 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.post("https://api.coval.dev/v1/metrics/{metric_id}/versions/{version_id}/revert")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coval.dev/v1/metrics/{metric_id}/versions/{version_id}/revert")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"metric": {
"name": "metrics/abc123def456ghi789jklm",
"id": "abc123def456ghi789jklm",
"metric_name": "Customer Satisfaction",
"description": "Evaluates customer satisfaction",
"prompt": "Did the agent resolve the issue?",
"categories": [
"positive",
"neutral",
"negative"
],
"min_value": 1,
"max_value": 10,
"metadata_field_key": "satisfaction_score",
"regex_pattern": "(hello|hi)",
"role": "agent",
"min_pause_duration_seconds": 0.5,
"include_traces": true,
"runtime_config": {
"model_version": "openai:gpt-4.1-mini-2025-04-14",
"thinking_enabled": true
},
"target_condition": {
"comparison_operator": "in",
"target_values": [
"YES"
]
},
"tags": [
"production",
"llm"
],
"created_by": "<string>",
"create_time": "2023-11-07T05:31:56Z",
"update_time": "2023-11-07T05:31:56Z",
"current_version": {
"ulid": "01KKWQYSF737ZN6X1Q1RYX8M2D",
"version_number": 3
}
}
}{
"error": {
"code": "INVALID_ARGUMENT",
"message": "Invalid revert request",
"details": [
{
"field": "version_id",
"description": "Target version is already the current version"
}
]
}
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Authentication failed",
"details": [
{
"field": "X-API-Key",
"description": "Invalid or missing API key"
}
]
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Metric not found",
"details": [
{
"field": "metric_id",
"description": "No metric found with this ID"
}
]
}
}{
"error": {
"code": "INTERNAL",
"message": "Internal server error"
}
}Authorizations
API key for authentication
Path Parameters
22-character metric ID
Pattern:
^[a-zA-Z0-9]{22}$ULID of the target version to re-apply
Required string length:
26Pattern:
^[0-9A-HJKMNP-TV-Z]{26}$Response
Metric reverted
Metric resource
Show child attributes
Show child attributes
Was this page helpful?
⌘I