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

# Download results and access media

> Export completed run output through result, dataset, and media endpoints.

Once an execution reaches a terminal success state, switch from execution monitoring to these output-oriented APIs.

## Output access model

```mermaid theme={null}
flowchart TB
    Execution[Completed execution] --> Results[Result metadata]
    Results --> ExportJSON[Export JSON]
    Results --> DownloadCSV[Download CSV]
    Execution --> Datasets[Datasets]
    Execution --> Media[Media downloads]
```

## Result endpoints

| Need                 | Endpoint                                      | Use it when...                         |
| -------------------- | --------------------------------------------- | -------------------------------------- |
| Inspect availability | `GET /api/v1/executions/:id/results`          | You want metadata before downloading   |
| Download CSV         | `GET /api/v1/executions/:id/results/download` | You want a flat file export            |
| Export JSON or CSV   | `GET /api/v1/executions/:id/results/export`   | You want explicit export control       |
| Inspect datasets     | `GET /api/v1/executions/:id/datasets`         | You want dataset-level output metadata |

## Read result metadata

Start with:

```bash theme={null}
curl "$TITAN_API_URL/api/v1/executions/$EXECUTION_ID/results" \
  -H "Authorization: Bearer $TITAN_TOKEN"
```

This is useful for:

* Confirming output exists
* Checking format and timing metadata
* Deciding whether to export or inspect datasets next

## Export JSON

```bash theme={null}
curl "$TITAN_API_URL/api/v1/executions/$EXECUTION_ID/results/export" \
  -H "Authorization: Bearer $TITAN_TOKEN"
```

## Download CSV

```bash theme={null}
curl "$TITAN_API_URL/api/v1/executions/$EXECUTION_ID/results/download" \
  -H "Authorization: Bearer $TITAN_TOKEN" \
  -o results.csv
```

## Access datasets

Datasets are especially useful for recurring tasks and multi-run analysis:

```bash theme={null}
# Datasets for an execution
curl "$TITAN_API_URL/api/v1/executions/$EXECUTION_ID/datasets" \
  -H "Authorization: Bearer $TITAN_TOKEN"

# Datasets for a task (across all executions)
curl "$TITAN_API_URL/api/v1/tasks/$TASK_ID/datasets" \
  -H "Authorization: Bearer $TITAN_TOKEN"
```

## Media-aware outputs

When an output schema includes media fields, Titan stores media through ingestion and exposes stable platform URLs in the result data.

### Why Titan uses stable media URLs

| Platform behavior                              | Benefit                               |
| ---------------------------------------------- | ------------------------------------- |
| Media is uploaded through a commit flow        | Avoids raw object-store coupling      |
| Result payloads contain stable Titan URLs      | Makes result payloads durable         |
| Downloads are resolved through Titan endpoints | Enforces access control and ownership |

## Download media directly

```bash theme={null}
curl "$TITAN_API_URL/api/v1/executions/$EXECUTION_ID/media/$MEDIA_ID/download" \
  -H "Authorization: Bearer $TITAN_TOKEN" \
  -o media-file.png
```

## Recommended consumption pattern

1. Poll until the execution is `completed`
2. Fetch result metadata
3. Export JSON or CSV for structured data
4. Resolve media only in the application layer that needs it

This approach keeps storage concerns out of your main data pipeline.

## Troubleshooting

| Problem                                 | Check first                                                        |
| --------------------------------------- | ------------------------------------------------------------------ |
| Result endpoint returns nothing useful  | Ensure the execution is fully completed                            |
| CSV or JSON export fails                | Confirm you are using a result endpoint, not an execution endpoint |
| Media URL does not display in a browser | Use the platform download path or the correct export mode          |
| Datasets are missing                    | Check whether the task or execution produced dataset outputs       |

## Next steps

* [Datasets and media](/about-platform/datasets-and-media)
* [Example: media-aware scraping task](/examples/example-media-aware-scraping-task)
* [How workers return data to the platform](/worker-guides/how-workers-return-data-to-the-platform)
