# Re-capture a public link snapshot as you

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

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

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

## Path parameters

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

## Request body

- **`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)_
  Only with consent. The refresher becomes the publisher, so live queries would run as them. Absent: kept only if the refresher already was the publisher, otherwise switched off.

## Response body

- **`id`** _(string)_
- **`dashboard_id`** _(string)_
- **`status`** _(string)_
  Allowed: `active`, `paused`, `suspended`, `expired`, `revoked`
- **`suspended_reason`** _(string,null)_
  Allowed: `publisher_invalid`, `publisher_left`, `settings_off`, `dashboard_changed`, `null`
- **`pages`** _(array<string>)_
- **`refresh`** _(string)_
  Allowed: `manual`, `automation`, `interval`
- **`refresh_interval_hours`** _(integer,null)_
  Set exactly when refresh is interval.
  Allowed: `1`, `6`, `12`, `24`, `null`
- **`feeding_automations`** _(array<object>)_
  At most 5 workflows that write a collection the dashboard reads, among those the caller may see.
  - **`id`** _(string)_
  - **`name`** _(string)_
  - **`enabled`** _(boolean)_
- **`feeding_automation_count`** _(integer)_
- **`recommended_refresh`** _(string)_
  Allowed: `automation`, `interval`
- **`expires_at`** _(string)_
- **`snapshot_at`** _(string,null)_
  When the copy that is being served was captured.
- **`snapshot_by`** _(string,null)_
- **`snapshot_by_display_name`** _(string,null)_
- **`shown_count`** _(integer)_
- **`hidden_count`** _(integer)_
- **`created_by`** _(string)_
- **`created_at`** _(string)_
- **`next_refresh_at`** _(string,null)_
  When the next capture of this link is due, or null when none is waiting. Reflects only the requests the link has received: a workflow run that finishes inside the workflow's own 15-minute gap arms a timer first and has not asked yet, so the link can show nothing pending for up to 15 minutes after such a run.
- **`refresh_pending_reason`** _(string,null)_
  Why next_refresh_at is waiting: a workflow run asked inside the 15-minute minimum gap since the last capture (min_gap), the last capture failed and is retried (retry_after_failure), or the link's own schedule (interval).
  Allowed: `min_gap`, `retry_after_failure`, `interval`, `null`
- **`can_manage`** _(boolean)_
- **`can_refresh`** _(boolean)_
- **`refresh_blocked_reason`** _(string,null)_
- **`can_change_refresh`** _(boolean)_
  Only the link's current publisher (the person whose Update now made its current copy) may change how it updates; everyone else with can_refresh takes it over with refresh first.
- **`change_refresh_blocked_reason`** _(string,null)_
- **`forms_enabled`** _(boolean)_
  Visitors may fill in the dashboard's forms.
- **`form_count`** _(integer)_
  Form widgets on the link's pages of the published dashboard; 0 means there is nothing to switch on.
- **`can_enable_forms`** _(boolean)_
  can_refresh, the link not expired, and form_count above 0.
- **`forms_blocked_reason`** _(string,null)_
- **`forms_problem`** _(string,null)_
  With forms on and the link live: why entries are refused right now, one sentence; null when they are taken.
- **`rows_editable`** _(boolean)_
  Visitors may see and change the rows of the link's editable forms.
- **`edit_form_count`** _(integer)_
  Forms on the link's pages whose edit_rows is not off.
- **`can_enable_row_edits`** _(boolean)_
  Also needs forms on and edit_form_count above 0.
- **`row_edits_blocked_reason`** _(string,null)_
- **`live_tables`** _(boolean)_
  Viewers may filter, sort, page and export the link's tables live; every query runs as the publisher (snapshot_by).
- **`can_enable_live_tables`** _(boolean)_
  May the caller switch live_tables on: the same rule as can_change_refresh. Switching off needs only can_manage.
- **`enable_live_tables_blocked_reason`** _(string,null)_
- **`can_refresh_now`** _(boolean)_
  May the caller refresh the data now without a review: the link is live and the caller is its current publisher. Everyone else uses refresh with a consent, which takes the link over.
- **`refresh_now_blocked_reason`** _(string,null)_

## Code examples

### curl

```bash
curl -X POST 'https://api.elaichi.ai/dashboard/<id>/public-link/<linkId>/refresh' \
  -H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"consent":{},"live_tables":true}'
```

### JavaScript

```javascript
const body = {
  "consent": {},
  "live_tables": true
};

const response = await fetch('https://api.elaichi.ai/dashboard/<id>/public-link/<linkId>/refresh', {
  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/<linkId>/refresh"
headers = {
    "Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
    "Content-Type": "application/json",
}
payload = {
    "consent": {},
    "live_tables": True
}

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