curl --request PATCH \
--url https://api.coval.dev/v1/metrics/{metric_id}/threshold \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"comparison_operator": "gte",
"target_float_upper": 0.9,
"source": "manual"
}
'{
"threshold": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"id": "01JCQR8Z9PQSTNVWXY12AB34CD",
"name": "metrics/abc123def456ghi789jklm/threshold",
"comparison_operator": "eq",
"target_float_upper": 0.8,
"target_float_lower": 123,
"target_values": [
"<string>"
],
"source": "manual",
"create_time": "2023-11-07T05:31:56Z",
"update_time": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "INVALID_ARGUMENT",
"message": "<string>",
"details": [
{
"field": "<string>",
"description": "<string>"
}
]
}
}{
"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": "INVALID_ARGUMENT",
"message": "<string>",
"details": [
{
"field": "<string>",
"description": "<string>"
}
]
}
}{
"error": {
"code": "INTERNAL",
"message": "Internal server error"
}
}Thresholds
Update metric threshold
Update the threshold for a specific metric.
Send comparison_operator: null to clear the threshold.
PATCH
/
metrics
/
{metric_id}
/
threshold
curl --request PATCH \
--url https://api.coval.dev/v1/metrics/{metric_id}/threshold \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"comparison_operator": "gte",
"target_float_upper": 0.9,
"source": "manual"
}
'{
"threshold": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"id": "01JCQR8Z9PQSTNVWXY12AB34CD",
"name": "metrics/abc123def456ghi789jklm/threshold",
"comparison_operator": "eq",
"target_float_upper": 0.8,
"target_float_lower": 123,
"target_values": [
"<string>"
],
"source": "manual",
"create_time": "2023-11-07T05:31:56Z",
"update_time": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "INVALID_ARGUMENT",
"message": "<string>",
"details": [
{
"field": "<string>",
"description": "<string>"
}
]
}
}{
"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": "INVALID_ARGUMENT",
"message": "<string>",
"details": [
{
"field": "<string>",
"description": "<string>"
}
]
}
}{
"error": {
"code": "INTERNAL",
"message": "Internal server error"
}
}Authorizations
API key for authentication
Path Parameters
22-character metric ID
Pattern:
^[a-zA-Z0-9]{22}$Body
application/json
Request body for updating a threshold. Send comparison_operator: null to clear the threshold.
Comparison operator (send null to clear the threshold)
Available options:
eq, neq, gt, gte, lt, lte, in, nin, bt, nbt Target float value (upper bound for bt/nbt, single value for others)
Lower bound for range operators (bt/nbt)
Target values for list operators (in/nin)
Required array length:
1 - 50 elementsSource of the threshold value
Available options:
manual, model Response
Threshold updated successfully
Org-specific threshold for a metric
Show child attributes
Show child attributes
Was this page helpful?