Update conversation metrics config
curl --request PATCH \
--url https://api.coval.dev/v1/organization/conversation-metrics \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"default_conversation_metrics": [
"8EktrIgaVxn9LfxkIynagX"
],
"conditional_conversation_metrics": [
{
"id": "rule-voice",
"type": "RUN_METADATA",
"metadata_key": "channel",
"metadata_type": "STRING",
"match_type": "EQUALS",
"metadata_value": "voice",
"metric": "8EktrIgaVxn9LfxkIynagX",
"metrics": [
"8EktrIgaVxn9LfxkIynagX"
]
}
]
}
'import requests
url = "https://api.coval.dev/v1/organization/conversation-metrics"
payload = {
"default_conversation_metrics": ["8EktrIgaVxn9LfxkIynagX"],
"conditional_conversation_metrics": [
{
"id": "rule-voice",
"type": "RUN_METADATA",
"metadata_key": "channel",
"metadata_type": "STRING",
"match_type": "EQUALS",
"metadata_value": "voice",
"metric": "8EktrIgaVxn9LfxkIynagX",
"metrics": ["8EktrIgaVxn9LfxkIynagX"]
}
]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
default_conversation_metrics: ['8EktrIgaVxn9LfxkIynagX'],
conditional_conversation_metrics: [
{
id: 'rule-voice',
type: 'RUN_METADATA',
metadata_key: 'channel',
metadata_type: 'STRING',
match_type: 'EQUALS',
metadata_value: 'voice',
metric: '8EktrIgaVxn9LfxkIynagX',
metrics: ['8EktrIgaVxn9LfxkIynagX']
}
]
})
};
fetch('https://api.coval.dev/v1/organization/conversation-metrics', 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/organization/conversation-metrics",
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([
'default_conversation_metrics' => [
'8EktrIgaVxn9LfxkIynagX'
],
'conditional_conversation_metrics' => [
[
'id' => 'rule-voice',
'type' => 'RUN_METADATA',
'metadata_key' => 'channel',
'metadata_type' => 'STRING',
'match_type' => 'EQUALS',
'metadata_value' => 'voice',
'metric' => '8EktrIgaVxn9LfxkIynagX',
'metrics' => [
'8EktrIgaVxn9LfxkIynagX'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.coval.dev/v1/organization/conversation-metrics"
payload := strings.NewReader("{\n \"default_conversation_metrics\": [\n \"8EktrIgaVxn9LfxkIynagX\"\n ],\n \"conditional_conversation_metrics\": [\n {\n \"id\": \"rule-voice\",\n \"type\": \"RUN_METADATA\",\n \"metadata_key\": \"channel\",\n \"metadata_type\": \"STRING\",\n \"match_type\": \"EQUALS\",\n \"metadata_value\": \"voice\",\n \"metric\": \"8EktrIgaVxn9LfxkIynagX\",\n \"metrics\": [\n \"8EktrIgaVxn9LfxkIynagX\"\n ]\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.coval.dev/v1/organization/conversation-metrics")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"default_conversation_metrics\": [\n \"8EktrIgaVxn9LfxkIynagX\"\n ],\n \"conditional_conversation_metrics\": [\n {\n \"id\": \"rule-voice\",\n \"type\": \"RUN_METADATA\",\n \"metadata_key\": \"channel\",\n \"metadata_type\": \"STRING\",\n \"match_type\": \"EQUALS\",\n \"metadata_value\": \"voice\",\n \"metric\": \"8EktrIgaVxn9LfxkIynagX\",\n \"metrics\": [\n \"8EktrIgaVxn9LfxkIynagX\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coval.dev/v1/organization/conversation-metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"default_conversation_metrics\": [\n \"8EktrIgaVxn9LfxkIynagX\"\n ],\n \"conditional_conversation_metrics\": [\n {\n \"id\": \"rule-voice\",\n \"type\": \"RUN_METADATA\",\n \"metadata_key\": \"channel\",\n \"metadata_type\": \"STRING\",\n \"match_type\": \"EQUALS\",\n \"metadata_value\": \"voice\",\n \"metric\": \"8EktrIgaVxn9LfxkIynagX\",\n \"metrics\": [\n \"8EktrIgaVxn9LfxkIynagX\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"default_conversation_metrics": [
"8EktrIgaVxn9LfxkIynagX"
],
"conditional_conversation_metrics": [
{
"id": "rule-voice",
"type": "RUN_METADATA",
"metadata_key": "channel",
"metadata_type": "STRING",
"match_type": "EQUALS",
"metadata_value": "voice",
"metric": "8EktrIgaVxn9LfxkIynagX",
"metrics": [
"8EktrIgaVxn9LfxkIynagX"
]
}
]
}{
"error": {
"code": "INVALID_ARGUMENT",
"message": "Invalid request body",
"details": [
{
"field": "conditional_conversation_metrics",
"description": "Provide exactly one of 'metric' or 'metrics'."
}
]
}
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Authentication failed",
"details": [
{
"field": "x-api-key",
"description": "API key is required in the x-api-key header"
}
]
}
}{
"error": {
"code": "PERMISSION_DENIED",
"message": "Insufficient permissions",
"details": [
{
"field": "permissions",
"description": "The API key does not include the required organization permission."
}
]
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Organization not found",
"details": [
{
"description": "Organization not found."
}
]
}
}{
"error": {
"code": "INTERNAL",
"message": "Internal server error",
"details": [
{
"description": "An unexpected error occurred while processing the organization request"
}
]
}
}Conversations Config
Update conversation metrics config
Partially update the selected workspace’s conversation metrics configuration. Every resolved workspace stores its own configuration and must be active. Provide at least one of default_conversation_metrics or conditional_conversation_metrics; each field provided fully replaces the stored value (a field omitted is left unchanged). Returns the full resulting configuration using current metric IDs. Supplied fields persist those IDs and deduplicate equivalent selections. Unavailable metrics remain invalid selections.
PATCH
/
organization
/
conversation-metrics
Update conversation metrics config
curl --request PATCH \
--url https://api.coval.dev/v1/organization/conversation-metrics \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"default_conversation_metrics": [
"8EktrIgaVxn9LfxkIynagX"
],
"conditional_conversation_metrics": [
{
"id": "rule-voice",
"type": "RUN_METADATA",
"metadata_key": "channel",
"metadata_type": "STRING",
"match_type": "EQUALS",
"metadata_value": "voice",
"metric": "8EktrIgaVxn9LfxkIynagX",
"metrics": [
"8EktrIgaVxn9LfxkIynagX"
]
}
]
}
'import requests
url = "https://api.coval.dev/v1/organization/conversation-metrics"
payload = {
"default_conversation_metrics": ["8EktrIgaVxn9LfxkIynagX"],
"conditional_conversation_metrics": [
{
"id": "rule-voice",
"type": "RUN_METADATA",
"metadata_key": "channel",
"metadata_type": "STRING",
"match_type": "EQUALS",
"metadata_value": "voice",
"metric": "8EktrIgaVxn9LfxkIynagX",
"metrics": ["8EktrIgaVxn9LfxkIynagX"]
}
]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
default_conversation_metrics: ['8EktrIgaVxn9LfxkIynagX'],
conditional_conversation_metrics: [
{
id: 'rule-voice',
type: 'RUN_METADATA',
metadata_key: 'channel',
metadata_type: 'STRING',
match_type: 'EQUALS',
metadata_value: 'voice',
metric: '8EktrIgaVxn9LfxkIynagX',
metrics: ['8EktrIgaVxn9LfxkIynagX']
}
]
})
};
fetch('https://api.coval.dev/v1/organization/conversation-metrics', 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/organization/conversation-metrics",
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([
'default_conversation_metrics' => [
'8EktrIgaVxn9LfxkIynagX'
],
'conditional_conversation_metrics' => [
[
'id' => 'rule-voice',
'type' => 'RUN_METADATA',
'metadata_key' => 'channel',
'metadata_type' => 'STRING',
'match_type' => 'EQUALS',
'metadata_value' => 'voice',
'metric' => '8EktrIgaVxn9LfxkIynagX',
'metrics' => [
'8EktrIgaVxn9LfxkIynagX'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.coval.dev/v1/organization/conversation-metrics"
payload := strings.NewReader("{\n \"default_conversation_metrics\": [\n \"8EktrIgaVxn9LfxkIynagX\"\n ],\n \"conditional_conversation_metrics\": [\n {\n \"id\": \"rule-voice\",\n \"type\": \"RUN_METADATA\",\n \"metadata_key\": \"channel\",\n \"metadata_type\": \"STRING\",\n \"match_type\": \"EQUALS\",\n \"metadata_value\": \"voice\",\n \"metric\": \"8EktrIgaVxn9LfxkIynagX\",\n \"metrics\": [\n \"8EktrIgaVxn9LfxkIynagX\"\n ]\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.coval.dev/v1/organization/conversation-metrics")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"default_conversation_metrics\": [\n \"8EktrIgaVxn9LfxkIynagX\"\n ],\n \"conditional_conversation_metrics\": [\n {\n \"id\": \"rule-voice\",\n \"type\": \"RUN_METADATA\",\n \"metadata_key\": \"channel\",\n \"metadata_type\": \"STRING\",\n \"match_type\": \"EQUALS\",\n \"metadata_value\": \"voice\",\n \"metric\": \"8EktrIgaVxn9LfxkIynagX\",\n \"metrics\": [\n \"8EktrIgaVxn9LfxkIynagX\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coval.dev/v1/organization/conversation-metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"default_conversation_metrics\": [\n \"8EktrIgaVxn9LfxkIynagX\"\n ],\n \"conditional_conversation_metrics\": [\n {\n \"id\": \"rule-voice\",\n \"type\": \"RUN_METADATA\",\n \"metadata_key\": \"channel\",\n \"metadata_type\": \"STRING\",\n \"match_type\": \"EQUALS\",\n \"metadata_value\": \"voice\",\n \"metric\": \"8EktrIgaVxn9LfxkIynagX\",\n \"metrics\": [\n \"8EktrIgaVxn9LfxkIynagX\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"default_conversation_metrics": [
"8EktrIgaVxn9LfxkIynagX"
],
"conditional_conversation_metrics": [
{
"id": "rule-voice",
"type": "RUN_METADATA",
"metadata_key": "channel",
"metadata_type": "STRING",
"match_type": "EQUALS",
"metadata_value": "voice",
"metric": "8EktrIgaVxn9LfxkIynagX",
"metrics": [
"8EktrIgaVxn9LfxkIynagX"
]
}
]
}{
"error": {
"code": "INVALID_ARGUMENT",
"message": "Invalid request body",
"details": [
{
"field": "conditional_conversation_metrics",
"description": "Provide exactly one of 'metric' or 'metrics'."
}
]
}
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Authentication failed",
"details": [
{
"field": "x-api-key",
"description": "API key is required in the x-api-key header"
}
]
}
}{
"error": {
"code": "PERMISSION_DENIED",
"message": "Insufficient permissions",
"details": [
{
"field": "permissions",
"description": "The API key does not include the required organization permission."
}
]
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Organization not found",
"details": [
{
"description": "Organization not found."
}
]
}
}{
"error": {
"code": "INTERNAL",
"message": "Internal server error",
"details": [
{
"description": "An unexpected error occurred while processing the organization request"
}
]
}
}Headers
Body
application/json
Partial update. Provide at least one of default_conversation_metrics or conditional_conversation_metrics; each field provided fully replaces the stored value.
Response
Configuration updated
Was this page helpful?