# Preview Analytics Panel Drill-Down

See what a drill-down panel shows for one click: pass the clicked row's values its SQL reads as $params.

`POST https://connect.mindcloud.co/v2/analytics/pages/:pageId/panels/:panelId/drill-down-preview`

Permissions: `analytics:page:view`.

## Parameters

### Path

- `pageId` (string, required): The page id, from List Analytics Pages.
- `panelId` (string, required): The drill-down panel id, from Get Analytics Page.

### Headers

- `X-Company-Id` (string): Optional. The id of the organization to act in. Leave it out to act in the API key's own organization. Here a key acts in another organization only as one of its members: with "Use this key across all of your organizations" on, in an organization its creator belongs to with a role. Child organizations and MindCloud staff access do not reach this endpoint. Every response's X-Company-Id header names the organization it acted in. See [Organizations](https://mindcloud.co/docs/api/rest/introduction/organizations).

### Body

- `params` (object, required): The clicked row's values.
  The clicked row's values the panel's SQL reads as $params, keyed by param: { "userId": "u_81Kq2" }.
- `variables` (object): Page variable values.
  Page variable values to run it under, keyed by variable. Left out, the page's defaults apply.
- `version` (string): draft or published.
  Which version of the page to run. Left out: the published version when there is one, otherwise the draft.
  Allowed values:
    - `draft`: The draft, with the changes not yet published. Editors and owners only.
    - `published`: The version viewers see.
- `limit` (number): How many rows to answer, 1-1000.
  How many rows to answer, 1-1000. Defaults to 100.
  Default: `100`
- `offset` (number): How many rows to skip.
  How many rows to skip. Defaults to 0.
  Default: `0`

## Example request

```bash
curl --request POST \
  --url 'https://connect.mindcloud.co/v2/analytics/pages/Pq7Lm2Xc9RtA/panels/Kd4Rw8Zn1VbQ/drill-down-preview' \
  --header 'Authorization: Bearer $MINDCLOUD_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
  "params": {
    "userId": "u_81Kq2"
  },
  "variables": {
    "region": "emea"
  },
  "version": "draft",
  "limit": 100,
  "offset": 0
}'
```

## Response fields

- `status` (string): How the drill-down view came out.
  Allowed values:
    - `ready`: It ran and has rows.
    - `empty`: It ran and returned no rows.
    - `failed`: It did not run; message says why.
    - `pending`: It is taking longer than usual; try again.
- `message` (string): Why the view failed or is waiting. Null when it ran.
- `columns` (array of string): The column names the rows carry, in order.
- `rows` (array of objects): The rows in this window, as objects keyed by column.
- `rowCount` (number): How many rows there are in all.
- `offset` (number): Where this window starts.
- `nextOffset` (number): The offset of the next window, or null when this is the last.
- `version` (object): Which version of the page this answer reads.
  - `mode` (string): draft or published.
    Allowed values:
      - `draft`: The draft, with changes not yet published.
      - `published`: The version viewers see.
  - `publishedVersionId` (string): The published version read, from List Analytics Page Versions, or null when the draft is read.
