---
title: "Get draft data from given SQL query"
method: POST
path: "/dashboards/{dashboard_id}/getDraftData"
tags: ["Dashboard"]
---

# Get draft data from given SQL query

`POST /dashboards/{dashboard_id}/getDraftData`

## Request

- Base URL: `https://app.mammoth.io/api/v2`
- URL: `https://app.mammoth.io/api/v2/dashboards/{dashboard_id}/getDraftData`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-KEY` and API key in header `X-API-SECRET` and API key in header `X-WORKSPACE-ID`

Given the SQL query, get draft data. Returns data directly if cached (HTTP 200), or job_id if processing (HTTP 202).

## Path parameters

- `dashboard_id` integer, required

## Request body

- WidgetDataSpec: Parameters required for widget data retrieval with filters
  - `params` WidgetDataParams, required
    - `widget_id` string, uuid, required: UUID of the widget requesting data
    - `global_filters` object: Global filters from sidebar. Key=column, Value=filter value
    - `drilldown_filters` object: Drilldown filters from chart clicks. Always exact match.

## Response `200`

Widget data retrieved successfully

- WidgetDataResponse
  - `data` object[], required: List of rows returned for the widget with filters applied

## Other responses

- `201`: Document created, URL follows
- `202`: Job submitted for widget data execution
- `400`: Bad request syntax or unsupported method
- `403`: Request forbidden -- authorization will not help

---

[API](https://skmtc.dev/mammoth/apis/mammoth-analytics.md) · [All operations](https://skmtc.dev/mammoth/apis/mammoth-analytics/llms.txt) · [OpenAPI document](https://skmtc.dev/mammoth/apis/mammoth-analytics/revisions/4b2c943a00dc?raw)
