# Get a widget’s data

> Source: https://elaichi.ai/docs/api-reference/dashboards/dashboard/getdashboardwidgetdata/

`GET /dashboard/{id}/widget/{key}/data`

Resource: **Dashboard** · API: **Dashboards**

## Path parameters

- **`id`** _(string, required)_
  Resource id
- **`key`** _(string, required)_
  Resource id

## Query parameters

- **`cursor`** _(string)_
- **`draft`** _(string)_
  Pass 1 to read the DRAFT (a manager previewing their edits). Requires edit access: 403 for anyone else. A dashboard with no draft answers the published one. Never cached.
  Allowed: `1`, `true`
- **`vc`** _(string)_
  Viewer table controls: base64url JSON, at most 4096 bytes. 400 viewer_control_invalid on a bad value.
- **`tz`** _(string)_
  IANA time zone for date presets. An invalid zone falls back to UTC.
- **`f.KEY`** _(string)_
  A dashboard filter value, once per value. A YYYY-MM-DD..YYYY-MM-DD range, a preset name or me for the caller. 400 filter_invalid on a bad value.

## Response body

- **`widget_key`** _(string)_
- **`kind`** _(string)_
  Allowed: `metric`, `chart`, `table`, `markdown`
- **`state`** _(string)_
  Allowed: `ok`, `empty`, `no_access`, `source_error`
- **`data`** _(unknown)_
- **`disclosure`** _(object,null)_
- **`table_page`** _(object,null)_
- **`row_visibility`** _(string,null)_
- **`fetched_at`** _(string,null)_
- **`expires_at`** _(string,null)_
- **`cached`** _(boolean)_
- **`stale`** _(boolean)_
- **`throttled`** _(boolean)_
- **`error`** _(object,null)_

## Code examples

### curl

```bash
curl -X GET 'https://api.elaichi.ai/dashboard/<id>/widget/<key>/data' \
  -H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
  -H 'Content-Type: application/json'
```

### JavaScript

```javascript
const response = await fetch('https://api.elaichi.ai/dashboard/<id>/widget/<key>/data', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer ' + process.env.ELAICHI_API_TOKEN,
    'Content-Type': 'application/json',
  },
});

const data = await response.json();
console.log(data);
```

### Python

```python
import os
import requests

url = "https://api.elaichi.ai/dashboard/<id>/widget/<key>/data"
headers = {
    "Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
    "Content-Type": "application/json",
}

response = requests.get(url, headers=headers)
print(response.json())
```
