Skip to main content
POST
Preview a chart

Authorizations

next-auth.session-token
string
cookie
required

NextAuth session JWT cookie. Development: often next-auth.session-token. Production (HTTPS): often __Secure-next-auth.session-token. Send the cookie your browser receives after sign-in.

Body

application/json
workspaceId
string<cuid2>
required
datasetId
string<cuid2>
required

The Feedback Dataset to read; needs read access to it from workspaceId.

type
enum<string>
required

The chart type. A big_number shows one value, so its grouping is dropped.

Available options:
area,
bar,
pie,
big_number,
matrix
query
object
required

What a chart computes, in Cube's query format (ADR 0001): measures, dimensions, time dimensions, filters, order and limit over its Feedback Dataset's fields. Every field must come from the field catalog (GET /api/v3/charts/fields), named with its data-source prefix. Display settings are separate (config).

Refused with 422 (invalid_params names each problem): a field that is not in the catalog; Cube options the app does not use (ungrouped, segments, renewQuery, joinHints, total, compareDateRange); a timezone (every range is read in the organization's display time zone); more than 15 fields across measures, dimensions and timeDimensions; more than 25 filter conditions or filters nested deeper than three levels; a date range that is not a preset, all-time or two ISO calendar dates; on a chart grouped by time alone, a date range that spans more than 10,000 buckets of its granularity (code limit_exceeded).

dateRange

Replaces the query's date range on FeedbackRecords.collectedAt: a preset, all-time (the query's own range applies when it is grouped by time, and is dropped otherwise), or { from, to } ISO calendar dates. Read in the organization's display time zone.

Example:

"last 7 days"

Response

The chart's rows

data
object
required

What a chart query returns: one row per group, keyed by field name, the label maps to display stored ids with, and the query as it ran.