Skip to content

Preview

POST
/users/{user_id}/metric-definitions/preview
curl --request POST \
--url https://example.com/users/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/metric-definitions/preview \
--header 'Content-Type: application/json' \
--data '{ "days": 7, "manual_fallback": true, "metric_type_slug": "example", "resolution_operator": "priority", "sources": [] }'
user_id
required
User Id
string format: uuid
Media typeapplication/json
PreviewRequest
object
days
Days
integer
default: 7
manual_fallback
Manual Fallback
boolean
default: true
metric_type_slug
required
Metric Type Slug
string
resolution_operator
required
Resolution Operator
string
Allowed values: priority average median lowest highest sum latest
sources
Sources
Array<object>
default:
SourceSpec

A source feeding a metric, in rank order. condition is an optional queue-jump, e.g. {"type": "prefer_if_present"} = prefer this source whenever it reports.

object
condition
Any of:
object
key
additional properties
any
source
required
Source
string

Successful Response

Media typeapplication/json
Response Preview Users User Id Metric Definitions Preview Post
Array<object>
PreviewDayRead
object
date
required
Date
string format: date
manual_fallback_used
required
Manual Fallback Used
boolean
value
required
Any of:
number
winning_source
required
Any of:
string
Examplegenerated
[
{
"date": "2026-04-15",
"manual_fallback_used": true,
"value": 1,
"winning_source": "example"
}
]

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Examplegenerated
{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
]
}