> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encrata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Download Workflow Run

> Download the enriched CSV output of a completed workflow run.

## Authentication

Requires a JWT token or API key in the `Authorization` header.

```bash theme={"dark"}
Authorization: Bearer YOUR_TOKEN
```

## Request

<ParamField path="id" type="string" required>
  The run ID whose output CSV you want to download.
</ParamField>

### Example request

```bash theme={"dark"}
curl -L "https://encrata.com/api/agent/workflows/runs/run_abc123/download" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -o results.csv
```

## Response

Responds with `302 Found` and a `Location` header pointing to a short-lived,
presigned URL for the run's generated CSV. Follow the redirect (curl's `-L`) to
download the file.

<Note>
  Output is only available once the run has finished producing results. Poll
  [Get Workflow Run](/api-reference/endpoint/get-workflow-run) until the run
  reports `success` before downloading.
</Note>

<ResponseExample>
  ```text 302 theme={"dark"}
  Location: https://<presigned-s3-url>/run_abc123-output.csv
  ```

  ```json 401 theme={"dark"}
  {
    "error": "unauthorized"
  }
  ```

  ```json 404 theme={"dark"}
  {
    "error": "no output for this run"
  }
  ```

  ```json 503 theme={"dark"}
  {
    "error": "downloads are not configured"
  }
  ```
</ResponseExample>
