---
title: "Export scans as CSV"
method: GET
path: "/v1/scans/export"
tags: ["scans"]
---

# Export scans as CSV

`GET /v1/scans/export`

## Request

- Base URL: `https://api.ethiack.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.ethiack.com/v1/scans/export`
- Auth: none declared

Export every scan the caller may see as a CSV attachment.

Rows are Cerbos-scoped by ``ScanService`` (an org user gets their
org's scans, an admin gets all), sorted newest-first by
``init_time`` with unstarted scans last, and enriched with the
owning pentest's name via a second Cerbos-scoped
``PentestService`` read. The whole document is built in memory and
returned inline — see the module docstring for why this is not the
async documents pipeline.

Args:
    db (AsyncSession): Request-scoped database session.
    context (ActiveContext): Resolved caller identity and scope.
    query (ScanExportQuery): Optional ``pentest_id`` / ``launch_id``
        filters.

Returns:
    Response: A ``text/csv`` download of the authorized scans.

## Query parameters

- `pentest_id` integer, nullable

## Response `200`

CSV export of every scan visible to the caller.

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/ethiack/apis/ethiack-api.md) - [All operations](https://skmtc.dev/ethiack/apis/ethiack-api/llms.txt) - [OpenAPI document](https://skmtc.dev/ethiack/apis/ethiack-api/revisions/4eaba89bfebf?raw)
