# Stream a full explorer widget export on a shared dashboard

> Source: https://docs.clonepartner.com/api-reference/public-dashboards/export-public-dashboard-widget/

`POST /api/public/dashboards/{token}/widgets/{widgetId}/export`

Mirror of POST /api/dashboards/{id}/widgets/{widgetId}/export, limited to
widgets on public pages. Streams CSV/JSON/NDJSON with no buffering.

**Operation ID:** `exportPublicDashboardWidget`

## Authentication

No authentication is required.

## Path parameters

- `token` — `string`, `required`
- `widgetId` — `string`, `required`

## Request body

### `application/json`

- Type: `object`
- Properties:
  - `explorer_params` (`ExplorerViewerParams`) — Viewer-supplied refinements for an explorer widget. Merged into the author's `base_query` — base filter keys always win, and when the widget declares `columns` they act as an allowlist for filters/sort/columns.
    - Reference: `ExplorerViewerParams`
      - Description: Viewer-supplied refinements for an explorer widget. Merged into the author's `base_query` — base filter keys always win, and when the widget declares `columns` they act as an allowlist for filters/sort/columns.
      - Properties:
        - `filters` (`array<object>`)
          - Items:
            - Type: `object`
            - Properties:
              - `field` (`string`, `required`)
              - `operator` (`string`, `required`)
                - Allowed values: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`, `contains`, `exists`
              - `value` (`unknown`)
        - `sort` (`array<object>`)
          - Items:
            - Type: `object`
            - Properties:
              - `column` (`string`)
              - `direction` (`string`)
                - Allowed values: `asc`, `desc`
        - `page` (`integer`)
        - `limit` (`integer`)
        - `columns` (`array<string>`)
          - Items:
            - Type: `string`
        - `cursor` (`string`)
  - `format` (`string`)
    - Allowed values: `csv`, `ndjson`
    - Default: `csv`
  - `filename` (`string`)

## Success responses

### 200

Streamed file download. Gzip when Accept-Encoding includes gzip.

**Content type:** `text/csv`

**Content type:** `application/x-ndjson`


## Error responses

### 400

Validation error

**Content type:** `application/json`

- Reference: `Error`
  - Type: `object`
  - Properties:
    - `error` (`string`)
      - Example: `NOT_FOUND`
    - `message` (`string`)
      - Example: `Resource not found`

Example:

```json
{
  "error": "VALIDATION_ERROR",
  "message": "Invalid input"
}
```

### 404

Resource not found

**Content type:** `application/json`

- Reference: `Error`
  - Type: `object`
  - Properties:
    - `error` (`string`)
      - Example: `NOT_FOUND`
    - `message` (`string`)
      - Example: `Resource not found`

Example:

```json
{
  "error": "NOT_FOUND",
  "message": "Resource not found"
}
```

### 503

Public dashboards disabled


## Examples

### cURL

```bash
curl --request POST \
  --url 'https://your-envoy.example.com/api/public/dashboards/YOUR_TOKEN/widgets/YOUR_WIDGET_ID/export' \
  --header 'Content-Type: application/json' \
  --data '{
  "explorer_params": {
    "filters": [
      {
        "field": "string",
        "operator": "eq"
      }
    ],
    "sort": [
      {
        "column": "string",
        "direction": "asc"
      }
    ],
    "page": 0,
    "limit": 0,
    "columns": [
      "string"
    ]
  },
  "format": "csv",
  "filename": "string"
}'
```

### JavaScript (fetch)

```javascript
const response = await fetch('https://your-envoy.example.com/api/public/dashboards/YOUR_TOKEN/widgets/YOUR_WIDGET_ID/export', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "explorer_params": {
      "filters": [
        {
          "field": "string",
          "operator": "eq"
        }
      ],
      "sort": [
        {
          "column": "string",
          "direction": "asc"
        }
      ],
      "page": 0,
      "limit": 0,
      "columns": [
        "string"
      ]
    },
    "format": "csv",
    "filename": "string"
  }),
});

if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = response.status === 204 ? null : await response.json();
console.log(data);
```
