# Export a resource type as CSV

Canonical page: https://docs.ovok.com/primitives/export-csv

`$csv` searches a resource type and returns matching resources as a CSV download. Supply `_fields` to choose the columns; ordinary FHIR search parameters can be used to narrow the rows.

| Method | Path |
| --- | --- |
| `GET` | `/fhir/R4/:type/$csv` |

## Request [#request]

```bash
curl --get 'https://api.sandbox.ovok.com/fhir/R4/Patient/$csv' \
  --header "Authorization: Bearer ${OVOK_TOKEN}" \
  --data-urlencode '_fields=id,active,birthDate'
```

| Parameter | Required | Description |
| --- | --- | --- |
| `_fields` | Yes | Comma-separated resource fields to include as CSV columns. |
| FHIR search parameters | No | Standard search filters for the selected resource type, such as `active=true`. |

## Response [#response]

The response is a CSV file (`text/csv`) named `export.csv`. It includes a UTF-8 byte-order mark for spreadsheet compatibility. Exports are bounded by the server's result limit; use search filters to keep large exports focused.

| Response part | Description |
| --- | --- |
| Header row | Selected fields, in the requested field order. |
| Data rows | Matching resource values; repeated or complex values are serialized by the server. |

This route uses `GET`. The CSV export is a read operation; do not send it as `POST`.
