V3 Charts

Creates a chart on a Feedback Dataset. The chart query goes through the chart query validator (422 naming each problem); write it against GET /api/v3/charts/fields and check it with POST /api/v3/charts/preview first. Needs write access to the workspace and to the Feedback Dataset. A name already used in the workspace answers 409.

post/api/v3/charts

Request

  • Base URL
    https://app.formbricks.com
  • URL
    https://app.formbricks.com/api/v3/charts
  • Auth
    • API key in cookie next-auth.session-token
    • or API key in header x-api-key
    • or HTTP bearer

Request body

workspaceIdstring cuid2 required
datasetIdstring cuid2 required

The Feedback Dataset the chart reads. Needs write access to it from workspaceId. Fixed once the chart exists.

namestring required

Unique within the workspace; leading and trailing spaces are trimmed.

type'area' | 'bar' | 'pie' | 'big_number' | 'matrix' required

matrix is refused with 422 while an instance's online upgrade to 6.1 is unfinished.

Example request

{
  "query": {
    "measures": [
      "FeedbackRecords.npsScore"
    ],
    "dimensions": [
      "FeedbackRecords.sourceName"
    ],
    "timeDimensions": [
      {
        "dimension": "FeedbackRecords.collectedAt",
        "dateRange": "last 30 days"
      }
    ],
    "filters": [
      {
        "member": "FeedbackRecords.sourceType"
      }
    ]
  }
}

Response

Chart created

Example response

{
  "data": {
    "query": {
      "measures": [
        "FeedbackRecords.npsScore"
      ],
      "dimensions": [
        "FeedbackRecords.sourceName"
      ],
      "timeDimensions": [
        {
          "dimension": "FeedbackRecords.collectedAt",
          "dateRange": "last 30 days"
        }
      ],
      "filters": [
        {
          "member": "FeedbackRecords.sourceType"
        }
      ]
    }
  }
}

Changes