# Content-Disposition header

> Indicates whether the body should be displayed inline or treated as a downloadable attachment.

Source: https://apiguide.dev/headers/content-disposition
Direction: response
Registered: yes
Defined in: RFC 6266 <https://www.rfc-editor.org/rfc/rfc6266.html>
Updated: 2026-07-10

## What is the Content-Disposition header?

The `Content-Disposition` response header tells the client how to present the body: rendered `inline` within the browser, or as an `attachment` that prompts a download. When set to `attachment`, it can also suggest a filename.

## API Usage & Best Practices

* **Trigger downloads**: Use `attachment; filename="report.csv"` when an API endpoint returns a file the user should save rather than view.
* **Display inline**: Use `inline` for previewable content such as PDFs or images meant to render directly.
* **Encode non-ASCII names**: Use the `filename*` parameter with UTF-8 encoding (RFC 5987) for filenames containing non-ASCII characters.

## Examples

```http
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Disposition: attachment; filename="export.csv"
```
