---
title: "Stream the latest version of a resource as a forced download"
method: GET
path: "/datasets/r/{id}"
tags: ["datasets"]
---

# Stream the latest version of a resource as a forced download

`GET /datasets/r/{id}`

## Request

- Base URL: `https://dados.gov.pt/api/1`
- URL: `https://dados.gov.pt/api/1/datasets/r/{id}`
- Auth: none declared

See LEDG-1765. Replaces the previous 302 redirect, which let the
browser render the file inline (PDFs, images, HTML, etc.) and
ignored cross-origin `download` attributes. Both code paths emit
`Content-Disposition: attachment` so the browser always saves the
file to disk.

- Hosted resources (`fs_filename` set) are streamed from the
  storage backend via `send_file(as_attachment=True)`.
- OGC services (WMS/WFS) keep the pre-LEDG-1765 302 redirect —
  see `_is_ogc_service`.
- Other remote resources are pulled through the SSRF-guarded
  download proxy (LEDG-1214), reusing `stream_as_attachment`.

The endpoint URL is unchanged, so the permanent `latest` link of
a resource keeps working for harvesters and external integrations.

## Query parameters

- `dataset` string

## Response `200`

Success

---

[API](https://skmtc.dev/dados/apis/udata-api.md) - [All operations](https://skmtc.dev/dados/apis/udata-api/llms.txt) - [OpenAPI document](https://skmtc.dev/dados/apis/udata-api/revisions/77edaf8a00ea?raw)
