Skip to Content
Analytics boards

Create an analysis insight

Permissionboards:createRetriesIdempotency-Key requiredAuthentication
POST
/analysis/boards/{id}/insights

Adds a saved query to an active board. Omitted presentation fields receive documented defaults; omitted position appends after the highest current position. The complete normalized definition is returned. Use Idempotency-Key for safe retries.

Authorization

bearerAuth
headerAuthorizationBearer <token>

Use a Voice API key or connected-app OAuth access token. Authentication.

Path Parameters

id*string
Formatuuid

Header Parameters

Idempotency-Key*string

Required. Reuse the same key to retry this write safely. Retries and idempotency.

Match^[A-Za-z0-9!#$%&'*+.^_`|~-]+$
Length1 <= length <= 255

Request Body

application/json
  1. body

Creates a saved insight. Presentation fields use the documented defaults when omitted. Omit position to append after the board's current highest position. The request body is limited to 65536 bytes.

name*string
Length1 <= length <= 120
chart_type?string

How the insight renders. Several types constrain the query shape and are rejected at write time when the config cannot draw them: pie and donut need a categorical group_by; scatter needs exactly two queries; heatmap needs a secondary group-by; number and number_delta need group_by=none; area_percent needs at least two series. The machine readable form of these rules is constraints.chart_rules on GET /v1/analysis/schema.

Default"bar"
Value in"bar""line""area""area_percent""pie""donut""scatter""heatmap""table""number""number_delta"
time_range?string

The window the insight reads. custom takes its bounds from config.range_from and config.range_to.

Default"7d"
Value in"24h""7d""30d""90d""all""custom"
bucket?string

Time-axis granularity. hour is available only for the 24h, 7d, and custom ranges; a coarser bucket is required for longer windows.

Default"day"
Value in"hour""day""week""month"
group_by?string
Default"time"
Value in"none""time""agent""value"
config*

Query configuration. formula is a closed arithmetic expression over query names using numbers, +, -, *, /, and parentheses. group_by_2 requires one query, a primary grouping dimension other than none, and a different secondary dimension. formula and group_by_2 cannot be combined.

position?integer
Range0 <= value <= 10000
layout?

Placement on the board's 12-column grid. A row unit is 40px in the dashboard. All four fields are supplied together; x + w must not exceed 12 columns.

Response Body

Insight created. The containing board's ETag also changes.

application/json
  1. response

A normalized saved analysis insight.

id*string
Formatuuid
board_id*string
Formatuuid
name*string
Length1 <= length <= 120
chart_type*AnalysisChartType

How the insight renders. Several types constrain the query shape and are rejected at write time when the config cannot draw them: pie and donut need a categorical group_by; scatter needs exactly two queries; heatmap needs a secondary group-by; number and number_delta need group_by=none; area_percent needs at least two series. The machine readable form of these rules is constraints.chart_rules on GET /v1/analysis/schema.

Value in"bar""line""area""area_percent""pie""donut""scatter""heatmap""table""number""number_delta"
time_range*AnalysisTimeRange

The window the insight reads. custom takes its bounds from config.range_from and config.range_to.

Value in"24h""7d""30d""90d""all""custom"
bucket*AnalysisBucket

Time-axis granularity. hour is available only for the 24h, 7d, and custom ranges; a coarser bucket is required for longer windows.

Value in"hour""day""week""month"
group_by*AnalysisGroupBy
Value in"none""time""agent""value"
config*

Normalized query configuration returned for a saved insight.

position*integer
Range0 <= value <= 10000
layout*

Placement on the board's 12-column grid. A row unit is 40px in the dashboard. All four fields are supplied together; x + w must not exceed 12 columns.

created_at*string
Formatdate-time
updated_at*string
Formatdate-time
Example Request
curl -X POST 'https://api.kejue.co/v1/analysis/boards/497f6eca-6276-4993-bfeb-53cbbbba6f08/insights' \  -H 'Idempotency-Key: string' \  -H 'Content-Type: application/json' \  -d '{  "name": "string",  "config": {    "queries": [      {        "column": "string",        "operation": "count",        "source": "extraction"      }    ]  }}'
Example Response
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "board_id": "75e8c400-2dbc-43a3-9af4-ff9e6c099385",  "name": "string",  "chart_type": "bar",  "time_range": "24h",  "bucket": "hour",  "group_by": "none",  "config": {    "queries": [      {        "name": "string",        "group_by": {          "source": "call",          "column": "string"        },        "extraction_object_id": "dd58f28a-20cf-4d0e-af7a-6fd115475937",        "column": "string",        "operation": "count",        "filters": [          {            "source": "call",            "column": "string",            "value": "string",            "op": "is_null"          }        ],        "agent_ids": [          "06fc211d-6a87-43c8-9a41-e3b40320420d"        ],        "source": "extraction"      }    ],    "formula": "string",    "group_by_2": "time",    "range_from": "2019-08-24T14:15:22Z",    "range_to": "2019-08-24T14:15:22Z",    "display": {      "series_colors": {        "property1": "string",        "property2": "string"      },      "legend": true,      "value_format": "number",      "stack_mode": "none",      "orientation": "vertical",      "goal": 0,      "lower_is_better": true    }  },  "position": 0,  "layout": {    "x": 0,    "y": 0,    "w": 1,    "h": 1  },  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z"}