# Export a report

> Request the PDF report or the Excel workbook of a crawl, wait until it is ready and download it.

An export is generated in the background, in three steps: request, wait, download.

## Request

```bash expect=202
curl -X POST "https://api.nessflow.com/v1/crawls/$CRAWL_ID/exports" \
  -H "Authorization: Bearer $NESSFLOW_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"format": "pdf"}'
```

`format` is `pdf` (the executive report) or `xlsx` (the full workbook, if your plan includes it). An identical export still in progress is returned instead of starting a second one, and a crawl still running is refused (`409 export.crawl_not_finished`): its report would be incomplete.

## Wait

```bash
curl "https://api.nessflow.com/v1/exports/$EXPORT_ID" \
  -H "Authorization: Bearer $NESSFLOW_TOKEN"
```

When `status` is `ready`, `download_url` is set until `expires_at`. An `export.ready` webhook saves the polling.

## Download

```bash
curl -o report.pdf "https://api.nessflow.com/v1/exports/$EXPORT_ID/download" \
  -H "Authorization: Bearer $NESSFLOW_TOKEN"
```

The download requires the token, like every call: a link passed around in a message is not enough. An expired export answers `410 export.expired`; request a new one.
