Query Ad-hoc Widget Data
POSThttps://api.confident-ai.com/v1/widgets/query
Computes widget data from a widget definition supplied inline, without creating a dashboard or saving a widget. Returns the same data shape as the dashboard widget query. Scoped to the project of the API key. At most 20 lines and a topK.limit of 100 are allowed, and an explicit query range may not exceed 366 days.
curl -X POST "https://api.confident-ai.com/v1/widgets/query" \
-H "Content-Type: application/json" \
-d '{
"widget": {
"name": "Trace Count",
"type": "LINE",
"unit": "COUNT",
"mode": "TIME_SERIES",
"lines": [
{
"name": "Count",
"dataModel": "TRACE",
"aggregation": "COUNT"
}
]
},
"startTime": "2024-01-01T00:00:00.000Z",
"endTime": "2024-01-31T23:59:59.999Z",
"granularity": "day"
}'{
"success": true,
"data": {
"type": "LINE",
"mode": "TIME_SERIES",
"kind": "TIME_SERIES",
"unit": "COUNT",
"xAxis": {
"type": "time"
},
"series": [
{
"key": "Count",
"name": "Count",
"color": "BLUE",
"lineId": "line-0",
"points": [
{
"x": "2024-01-01T00:00:00.000Z",
"y": 42
}
]
}
]
},
"deprecated": false
}Request body
widgetobjectRequiredThe widget configuration to compute data for.
Show 12 propertiesHide 12 properties
namestringRequiredThe widget's name.
descriptionstringAn optional description of the widget.
typeenumThe visualization type of a widget.
Show 6 enum valuesHide 6 enum values
LINEAREABARSTACKED_BARTABLEBIG_NUMBER
unitenumThe unit a widget's values are measured in.
Show 6 enum valuesHide 6 enum values
COUNTPERCENTSCORESECONDSUSDMILLISECONDS
modeenumHow a widget aggregates its lines.
TIME_SERIESplots each configured line over time;DIMENSION_SERIEStakes a single metric and splits it into one series per value of the widget's dimension. This is the widget's saved configuration — it does not by itself describe the shape of a query response (usekindon the query result for that).Show 2 enum valuesHide 2 enum values
TIME_SERIESDIMENSION_SERIES
bucketModeenumHow a widget's data is bucketed over the query time range.
SERIESsplits the range into one bucket pergranularityinterval (a time series);RANGEaggregates the whole range into a single bucket (one total, as used by BIG_NUMBER widgets). Defaults toSERIESwhen omitted.Show 2 enum valuesHide 2 enum values
SERIESRANGE
dimensionenumThe dimension a widget breaks down by when mode is DIMENSION_SERIES.
Show 22 enum valuesHide 22 enum values
projecttrace_namespan_namemodeltypethread_idtest_case_idtest_run_idend_usersourceannotatornameerrorprompt_aliastaglabelevaluation_modelprompt_versionprompt_labelprompt_commit_hashmetadataclassifier
topKobjectLimits a dimension breakdown to the top K series.
Show 3 propertiesHide 3 properties
limitintegerMaximum number of series to return. Defaults to 10.
orderByenumThe metric or column to order topK results by.
Show 28 enum valuesHide 28 enum values
countavg_latencyp50_latencyp90_latencyp99_latencyerror_ratepass_ratefailure_rateinput_costoutput_costtotal_costavg_costinput_tokensoutput_tokenstotal_tokenscount_distinct_endUserIdcount_distinct_threadIdcount_distinct_modelcount_distinct_projectIdcount_distinct_errorcount_distinct_metadataerror_countavg_scorestddev_scoreavg_ratingcreated_atstart_timedimension
directionenumThe sort direction for topK results.
Show 2 enum valuesHide 2 enum values
ascdesc
startTimestringThe start of the widget's custom time range, if set.
endTimestringThe end of the widget's custom time range, if set.
layoutobjectA widget's position on the dashboard grid.
Show 4 propertiesHide 4 properties
xnumberThe widget's left edge as a column index on the 12-column grid.
ynumberThe widget's top edge as a row index on the grid.
wnumberThe widget's width in grid columns.
hnumberThe widget's height in grid rows.
lineslist of objectsThe series to show in the widget.
Show 6 propertiesHide 6 properties
namestringRequiredThe line's name.
colorenumThe color of a line. If omitted or unrecognized, a color is auto-assigned from the palette.
Show 10 enum valuesHide 10 enum values
AMBERVIOLETEMERALDBLUEPINKCYANROSELIMETEALORANGE
dataModelenumThe entity a line aggregates over.
Show 11 enum valuesHide 11 enum values
TRACESPANLLM_SPANAGENT_SPANRETRIEVER_SPANTOOL_SPANCUSTOM_SPANTHREADEND_USERMETRIC_DATAANNOTATION
aggregationenumThe aggregation applied to a line. The set of valid values depends on the line's dataModel.
Show 25 enum valuesHide 25 enum values
COUNTERROR_RATEPASS_RATEUNIQUE_END_USERSUNIQUE_THREADSUNIQUE_USERSUNIQUE_METADATA_VALUESAVG_LATENCYP50_LATENCYP90_LATENCYP99_LATENCYTOTAL_COSTAVG_COSTINPUT_COSTOUTPUT_COSTAVG_COST_PER_USERINPUT_TOKENSOUTPUT_TOKENSTOTAL_TOKENSERROR_COUNTNEW_USERSRETENTIONAVG_SCOREFAILURE_RATEAVG_RATING
filtersobjectA set of filter groups combined by a top-level operator.
Show 2 propertiesHide 2 properties
operatorenumRequiredHow filters or groups are combined.
Show 2 enum valuesHide 2 enum values
ANDOR
groupslist of objectsRequiredThe filter groups.
Show 2 propertiesHide 2 properties
operatorenumRequiredHow filters or groups are combined.
Show 2 enum valuesHide 2 enum values
ANDOR
filterslist of objectsRequiredThe filter rows in this group.
Show 4 propertiesHide 4 properties
categorystringRequiredThe property a filter row matches on (e.g. "Name", "User Id", "Model", "Metadata"). The set of valid values depends on the line's dataModel.
conditionenumRequiredThe comparison a filter row applies. Valid conditions depend on the category.
Show 18 enum valuesHide 18 enum values
IsIs notIs equal toDoes not equalIs less thanIs equal or less thanIs greater thanIs equal or greater thanHasHas notContainsContains onlyDoes not containHas increased by more thanHas increased by less thanHas decreased by more thanHas decreased by less thanHas changed from
valuestring | number | list of stringsRequiredThe value to match against.
keystringThe property key. Auto-populated from category when omitted; required for Metadata, Metric, and Classifier filters.
extraQueryParamsobjectAdvanced, per-line query parameters. Which keys take effect depends on the line's
dataModel, and unrecognized keys are ignored. All values are strings. Most lines leave thisnull.Show 6 propertiesHide 6 properties
spanTypeenumFor a
SPANline, restricts aggregation to a single span type. Not needed for the typed span models (LLM_SPAN,AGENT_SPAN,RETRIEVER_SPAN,TOOL_SPAN,CUSTOM_SPAN), which already imply their span type.Show 5 enum valuesHide 5 enum values
LLMAGENTRETRIEVERTOOLCUSTOM
metricMetadataKeystringFor span (
SPAN,LLM_SPAN,AGENT_SPAN,RETRIEVER_SPAN,TOOL_SPAN,CUSTOM_SPAN),TRACE, andTHREADlines, the metadata field key whose numeric value is aggregated.categoryenumFor a
METRIC_DATAline, the entity category the metric is attached to.Show 11 enum valuesHide 11 enum values
SINGLE_TURNMULTI_TURNTEST_RUNTRACESPANLLM_SPANAGENT_SPANRETRIEVER_SPANTOOL_SPANCUSTOM_SPANTHREAD
metricNamestringFor a
METRIC_DATAline, the name of the metric to aggregate.dataTypeenumFor an
ANNOTATIONline, which annotated entity type to aggregate over.Show 3 enum valuesHide 3 enum values
TracesSpansThreads
sourceenumFor an
ANNOTATIONline, whether to aggregate annotations left by end users or by reviewers.Show 2 enum valuesHide 2 enum values
UserReviewer
startTimestringISO 8601 start time for the query range. Must be provided with
endTime.endTimestringISO 8601 end time for the query range. Must be provided with
startTime.granularityenumOptional bucket granularity override for the query.
Show 5 enum valuesHide 5 enum values
thirty_minuteshourdayweekmonth
Response
The computed data for the supplied widget.
successbooleanIndicates if the request was successful.
dataobjectThe computed widget data.
Show 9 propertiesHide 9 properties
typeenumThe widget's visualization (display) type, echoed from the request.
Show 6 enum valuesHide 6 enum values
LINEAREABARSTACKED_BARTABLEBIG_NUMBER
modeenumThe widget's aggregation mode, echoed from the request. Branch on
kindrather thanmodewhen reading the response.Show 2 enum valuesHide 2 enum values
TIME_SERIESDIMENSION_SERIES
kindenumThe shape of the data in this response, and the field to branch on when reading it.
TIME_SERIESandDIMENSIONpopulateseries(withxAxis.typetimeandcategoryrespectively);BIG_NUMBERpopulatesvalues;TABLEpopulatescolumnsandrows.Show 4 enum valuesHide 4 enum values
TIME_SERIESDIMENSIONBIG_NUMBERTABLE
unitenumUnit for the returned values, when applicable.
Show 6 enum valuesHide 6 enum values
COUNTPERCENTSCORESECONDSUSDMILLISECONDS
xAxisobjectPresent for TIME_SERIES and DIMENSION data.
Show 1 propertyHide 1 property
typeenumAxis type for the returned data.
Show 2 enum valuesHide 2 enum values
timecategory
serieslist of objectsPresent for TIME_SERIES and DIMENSION data.
Show 5 propertiesHide 5 properties
keystringStable key that uniquely identifies this series within the result. Use it to correlate series across queries or as a render key.
namestringDisplay name for the series.
colorstringDisplay color for the series.
lineIdstringThe line id that produced this series, when applicable.
pointslist of objectsPoints in this series.
Show 2 propertiesHide 2 properties
xstringTime bucket start or category label.
ynumberNumeric value for the series at this point, or null when no data is available.
valueslist of objectsPresent for BIG_NUMBER data.
Show 5 propertiesHide 5 properties
keystringStable key that uniquely identifies this value within the result.
namestringDisplay name for the value.
colorstringDisplay color for the value.
lineIdstringThe line id that produced this value, when applicable.
valuenumberScalar value, or null when no data is available.
columnslist of objectsColumn definitions for TABLE data. The first column is the dimension (key
dimension); the remaining columns are one per line, keyed by the line's name.Show 2 propertiesHide 2 properties
keystringStable column key. Read each row's value for this column as
row[key].labelstringDisplay label for the column.
rowslist of objectsPresent for TABLE data.
deprecatedbooleanIndicates if this endpoint is deprecated.