Skip to main content
PATCH
/
metrics
/
{id}
Update metric
curl --request PATCH \
  --url https://api.galtea.ai/metrics/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "id": "metric_123",
  "parentMetricId": "metric_122",
  "organizationId": "org_123",
  "userId": "user_123",
  "name": "Accuracy",
  "evaluationParams": [
    "input",
    "actualOutput",
    "expectedOutput"
  ],
  "source": "PARTIAL_PROMPT",
  "judgePrompt": "Evaluate the accuracy of the response",
  "tags": [
    "accuracy",
    "quality"
  ],
  "description": "Measures the accuracy of responses",
  "documentationUrl": "https://docs.example.com/metrics/accuracy",
  "evaluatorModelName": "GPT-4",
  "areEvalParamsTop": true,
  "specificationIds": [
    "spec_123"
  ],
  "userGroupIds": [
    "ug_123"
  ],
  "createdAt": "2023-11-07T05:31:56Z",
  "legacyAt": "2023-11-07T05:31:56Z",
  "disabledAt": "2023-11-07T05:31:56Z"
}
'
import requests

url = "https://api.galtea.ai/metrics/{id}"

payload = {
"id": "metric_123",
"parentMetricId": "metric_122",
"organizationId": "org_123",
"userId": "user_123",
"name": "Accuracy",
"evaluationParams": ["input", "actualOutput", "expectedOutput"],
"source": "PARTIAL_PROMPT",
"judgePrompt": "Evaluate the accuracy of the response",
"tags": ["accuracy", "quality"],
"description": "Measures the accuracy of responses",
"documentationUrl": "https://docs.example.com/metrics/accuracy",
"evaluatorModelName": "GPT-4",
"areEvalParamsTop": True,
"specificationIds": ["spec_123"],
"userGroupIds": ["ug_123"],
"createdAt": "2023-11-07T05:31:56Z",
"legacyAt": "2023-11-07T05:31:56Z",
"disabledAt": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: 'metric_123',
parentMetricId: 'metric_122',
organizationId: 'org_123',
userId: 'user_123',
name: 'Accuracy',
evaluationParams: ['input', 'actualOutput', 'expectedOutput'],
source: 'PARTIAL_PROMPT',
judgePrompt: 'Evaluate the accuracy of the response',
tags: ['accuracy', 'quality'],
description: 'Measures the accuracy of responses',
documentationUrl: 'https://docs.example.com/metrics/accuracy',
evaluatorModelName: 'GPT-4',
areEvalParamsTop: true,
specificationIds: ['spec_123'],
userGroupIds: ['ug_123'],
createdAt: '2023-11-07T05:31:56Z',
legacyAt: '2023-11-07T05:31:56Z',
disabledAt: '2023-11-07T05:31:56Z'
})
};

fetch('https://api.galtea.ai/metrics/{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.galtea.ai/metrics/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'id' => 'metric_123',
'parentMetricId' => 'metric_122',
'organizationId' => 'org_123',
'userId' => 'user_123',
'name' => 'Accuracy',
'evaluationParams' => [
'input',
'actualOutput',
'expectedOutput'
],
'source' => 'PARTIAL_PROMPT',
'judgePrompt' => 'Evaluate the accuracy of the response',
'tags' => [
'accuracy',
'quality'
],
'description' => 'Measures the accuracy of responses',
'documentationUrl' => 'https://docs.example.com/metrics/accuracy',
'evaluatorModelName' => 'GPT-4',
'areEvalParamsTop' => true,
'specificationIds' => [
'spec_123'
],
'userGroupIds' => [
'ug_123'
],
'createdAt' => '2023-11-07T05:31:56Z',
'legacyAt' => '2023-11-07T05:31:56Z',
'disabledAt' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

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

curl_close($curl);

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

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

func main() {

url := "https://api.galtea.ai/metrics/{id}"

payload := strings.NewReader("{\n \"id\": \"metric_123\",\n \"parentMetricId\": \"metric_122\",\n \"organizationId\": \"org_123\",\n \"userId\": \"user_123\",\n \"name\": \"Accuracy\",\n \"evaluationParams\": [\n \"input\",\n \"actualOutput\",\n \"expectedOutput\"\n ],\n \"source\": \"PARTIAL_PROMPT\",\n \"judgePrompt\": \"Evaluate the accuracy of the response\",\n \"tags\": [\n \"accuracy\",\n \"quality\"\n ],\n \"description\": \"Measures the accuracy of responses\",\n \"documentationUrl\": \"https://docs.example.com/metrics/accuracy\",\n \"evaluatorModelName\": \"GPT-4\",\n \"areEvalParamsTop\": true,\n \"specificationIds\": [\n \"spec_123\"\n ],\n \"userGroupIds\": [\n \"ug_123\"\n ],\n \"createdAt\": \"2023-11-07T05:31:56Z\",\n \"legacyAt\": \"2023-11-07T05:31:56Z\",\n \"disabledAt\": \"2023-11-07T05:31:56Z\"\n}")

req, _ := http.NewRequest("PATCH", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.patch("https://api.galtea.ai/metrics/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"metric_123\",\n \"parentMetricId\": \"metric_122\",\n \"organizationId\": \"org_123\",\n \"userId\": \"user_123\",\n \"name\": \"Accuracy\",\n \"evaluationParams\": [\n \"input\",\n \"actualOutput\",\n \"expectedOutput\"\n ],\n \"source\": \"PARTIAL_PROMPT\",\n \"judgePrompt\": \"Evaluate the accuracy of the response\",\n \"tags\": [\n \"accuracy\",\n \"quality\"\n ],\n \"description\": \"Measures the accuracy of responses\",\n \"documentationUrl\": \"https://docs.example.com/metrics/accuracy\",\n \"evaluatorModelName\": \"GPT-4\",\n \"areEvalParamsTop\": true,\n \"specificationIds\": [\n \"spec_123\"\n ],\n \"userGroupIds\": [\n \"ug_123\"\n ],\n \"createdAt\": \"2023-11-07T05:31:56Z\",\n \"legacyAt\": \"2023-11-07T05:31:56Z\",\n \"disabledAt\": \"2023-11-07T05:31:56Z\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.galtea.ai/metrics/{id}")

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"metric_123\",\n \"parentMetricId\": \"metric_122\",\n \"organizationId\": \"org_123\",\n \"userId\": \"user_123\",\n \"name\": \"Accuracy\",\n \"evaluationParams\": [\n \"input\",\n \"actualOutput\",\n \"expectedOutput\"\n ],\n \"source\": \"PARTIAL_PROMPT\",\n \"judgePrompt\": \"Evaluate the accuracy of the response\",\n \"tags\": [\n \"accuracy\",\n \"quality\"\n ],\n \"description\": \"Measures the accuracy of responses\",\n \"documentationUrl\": \"https://docs.example.com/metrics/accuracy\",\n \"evaluatorModelName\": \"GPT-4\",\n \"areEvalParamsTop\": true,\n \"specificationIds\": [\n \"spec_123\"\n ],\n \"userGroupIds\": [\n \"ug_123\"\n ],\n \"createdAt\": \"2023-11-07T05:31:56Z\",\n \"legacyAt\": \"2023-11-07T05:31:56Z\",\n \"disabledAt\": \"2023-11-07T05:31:56Z\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "metric_123",
  "metricGroupId": "metric_123",
  "parentMetricId": "metric_122",
  "organizationId": "org_123",
  "userId": "user_123",
  "name": "Accuracy",
  "evaluationParams": [
    "input",
    "actualOutput",
    "expectedOutput"
  ],
  "source": "PARTIAL_PROMPT",
  "judgePrompt": "Evaluate the accuracy of the response",
  "tags": [
    "accuracy",
    "quality"
  ],
  "description": "Measures the accuracy of responses",
  "documentationUrl": "https://docs.example.com/metrics/accuracy",
  "evaluatorModelName": "GPT-4",
  "areEvalParamsTop": true,
  "isBeingOptimized": true,
  "specificationIds": [
    "spec_123"
  ],
  "userGroupIds": [
    "ug_123"
  ],
  "createdAt": "2023-11-07T05:31:56Z",
  "legacyAt": "2023-11-07T05:31:56Z",
  "disabledAt": "2023-11-07T05:31:56Z"
}
{
"error": "Error type",
"message": "Error message description"
}
{
"error": "Error type",
"message": "Error message description"
}

Authorizations

Authorization
string
header
required

API key authorization. Pass your API key in the Authorization header as a Bearer token. Both new (gsk_*) and legacy (gsk-) API keys are accepted, e.g. Authorization: Bearer gsk_... or Authorization: Bearer gsk-....

Path Parameters

id
string
required

Metric ID

Body

application/json
id
string
Example:

"metric_123"

parentMetricId
string | null

Id of the direct parent metric. On create, providing this value turns the new metric into a revision: it joins the parent's family and (if the parent is active) flips the parent to legacy. Omit or null to create a root metric in a fresh group. On responses, this is the recorded parent edge (null for roots).

Example:

"metric_122"

organizationId
string | null
Example:

"org_123"

userId
string | null
Example:

"user_123"

name
string
Example:

"Accuracy"

evaluationParams
string[]

Ordered list of inference-result fields the evaluator needs (e.g. input, actualOutput, expectedOutput, retrievalContext). Determines which data the evaluation engine extracts from each inference result.

Example:
["input", "actualOutput", "expectedOutput"]
source
enum<string> | null

Evaluation method for the metric. FULL_PROMPT is deprecated for creation — POST /metrics rejects it with a 400. Use PARTIAL_PROMPT for new AI Evaluation metrics. The value remains in the enum because existing FULL_PROMPT metrics are still returned by reads and filters.

Available options:
SELF_HOSTED,
FULL_PROMPT,
PARTIAL_PROMPT,
HUMAN_EVALUATION,
GEVAL,
DEEPEVAL,
DETERMINISTIC
Example:

"PARTIAL_PROMPT"

judgePrompt
string | null
Example:

"Evaluate the accuracy of the response"

tags
string[]
Example:
["accuracy", "quality"]
description
string | null
Example:

"Measures the accuracy of responses"

documentationUrl
string | null
Example:

"https://docs.example.com/metrics/accuracy"

evaluatorModelName
string | null
Example:

"GPT-4"

areEvalParamsTop
boolean | null

When true, evaluationParams are injected at the top level of the evaluator prompt instead of nested inside the conversation context.

specificationIds
string[]
Example:
["spec_123"]
userGroupIds
string[]
Example:
["ug_123"]
createdAt
string<date-time>
legacyAt
string<date-time> | null
disabledAt
string<date-time> | null

Response

Metric updated successfully

id
string
Example:

"metric_123"

metricGroupId
string
read-only

Identifier shared by every metric in the same revision family. Server-managed — derived from parentMetricId on create (or generated for roots). Cannot be set by the caller.

Example:

"metric_123"

parentMetricId
string | null

Id of the direct parent metric. On create, providing this value turns the new metric into a revision: it joins the parent's family and (if the parent is active) flips the parent to legacy. Omit or null to create a root metric in a fresh group. On responses, this is the recorded parent edge (null for roots).

Example:

"metric_122"

organizationId
string | null
Example:

"org_123"

userId
string | null
Example:

"user_123"

name
string
Example:

"Accuracy"

evaluationParams
string[]

Ordered list of inference-result fields the evaluator needs (e.g. input, actualOutput, expectedOutput, retrievalContext). Determines which data the evaluation engine extracts from each inference result.

Example:
["input", "actualOutput", "expectedOutput"]
source
enum<string> | null

Evaluation method for the metric. FULL_PROMPT is deprecated for creation — POST /metrics rejects it with a 400. Use PARTIAL_PROMPT for new AI Evaluation metrics. The value remains in the enum because existing FULL_PROMPT metrics are still returned by reads and filters.

Available options:
SELF_HOSTED,
FULL_PROMPT,
PARTIAL_PROMPT,
HUMAN_EVALUATION,
GEVAL,
DEEPEVAL,
DETERMINISTIC
Example:

"PARTIAL_PROMPT"

judgePrompt
string | null
Example:

"Evaluate the accuracy of the response"

tags
string[]
Example:
["accuracy", "quality"]
description
string | null
Example:

"Measures the accuracy of responses"

documentationUrl
string | null
Example:

"https://docs.example.com/metrics/accuracy"

evaluatorModelName
string | null
Example:

"GPT-4"

areEvalParamsTop
boolean | null

When true, evaluationParams are injected at the top level of the evaluator prompt instead of nested inside the conversation context.

isBeingOptimized
boolean
read-only

Whether the metric is currently being optimized.

specificationIds
string[]
Example:
["spec_123"]
userGroupIds
string[]
Example:
["ug_123"]
createdAt
string<date-time>
legacyAt
string<date-time> | null
disabledAt
string<date-time> | null