# Publish a dashboard snapshot link

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

`POST /dashboard/{id}/public-link`

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

## Path parameters

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

## Request body

- **`pages`** _(array<string>)_
  Page keys; all pages when left out.
- **`refresh`** _(string)_
  daily is accepted as interval every 24 hours.
  Allowed: `manual`, `automation`, `interval`, `daily`
- **`refresh_interval_hours`** _(integer)_
  Required with refresh interval; only with it.
  Allowed: `1`, `6`, `12`, `24`
- **`expires_in_days`** _(integer)_
  1 to 365, default 90; there is no "never".
- **`forms_enabled`** _(boolean)_
  Visitors may fill in the dashboard's forms.
- **`rows_editable`** _(boolean)_
  Visitors may also see and change the rows of the forms that edit rows. 400 validation_error without forms_enabled.
- **`consent`** _(object, required)_
  - **`widget_keys`** _(array<string>)_
    The widgets the preview showed.
  - **`dashboard_revision`** _(integer)_
    The revision the preview was made from.
  - **`editable_widget_keys`** _(array<string>)_
    The forms whose rows visitors may see and change: a second, separate agreement, required when row edits are on.
- **`live_tables`** _(boolean)_
  Viewers may filter, sort, page and export the link's tables live; every query runs as the publisher (snapshot_by). Default false. The preview's live_tables.notice is the consent text to show.

## Code examples

### curl

```bash
curl -X POST 'https://api.elaichi.ai/dashboard/<id>/public-link' \
  -H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"pages":[],"refresh":"manual","refresh_interval_hours":1,"expires_in_days":0,"forms_enabled":true,"rows_editable":true,"consent":{},"live_tables":true}'
```

### JavaScript

```javascript
const body = {
  "pages": [],
  "refresh": "manual",
  "refresh_interval_hours": 1,
  "expires_in_days": 0,
  "forms_enabled": true,
  "rows_editable": true,
  "consent": {},
  "live_tables": true
};

const response = await fetch('https://api.elaichi.ai/dashboard/<id>/public-link', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ' + process.env.ELAICHI_API_TOKEN,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

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

### Python

```python
import os
import requests

url = "https://api.elaichi.ai/dashboard/<id>/public-link"
headers = {
    "Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
    "Content-Type": "application/json",
}
payload = {
    "pages": [],
    "refresh": "manual",
    "refresh_interval_hours": 1,
    "expires_in_days": 0,
    "forms_enabled": True,
    "rows_editable": True,
    "consent": {},
    "live_tables": True
}

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