# Export results
Download every saved lead for a task as CSV or JSON.
**Request:** `GET https://leadsagent.io/api/v1/tasks/{id}/export?format=csv`
**Access:** leads:read.
**Response:** HTTP 200 file stream. The default is CSV; choose json for a JSON array.

## Parameters

- `id` (UUID): Required. The task ID.
- `format` (string): Optional. csv (default) or json.

## cURL

```sh
curl --fail-with-body --silent --show-error --request GET "$LEADSAGENT_API_BASE/tasks/$TASK_ID/export?format=csv" -H "X-API-Key: $LEADSAGENT_API_KEY"
```

## Example response

```
HTTP/1.1 200 OK
Content-Type: text/csv; charset=utf-8
Content-Disposition: attachment; filename="leads-{task_id}.csv"

[CSV file body omitted]
```

## Notes

- Export streams the full file. It does not use the paginated results envelope.

[Open the full API reference](https://leadsagent.io/documentation/api-reference)
