Saved charts

GET /saved-charts

List the organization's saved charts across every dashboard. Filter by dashboardId to read one dashboard's charts, or use the dashboard's detail endpoint to get them in reading order.

Requires the analytics:read permission.

Query Parameters

limitnumber

The number of records to return.

cursorstring

A pagination cursor. Fetch the next page by passing the nextCursor value from the previous response.

sortname | -name | createdAt | -createdAt

The sort order. Prefix a field with - to sort descending. Defaults to -createdAt.

filterstring

A JSON-encoded filter document, for example {"createdAt":{"$gte":"2025-01-01T00:00:00Z"}}. Filterable fields: id, dashboardId, name, resource, chartType, createdAt. See Filtering for the syntax.

Request
curl \
  "https://api.cascade.dev/saved-charts" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"
Response
{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "dashboardId": "550e8400-e29b-41d4-a716-446655440000",
      "name": "string",
      "resource": "reviews",
      "chartType": "stat",
      "query": {
        "measures": "...",
        "groupBy": "...",
        "granularity": "...",
        "filter": "...",
        "limit": "..."
      },
      "layout": {
        "x": "...",
        "y": "...",
        "w": "...",
        "h": "..."
      },
      "invalidReason": "string",
      "createdAt": "2025-01-15T09:30:00Z",
      "updatedAt": "2025-01-15T09:30:00Z"
    }
  ],
  "nextCursor": "string"
}

POST /saved-charts

Save a chart onto a dashboard. The query document is validated against what the resource can measure and group by, its filter against the fields that resource's list endpoint allows, and the chart type against the shape the query returns, so a chart that would error every time it is opened is rejected here instead. Omit layout to append the chart at the bottom of the dashboard.

Requires the analytics:write permission.

Body Parameters

dataobjectrequired

The chart to save.

Request
curl \
  -X POST \
  "https://api.cascade.dev/saved-charts" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "data": {
    "dashboardId": "550e8400-e29b-41d4-a716-446655440000",
    "name": "string",
    "resource": "reviews",
    "chartType": "stat",
    "query": {
      "measures": [
        "..."
      ],
      "groupBy": [
        "..."
      ],
      "granularity": "hour",
      "filter": "...",
      "limit": 0
    },
    "layout": {
      "x": 0,
      "y": 0,
      "w": 0,
      "h": 0
    }
  }
}'
Response
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "dashboardId": "550e8400-e29b-41d4-a716-446655440000",
  "name": "string",
  "resource": "reviews",
  "chartType": "stat",
  "query": {
    "measures": ["string"],
    "groupBy": ["string"],
    "granularity": "hour",
    "filter": "...",
    "limit": 0
  },
  "layout": {
    "x": 0,
    "y": 0,
    "w": 0,
    "h": 0
  },
  "invalidReason": "string",
  "createdAt": "2025-01-15T09:30:00Z",
  "updatedAt": "2025-01-15T09:30:00Z"
}

POST /saved-charts/preview

Check a chart definition without saving it. It runs exactly the validation POST /saved-charts runs, and reports which chart types can draw the query, so a type that does not fit is caught before anything is written. Nothing is stored and nothing is recorded.

Requires the analytics:read permission.

Body Parameters

dataobjectrequired

The chart definition to check.

Request
curl \
  -X POST \
  "https://api.cascade.dev/saved-charts/preview" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "data": {
    "resource": "reviews",
    "chartType": "stat",
    "query": {
      "measures": [
        "..."
      ],
      "groupBy": [
        "..."
      ],
      "granularity": "hour",
      "filter": "...",
      "limit": 0
    }
  }
}'
Response
{
  "valid": true,
  "reason": "string",
  "chartTypes": ["stat"],
  "recommendedChartType": "stat"
}

GET /saved-charts/{id}

Get a single saved chart by ID.

Requires the analytics:read permission.

Path Parameters

idstring (uuid)required

The ID of the saved chart.

Request
curl \
  "https://api.cascade.dev/saved-charts/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"
Response
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "dashboardId": "550e8400-e29b-41d4-a716-446655440000",
  "name": "string",
  "resource": "reviews",
  "chartType": "stat",
  "query": {
    "measures": ["string"],
    "groupBy": ["string"],
    "granularity": "hour",
    "filter": "...",
    "limit": 0
  },
  "layout": {
    "x": 0,
    "y": 0,
    "w": 0,
    "h": 0
  },
  "invalidReason": "string",
  "createdAt": "2025-01-15T09:30:00Z",
  "updatedAt": "2025-01-15T09:30:00Z"
}

PUT /saved-charts/{id}

Rename a saved chart, change how it is drawn, or replace what it asks for. The resource it aggregates and the dashboard it belongs to cannot be changed, and its position is written through the dashboard's layout endpoint. The whole definition is revalidated, so a new query the saved chart type cannot draw is rejected.

Requires the analytics:write permission.

Path Parameters

idstring (uuid)required

The ID of the saved chart to update.

Body Parameters

dataobjectrequired

The fields to update.

Request
curl \
  -X PUT \
  "https://api.cascade.dev/saved-charts/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "data": {
    "name": "string",
    "chartType": "stat",
    "query": {
      "measures": [
        "..."
      ],
      "groupBy": [
        "..."
      ],
      "granularity": "hour",
      "filter": "...",
      "limit": 0
    }
  }
}'
Response
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "dashboardId": "550e8400-e29b-41d4-a716-446655440000",
  "name": "string",
  "resource": "reviews",
  "chartType": "stat",
  "query": {
    "measures": ["string"],
    "groupBy": ["string"],
    "granularity": "hour",
    "filter": "...",
    "limit": 0
  },
  "layout": {
    "x": 0,
    "y": 0,
    "w": 0,
    "h": 0
  },
  "invalidReason": "string",
  "createdAt": "2025-01-15T09:30:00Z",
  "updatedAt": "2025-01-15T09:30:00Z"
}

DELETE /saved-charts/{id}

Delete a saved chart from its dashboard. The deletion is recorded in the audit log.

Requires the analytics:write permission.

Path Parameters

idstring (uuid)required

The ID of the saved chart to delete.

Request
curl \
  -X DELETE \
  "https://api.cascade.dev/saved-charts/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"
Response
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "dashboardId": "550e8400-e29b-41d4-a716-446655440000",
  "name": "string",
  "resource": "reviews",
  "chartType": "stat",
  "query": {
    "measures": ["string"],
    "groupBy": ["string"],
    "granularity": "hour",
    "filter": "...",
    "limit": 0
  },
  "layout": {
    "x": 0,
    "y": 0,
    "w": 0,
    "h": 0
  },
  "invalidReason": "string",
  "createdAt": "2025-01-15T09:30:00Z",
  "updatedAt": "2025-01-15T09:30:00Z"
}