Metric
Create Metric
POST
/
api
/
metric
/
create
cURL
curl --request POST \
--url https://eu.whitecircle.com/api/metric/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'whitecircle-version: <whitecircle-version>' \
--data '
{
"name": "<string>",
"flagged_content": "<string>",
"allowed_content": "<string>",
"content_type": "session",
"event_selector_list": [
{
"field": "<string>",
"kind": "<string>"
}
],
"role_list": [],
"applies_to": "input",
"mode": "prod",
"rollout_percentage": 123,
"country_codes": [
"<string>"
],
"severity_level_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://eu.whitecircle.com/api/metric/create"
payload = {
"name": "<string>",
"flagged_content": "<string>",
"allowed_content": "<string>",
"content_type": "session",
"event_selector_list": [
{
"field": "<string>",
"kind": "<string>"
}
],
"role_list": [],
"applies_to": "input",
"mode": "prod",
"rollout_percentage": 123,
"country_codes": ["<string>"],
"severity_level_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"whitecircle-version": "<whitecircle-version>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'whitecircle-version': '<whitecircle-version>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
flagged_content: '<string>',
allowed_content: '<string>',
content_type: 'session',
event_selector_list: [{field: '<string>', kind: '<string>'}],
role_list: [],
applies_to: 'input',
mode: 'prod',
rollout_percentage: 123,
country_codes: ['<string>'],
severity_level_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://eu.whitecircle.com/api/metric/create', 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://eu.whitecircle.com/api/metric/create",
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([
'name' => '<string>',
'flagged_content' => '<string>',
'allowed_content' => '<string>',
'content_type' => 'session',
'event_selector_list' => [
[
'field' => '<string>',
'kind' => '<string>'
]
],
'role_list' => [
],
'applies_to' => 'input',
'mode' => 'prod',
'rollout_percentage' => 123,
'country_codes' => [
'<string>'
],
'severity_level_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"whitecircle-version: <whitecircle-version>"
],
]);
$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://eu.whitecircle.com/api/metric/create"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"flagged_content\": \"<string>\",\n \"allowed_content\": \"<string>\",\n \"content_type\": \"session\",\n \"event_selector_list\": [\n {\n \"field\": \"<string>\",\n \"kind\": \"<string>\"\n }\n ],\n \"role_list\": [],\n \"applies_to\": \"input\",\n \"mode\": \"prod\",\n \"rollout_percentage\": 123,\n \"country_codes\": [\n \"<string>\"\n ],\n \"severity_level_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("whitecircle-version", "<whitecircle-version>")
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://eu.whitecircle.com/api/metric/create")
.header("whitecircle-version", "<whitecircle-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"flagged_content\": \"<string>\",\n \"allowed_content\": \"<string>\",\n \"content_type\": \"session\",\n \"event_selector_list\": [\n {\n \"field\": \"<string>\",\n \"kind\": \"<string>\"\n }\n ],\n \"role_list\": [],\n \"applies_to\": \"input\",\n \"mode\": \"prod\",\n \"rollout_percentage\": 123,\n \"country_codes\": [\n \"<string>\"\n ],\n \"severity_level_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://eu.whitecircle.com/api/metric/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["whitecircle-version"] = '<whitecircle-version>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"flagged_content\": \"<string>\",\n \"allowed_content\": \"<string>\",\n \"content_type\": \"session\",\n \"event_selector_list\": [\n {\n \"field\": \"<string>\",\n \"kind\": \"<string>\"\n }\n ],\n \"role_list\": [],\n \"applies_to\": \"input\",\n \"mode\": \"prod\",\n \"rollout_percentage\": 123,\n \"country_codes\": [\n \"<string>\"\n ],\n \"severity_level_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"flagged_content": "<string>",
"content_type": "session",
"event_selector_list": [
{
"type": "message",
"field": "<string>",
"kind": "<string>"
}
],
"role_list": [
"user"
],
"applies_to": "input",
"mode": "prod",
"rollout_percentage": 1,
"created_at": "2023-11-07T05:31:56Z",
"state": "active",
"country_codes": [
"<string>"
],
"allowed_content": "<string>",
"severity_level_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}Create a new Metric and attach it to one or more Conditions.
This endpoint is available only for API version
2026-06-01. Send the whitecircle-version: 2026-06-01 header.To create a Policy instead of a Metric, use the
/api/policy/create endpoint.Authorizations
API Key required. Format: Bearer wc-your-api-key
Headers
API Version
Body
application/json
Available options:
session, artifact, any Example:
"session"
Role restriction used by the new policy targeting model. Empty role lists mean any role.
Available options:
user, assistant Available options:
input, output, any Example:
"input"
Available options:
prod, shadow Example:
"prod"
Response
Success
Available options:
session, artifact, any Example:
"session"
Role restriction used by the new policy targeting model. Empty role lists mean any role.
Available options:
user, assistant Available options:
input, output, any Example:
"input"
Available options:
prod, shadow Example:
"prod"
Required range:
x >= 0Available options:
active, inactive, draft Example:
"active"
⌘I
cURL
curl --request POST \
--url https://eu.whitecircle.com/api/metric/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'whitecircle-version: <whitecircle-version>' \
--data '
{
"name": "<string>",
"flagged_content": "<string>",
"allowed_content": "<string>",
"content_type": "session",
"event_selector_list": [
{
"field": "<string>",
"kind": "<string>"
}
],
"role_list": [],
"applies_to": "input",
"mode": "prod",
"rollout_percentage": 123,
"country_codes": [
"<string>"
],
"severity_level_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://eu.whitecircle.com/api/metric/create"
payload = {
"name": "<string>",
"flagged_content": "<string>",
"allowed_content": "<string>",
"content_type": "session",
"event_selector_list": [
{
"field": "<string>",
"kind": "<string>"
}
],
"role_list": [],
"applies_to": "input",
"mode": "prod",
"rollout_percentage": 123,
"country_codes": ["<string>"],
"severity_level_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"whitecircle-version": "<whitecircle-version>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'whitecircle-version': '<whitecircle-version>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
flagged_content: '<string>',
allowed_content: '<string>',
content_type: 'session',
event_selector_list: [{field: '<string>', kind: '<string>'}],
role_list: [],
applies_to: 'input',
mode: 'prod',
rollout_percentage: 123,
country_codes: ['<string>'],
severity_level_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://eu.whitecircle.com/api/metric/create', 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://eu.whitecircle.com/api/metric/create",
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([
'name' => '<string>',
'flagged_content' => '<string>',
'allowed_content' => '<string>',
'content_type' => 'session',
'event_selector_list' => [
[
'field' => '<string>',
'kind' => '<string>'
]
],
'role_list' => [
],
'applies_to' => 'input',
'mode' => 'prod',
'rollout_percentage' => 123,
'country_codes' => [
'<string>'
],
'severity_level_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"whitecircle-version: <whitecircle-version>"
],
]);
$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://eu.whitecircle.com/api/metric/create"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"flagged_content\": \"<string>\",\n \"allowed_content\": \"<string>\",\n \"content_type\": \"session\",\n \"event_selector_list\": [\n {\n \"field\": \"<string>\",\n \"kind\": \"<string>\"\n }\n ],\n \"role_list\": [],\n \"applies_to\": \"input\",\n \"mode\": \"prod\",\n \"rollout_percentage\": 123,\n \"country_codes\": [\n \"<string>\"\n ],\n \"severity_level_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("whitecircle-version", "<whitecircle-version>")
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://eu.whitecircle.com/api/metric/create")
.header("whitecircle-version", "<whitecircle-version>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"flagged_content\": \"<string>\",\n \"allowed_content\": \"<string>\",\n \"content_type\": \"session\",\n \"event_selector_list\": [\n {\n \"field\": \"<string>\",\n \"kind\": \"<string>\"\n }\n ],\n \"role_list\": [],\n \"applies_to\": \"input\",\n \"mode\": \"prod\",\n \"rollout_percentage\": 123,\n \"country_codes\": [\n \"<string>\"\n ],\n \"severity_level_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://eu.whitecircle.com/api/metric/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["whitecircle-version"] = '<whitecircle-version>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"flagged_content\": \"<string>\",\n \"allowed_content\": \"<string>\",\n \"content_type\": \"session\",\n \"event_selector_list\": [\n {\n \"field\": \"<string>\",\n \"kind\": \"<string>\"\n }\n ],\n \"role_list\": [],\n \"applies_to\": \"input\",\n \"mode\": \"prod\",\n \"rollout_percentage\": 123,\n \"country_codes\": [\n \"<string>\"\n ],\n \"severity_level_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"flagged_content": "<string>",
"content_type": "session",
"event_selector_list": [
{
"type": "message",
"field": "<string>",
"kind": "<string>"
}
],
"role_list": [
"user"
],
"applies_to": "input",
"mode": "prod",
"rollout_percentage": 1,
"created_at": "2023-11-07T05:31:56Z",
"state": "active",
"country_codes": [
"<string>"
],
"allowed_content": "<string>",
"severity_level_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}