> ## Documentation Index
> Fetch the complete documentation index at: https://nestjs-query.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# CSV Export

> Every  includes a CSV endpoint at . It supports the same generated filters, search hook, authorization filter, default sorting, and soft-delete visibility options as collection reads.

```http theme={null}
GET /todo-items/export?completed=false
Accept: text/csv
```

```csv theme={null}
"id","title","completed"
1,"Write REST documentation",false
2,"Review examples",false
```

The response content type is `text/csv`. String fields are quoted and spreadsheet formulas are escaped.

## Configure exports[​](#configure-exports "Direct link to Configure exports")

The default export limit is `1000`. Change it or disable export independently:

```ts theme={null}
{
  DTOClass: TodoItemDTO,
  EntityClass: TodoItemEntity,
  basePath: 'todo-items',
  export: {
    limit: 5000,
    many: {
      path: 'reports/todo-items',
      description: 'Download visible todo items as CSV'
    }
  }
}
```

The generated path appends `/export` to `many.path`, so the example above is served at `/todo-items/reports/todo-items/export`.

```ts theme={null}
{
  DTOClass: TodoItemDTO,
  EntityClass: TodoItemEntity,
  basePath: 'todo-items',
  export: { disabled: true }
}
```

## Export a different shape[​](#export-a-different-shape "Direct link to Export a different shape")

Use `ExportDTOClass` to select CSV columns without changing the normal response DTO. Decorated fields are serialized in the export, and their property names become the CSV headers.

todo-item-export.dto.ts

```ts theme={null}
import { Field } from '@ptc-org/nestjs-query-rest'

export class TodoItemExportDTO {

  @Field()
  id!: number

  @Field()
  title!: string

  @Field()
  completed!: boolean
}
```

```ts theme={null}
{
  DTOClass: TodoItemDTO,
  EntityClass: TodoItemEntity,
  basePath: 'todo-items',
  export: { ExportDTOClass: TodoItemExportDTO }
}
```

For very large datasets, keep the export limit bounded or implement a custom streaming controller.

[Edit this page](https://github.com/tripss/nestjs-query/edit/master/docs/rest/export)
