Skip to main content
POST
/
dashboards
/
widgets
/
preview_data
cURL
curl --request POST \
  --url https://api.cekura.ai/dashboards/widgets/preview_data/ \
  --header 'Content-Type: application/json' \
  --header 'X-CEKURA-API-KEY: <api-key>' \
  --data '
{
  "dashboard": 123,
  "name": "<string>",
  "filters": {
    "field": "<string>",
    "op": "eq",
    "value": "<unknown>",
    "operator": "and",
    "conditions": [
      "<unknown>"
    ]
  },
  "chart_type": "line",
  "data_type": "numeric",
  "field": "<string>",
  "metric": 123,
  "time_period": "hour",
  "aggregation_function": "count",
  "metadata": "<unknown>"
}
'
{
  "widget_id": 123,
  "field_name": "<string>",
  "chart_type": "<string>",
  "data": [
    {}
  ],
  "aggregation_function": "<string>",
  "time_period": "<string>",
  "metadata": {
    "display_name": "<string>",
    "data_type": "numeric",
    "filter_value": "<unknown>"
  }
}

Authorizations

X-CEKURA-API-KEY
string
header
required

API Key Authentication. It should be included in the header of each request.

Body

Serializer for Widget model.

dashboard
integer | null

Dashboard this widget belongs to

name
string | null

Optional name/title for the widget

Maximum string length: 255
filters
object

Filter conditions to scope the data. See the Dashboards guide for supported fields, operators, and syntax.

Examples:
{
"field": "success",
"op": "eq",
"value": true
}
{
"operator": "and",
"conditions": [
{
"field": "timestamp",
"op": "gte",
"value": "today-7d"
},
{
"field": "duration",
"op": "gte",
"value": 60
}
]
}
chart_type
enum<string>

Type of chart to display

  • line - Line
  • bar - Bar
  • pie - Pie
Available options:
line,
bar,
pie
data_type
enum<string> | null

Data type of the field being plotted (optional, can be inferred)

  • numeric - Numeric
  • boolean - Boolean
  • string - String
  • datetime - DateTime
  • dynamic - Dynamic
Available options:
numeric,
boolean,
string,
datetime,
dynamic,
,
null
field
string

Field name to plot. See the Dashboards guide for available fields, valid chart types, and aggregation combinations.

Maximum string length: 255
Examples:

"duration"

"success"

"call_ended_reason"

"metric_evaluations.value"

"metadata.region"

metric
integer | null

Metric to use when field is 'metric_evaluations.value'

time_period
enum<string> | null

Time period for aggregation (for bar charts)

  • hour - Hour
  • day - Day
  • week - Week
  • month - Month
Available options:
hour,
day,
week,
month,
,
null
aggregation_function
enum<string> | null

Aggregation function to apply (for bar charts)

  • count - Count
  • sum - Sum
  • avg - Average
  • min - Minimum
  • max - Maximum
Available options:
count,
sum,
avg,
min,
max,
,
null
metadata
any | null

Frontend metadata (e.g., position, size, styling)

Response

200 - application/json

Serializer for widget data response.

widget_id
integer
field_name
string
chart_type
string
data
object[]

Chart data. Format depends on chart_type:

Line chart: [{id, timestamp, value}, ...]

Bar chart: [{time_interval, value, sample_count}, ...]

Pie chart: [{label, value, percentage}, ...]

See the Dashboards guide for full examples.

Examples:
[
{
"id": 1,
"timestamp": "2025-11-03T10:30:00Z",
"value": 45
},
{
"id": 2,
"timestamp": "2025-11-03T11:15:00Z",
"value": 62
}
]
[
{
"time_interval": "2025-11-03T00:00:00Z",
"value": 4.5,
"sample_count": 10
},
{
"time_interval": "2025-11-04T00:00:00Z",
"value": 3.2,
"sample_count": 8
}
]
[
{
"label": "customer_ended_call",
"value": 320,
"percentage": 45.7
},
{
"label": "agent_ended_call",
"value": 210,
"percentage": 30
}
]
aggregation_function
string | null
time_period
string | null
metadata
object

Additional metadata about the plotted data. See the Dashboards guide for details.