Query Widget
POSThttps://api.confident-ai.com/v2/dashboards/{dashboardId}/widgets/{widgetId}/query
Computes the data behind one widget. A time range you send overrides the widget's own for this query only. Branch on data.kind to read the result: the widget's type and mode say how it is drawn, not how the payload is shaped.
curl -X POST "https://api.confident-ai.com/v2/dashboards/{dashboardId}/widgets/{widgetId}/query" \
-H "CONFIDENT_API_KEY: <PROJECT-API-KEY>" \
-H "Content-Type: application/json" \
-d '{
"startTime": "2025-01-01T00:00:00.000Z",
"endTime": "2025-01-31T23:59:59.999Z",
"granularity": "thirty_minutes"
}'{
"success": true,
"data": {
"widgetId": "<WIDGET-ID>",
"type": "LINE",
"mode": "TIME_SERIES",
"data": {
"kind": "BIG_NUMBER",
"unit": "COUNT",
"values": [
{
"key": "Traces",
"name": "Traces",
"color": "AMBER",
"lineId": "<LINE-ID>",
"value": 3814
}
]
}
},
"deprecated": false
}Headers
CONFIDENT_API_KEYstringRequiredThe API key of your Confident AI project.
Path parameters
dashboardIdstringRequiredThe id of the dashboard the widget is on.
widgetIdstringRequiredThe id of the widget.
Request body
startTimestringThe start of the range to compute over, as an ISO 8601 datetime. Must be sent together with
endTime, and overrides each widget's own range for this query only.endTimestringThe end of the range to compute over, as an ISO 8601 datetime. Must be sent together with
startTime, and must be later than it.granularityenumThe size of each bucket in computed widget data. Left unset, Confident AI picks one from the length of the query range.
Show 5 enum valuesHide 5 enum values
thirty_minuteshourdayweekmonth
Response
Query Widget succeeded.
successbooleanIndicates if the request was successful.
dataobjectOne widget's computed data, with the widget it came from.
Show 4 propertiesHide 4 properties
widgetIdstringThe id of the widget this result was computed for.
typeenum | nullThe visualization a widget is drawn as. It is how the widget is displayed and does not by itself decide the shape of a query response — a
TABLEwidget returns tabular data whatever itsmodeis.Show 7 enum valuesHide 7 enum values
LINEAREABARSTACKED_BARGROUPED_BARTABLEBIG_NUMBER
modeenum | nullHow 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'sdimension. This is the widget's saved configuration — the shape of a query response is given bykindon the result.Show 2 enum valuesHide 2 enum values
TIME_SERIESDIMENSION_SERIES
dataobject | object | object | objectA widget's computed data. Branch on
kindto read it: Confident AI derives the shape from the widget'stypeandmode, so aDIMENSION_SERIESwidget drawn as aTABLEreturnsTABLEdata.Show 4 variantsHide 4 variants
Widget Big Number DataobjectThe whole query range aggregated to one figure per line, as a BIG_NUMBER widget draws it.
Show 3 propertiesHide 3 properties
kindenumMarks the result as a set of headline figures.
Show 1 enum valueHide 1 enum value
BIG_NUMBER
unitenum | nullThe unit a widget's values are measured in.
Show 6 enum valuesHide 6 enum values
COUNTPERCENTSCORESECONDSUSDMILLISECONDS
valueslist of objectsOne figure per line on the widget.
Show 5 propertiesHide 5 properties
keystringA key that identifies this series within the result, unique across the result and stable between queries. Use it as a render key, or to line results up across queries.
namestringThe label to show for the series.
colorenumThe colour a line is drawn in, from the Confident AI palette. A line you create without one is assigned the next colour in the palette.
Show 10 enum valuesHide 10 enum values
AMBERVIOLETEMERALDBLUEPINKCYANROSELIMETEALORANGE
lineIdstringThe id of the widget line this series was computed from, when one line produced it.
valuenumber | nullThe aggregated value over the whole query range, or null when there was nothing to aggregate.
- OR
Widget Time Series DataobjectValues bucketed over the query range, each point's
xthe start of its time bucket.Show 3 propertiesHide 3 properties
kindenumMarks the result as series plotted against time.
Show 1 enum valueHide 1 enum value
TIME_SERIES
unitenum | nullThe unit a widget's values are measured in.
Show 6 enum valuesHide 6 enum values
COUNTPERCENTSCORESECONDSUSDMILLISECONDS
serieslist of objectsOne series per line, or per dimension value when the widget breaks its single line down.
Show 5 propertiesHide 5 properties
keystringA key that identifies this series within the result, unique across the result and stable between queries. Use it as a render key, or to line results up across queries.
namestringThe label to show for the series.
colorenumThe colour a line is drawn in, from the Confident AI palette. A line you create without one is assigned the next colour in the palette.
Show 10 enum valuesHide 10 enum values
AMBERVIOLETEMERALDBLUEPINKCYANROSELIMETEALORANGE
lineIdstringThe id of the widget line this series was computed from, when one line produced it.
pointslist of objectsThe series' points, ordered by time for
TIME_SERIESdata and by the order the dimension values were ranked in forDIMENSIONdata.Show 2 propertiesHide 2 properties
xstringThe point's position along the x axis: the start of the time bucket for
TIME_SERIESdata, the dimension value forDIMENSIONdata.ynumber | nullThe aggregated value at this point, or null when the bucket held nothing to aggregate.
- OR
Widget Dimension DataobjectThe whole query range aggregated per dimension value, as a DIMENSION_SERIES widget draws it.
Show 3 propertiesHide 3 properties
kindenumMarks the result as series plotted against a dimension.
Show 1 enum valueHide 1 enum value
DIMENSION
unitenum | nullThe unit a widget's values are measured in.
Show 6 enum valuesHide 6 enum values
COUNTPERCENTSCORESECONDSUSDMILLISECONDS
serieslist of objectsOne series per line, each point's
xa value of the widget's dimension.Show 5 propertiesHide 5 properties
keystringA key that identifies this series within the result, unique across the result and stable between queries. Use it as a render key, or to line results up across queries.
namestringThe label to show for the series.
colorenumThe colour a line is drawn in, from the Confident AI palette. A line you create without one is assigned the next colour in the palette.
Show 10 enum valuesHide 10 enum values
AMBERVIOLETEMERALDBLUEPINKCYANROSELIMETEALORANGE
lineIdstringThe id of the widget line this series was computed from, when one line produced it.
pointslist of objectsThe series' points, ordered by time for
TIME_SERIESdata and by the order the dimension values were ranked in forDIMENSIONdata.Show 2 propertiesHide 2 properties
xstringThe point's position along the x axis: the start of the time bucket for
TIME_SERIESdata, the dimension value forDIMENSIONdata.ynumber | nullThe aggregated value at this point, or null when the bucket held nothing to aggregate.
- OR
Widget Table DataobjectThe whole query range aggregated into a table, as a TABLE widget draws it.
Show 3 propertiesHide 3 properties
kindenumMarks the result as columns and rows.
Show 1 enum valueHide 1 enum value
TABLE
columnslist of objectsThe table's columns: the widget's dimension first, under the key
dimension, then one column per line.Show 2 propertiesHide 2 properties
keystringThe key each row holds this column's value under.
labelstringThe label to show in the column header.
rowslist of objectsOne row per dimension value. Each row holds its values under the
keyof the column they belong to, and a value is null where the row had nothing to aggregate.
deprecatedbooleanIndicates if this endpoint is deprecated.