---
title: "Download an attachment"
method: GET
path: "/v1/messages/{id}/attachments/{index}"
tags: ["messages"]
---

# Download an attachment

`GET /v1/messages/{id}/attachments/{index}`

## Request

- Base URL: `https://api.mailfixture.com`
- URL: `https://api.mailfixture.com/v1/messages/{id}/attachments/{index}`
- Auth: HTTP bearer

Decoded bytes of one attachment, served as a forced download: `Content-Type` is always `application/octet-stream` and disposition is always `attachment` regardless of the declared type (emails are hostile input). The filename is sanitized to `[A-Za-z0-9. _-]`, 80 chars max.

## Path parameters

- `id` string, uuid, required
- `index` integer, required

## Response `200`

The decoded attachment bytes.

## Other responses

- `401`: Missing bearer token, malformed key, or unknown/revoked/invalid API key.
- `404`: No such message, no servable attachment at that index (nested message/multipart parts are not servable), or the offloaded raw MIME object no longer exists.
- `429`: Per-key rate limit exceeded. `Retry-After` says when the next request will be admitted; the RateLimit headers name the bucket that refused (`requests` or `creates`) with `r=0`.
- `500`: Unexpected server error. `detail` is null — internals are never leaked.
- `503`: The raw MIME was offloaded to object storage and the store is unavailable or not configured.

---

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