Skip to main content
POST
/
v1
/
metrics
/
{metric_id}
/
versions
Create a new metric version
curl --request POST \
  --url https://api.honeyhive.ai/v1/metrics/{metric_id}/versions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "message": "<string>",
  "content": {
    "name": "<string>",
    "criteria": "<string>",
    "description": "",
    "return_type": "float",
    "enabled_in_prod": false,
    "needs_ground_truth": false,
    "sampling_percentage": 10,
    "model_provider": "<string>",
    "model_name": "<string>",
    "scale": 123,
    "threshold": {
      "min": 123,
      "max": 123,
      "pass_when": true,
      "passing_categories": [
        "<string>"
      ]
    },
    "categories": [
      {
        "category": "<string>",
        "score": 123
      }
    ],
    "child_metrics": [
      {
        "name": "<string>",
        "weight": 123,
        "id": "<string>",
        "scale": 123
      }
    ],
    "filters": {
      "filterArray": []
    }
  },
  "deploy_immediately": true
}
'
import requests

url = "https://api.honeyhive.ai/v1/metrics/{metric_id}/versions"

payload = {
"message": "<string>",
"content": {
"name": "<string>",
"criteria": "<string>",
"description": "",
"return_type": "float",
"enabled_in_prod": False,
"needs_ground_truth": False,
"sampling_percentage": 10,
"model_provider": "<string>",
"model_name": "<string>",
"scale": 123,
"threshold": {
"min": 123,
"max": 123,
"pass_when": True,
"passing_categories": ["<string>"]
},
"categories": [
{
"category": "<string>",
"score": 123
}
],
"child_metrics": [
{
"name": "<string>",
"weight": 123,
"id": "<string>",
"scale": 123
}
],
"filters": { "filterArray": [] }
},
"deploy_immediately": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
message: '<string>',
content: {
name: '<string>',
criteria: '<string>',
description: '',
return_type: 'float',
enabled_in_prod: false,
needs_ground_truth: false,
sampling_percentage: 10,
model_provider: '<string>',
model_name: '<string>',
scale: 123,
threshold: {min: 123, max: 123, pass_when: true, passing_categories: ['<string>']},
categories: [{category: '<string>', score: 123}],
child_metrics: [{name: '<string>', weight: 123, id: '<string>', scale: 123}],
filters: {filterArray: []}
},
deploy_immediately: true
})
};

fetch('https://api.honeyhive.ai/v1/metrics/{metric_id}/versions', 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.honeyhive.ai/v1/metrics/{metric_id}/versions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'message' => '<string>',
'content' => [
'name' => '<string>',
'criteria' => '<string>',
'description' => '',
'return_type' => 'float',
'enabled_in_prod' => false,
'needs_ground_truth' => false,
'sampling_percentage' => 10,
'model_provider' => '<string>',
'model_name' => '<string>',
'scale' => 123,
'threshold' => [
'min' => 123,
'max' => 123,
'pass_when' => true,
'passing_categories' => [
'<string>'
]
],
'categories' => [
[
'category' => '<string>',
'score' => 123
]
],
'child_metrics' => [
[
'name' => '<string>',
'weight' => 123,
'id' => '<string>',
'scale' => 123
]
],
'filters' => [
'filterArray' => [

]
]
],
'deploy_immediately' => true
]),
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.honeyhive.ai/v1/metrics/{metric_id}/versions"

payload := strings.NewReader("{\n \"message\": \"<string>\",\n \"content\": {\n \"name\": \"<string>\",\n \"criteria\": \"<string>\",\n \"description\": \"\",\n \"return_type\": \"float\",\n \"enabled_in_prod\": false,\n \"needs_ground_truth\": false,\n \"sampling_percentage\": 10,\n \"model_provider\": \"<string>\",\n \"model_name\": \"<string>\",\n \"scale\": 123,\n \"threshold\": {\n \"min\": 123,\n \"max\": 123,\n \"pass_when\": true,\n \"passing_categories\": [\n \"<string>\"\n ]\n },\n \"categories\": [\n {\n \"category\": \"<string>\",\n \"score\": 123\n }\n ],\n \"child_metrics\": [\n {\n \"name\": \"<string>\",\n \"weight\": 123,\n \"id\": \"<string>\",\n \"scale\": 123\n }\n ],\n \"filters\": {\n \"filterArray\": []\n }\n },\n \"deploy_immediately\": true\n}")

req, _ := http.NewRequest("POST", 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.post("https://api.honeyhive.ai/v1/metrics/{metric_id}/versions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"content\": {\n \"name\": \"<string>\",\n \"criteria\": \"<string>\",\n \"description\": \"\",\n \"return_type\": \"float\",\n \"enabled_in_prod\": false,\n \"needs_ground_truth\": false,\n \"sampling_percentage\": 10,\n \"model_provider\": \"<string>\",\n \"model_name\": \"<string>\",\n \"scale\": 123,\n \"threshold\": {\n \"min\": 123,\n \"max\": 123,\n \"pass_when\": true,\n \"passing_categories\": [\n \"<string>\"\n ]\n },\n \"categories\": [\n {\n \"category\": \"<string>\",\n \"score\": 123\n }\n ],\n \"child_metrics\": [\n {\n \"name\": \"<string>\",\n \"weight\": 123,\n \"id\": \"<string>\",\n \"scale\": 123\n }\n ],\n \"filters\": {\n \"filterArray\": []\n }\n },\n \"deploy_immediately\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.honeyhive.ai/v1/metrics/{metric_id}/versions")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"<string>\",\n \"content\": {\n \"name\": \"<string>\",\n \"criteria\": \"<string>\",\n \"description\": \"\",\n \"return_type\": \"float\",\n \"enabled_in_prod\": false,\n \"needs_ground_truth\": false,\n \"sampling_percentage\": 10,\n \"model_provider\": \"<string>\",\n \"model_name\": \"<string>\",\n \"scale\": 123,\n \"threshold\": {\n \"min\": 123,\n \"max\": 123,\n \"pass_when\": true,\n \"passing_categories\": [\n \"<string>\"\n ]\n },\n \"categories\": [\n {\n \"category\": \"<string>\",\n \"score\": 123\n }\n ],\n \"child_metrics\": [\n {\n \"name\": \"<string>\",\n \"weight\": 123,\n \"id\": \"<string>\",\n \"scale\": 123\n }\n ],\n \"filters\": {\n \"filterArray\": []\n }\n },\n \"deploy_immediately\": true\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "data": {
    "name": "<string>",
    "full_sha": "<string>",
    "message": "<string>",
    "date": "2023-11-07T05:31:56Z",
    "deployed": true,
    "content": {
      "name": "<string>",
      "criteria": "<string>",
      "description": "<string>",
      "enabled_in_prod": true,
      "needs_ground_truth": true,
      "sampling_percentage": 50,
      "filters": {
        "filterArray": [
          {
            "field": "<string>",
            "value": "<string>"
          }
        ]
      },
      "model_provider": "<string>",
      "model_name": "<string>",
      "scale": 123,
      "threshold": {
        "min": 123,
        "max": 123,
        "pass_when": true,
        "passing_categories": [
          "<string>"
        ]
      },
      "categories": [
        {
          "category": "<string>",
          "score": 123
        }
      ],
      "child_metrics": [
        {
          "name": "<string>",
          "weight": 123,
          "id": "<string>",
          "scale": 123
        }
      ]
    }
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

metric_id
string
required

The unique identifier of the metric to version

Body

application/json

Request body for POST /v1/metrics/{metric_id}/versions

message
string
required
content
object
required

Metric definition snapshot accepted by POST /v1/metrics/{metric_id}/versions. Six fields are optional and fall back to server-side defaults when omitted:

  • description""
  • return_type"float"
  • enabled_in_prodtrue for HUMAN metrics, false otherwise
  • needs_ground_truthfalse
  • sampling_percentage10
  • filters{ "filterArray": [] }
deploy_immediately
boolean

Response

Metric version created successfully

Response for POST /v1/metrics/{metric_id}/versions

success
enum<boolean>
required
Available options:
true
data
object
required

A versioned snapshot of a metric definition.