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

# Download an attachment

> GET /v1/attachments/{id}/content: download a file attached to a message, through a link valid for 5 minutes

Downloads a file attached to a message. Get the attachment IDs from the `attachments` of each message in [List messages](https://docs.replyful.com/api-reference/conversations/messages.md).

```http theme={null}
GET /v1/attachments/{id}/content
```

The API does not send the file itself. It responds `302` with a `Location` header that points to a download link, valid for 5 minutes. Follow the redirect to get the file.

* Your API key is checked on every call, so a saved response never holds a link that keeps working.
* Do not send the `Authorization` header to the redirected host. curl and `fetch` drop it across hosts by default.
* Each call counts toward the [rate limit](https://docs.replyful.com/api-reference/rate-limits.md).

## Authentication

Bearer token in the `Authorization` header. A read-only key is enough. See [Authentication](https://docs.replyful.com/api-reference/authentication.md).

```http theme={null}
Authorization: Bearer rfl_live_...
```

## Path parameters

**id** `string` *required*

Attachment ID prefixed with `ea_`.

## Response

`302 Found` with no body.

**Location** `header`

The download link. Valid for 5 minutes. Call the endpoint again for a new one.

The filename, content type and size are on the [message's attachment](https://docs.replyful.com/api-reference/conversations/messages.md#the-message-object).

## Examples

### Download a file

```bash curl theme={null}
curl -L https://api.replyful.com/v1/attachments/ea_6tXw2qKb8mRf3cN7p/content \
  -H "Authorization: Bearer rfl_live_..." \
  -o receipt.pdf
```

```ts Node.js theme={null}
import { writeFile } from "node:fs/promises";

// fetch follows the redirect and drops the Authorization header on the way.
const res = await fetch(
  "https://api.replyful.com/v1/attachments/ea_6tXw2qKb8mRf3cN7p/content",
  { headers: { Authorization: `Bearer ${process.env.REPLYFUL_API_KEY}` } },
);
if (!res.ok) {
  throw new Error(`Download failed: ${res.status}`);
}
await writeFile("receipt.pdf", Buffer.from(await res.arrayBuffer()));
```

```http Response theme={null}
HTTP/1.1 302 Found
Location: https://files.example.com/receipt.pdf?X-Amz-Expires=300&X-Amz-Signature=...
Cache-Control: no-store
```

## Error responses

| Status | `error.code` | When |
| - | - | - |
| `401` | `missing_api_key` | The `Authorization` header is absent. |
| `401` | `invalid_api_key` | The token is malformed, unknown, or archived. |
| `404` | `attachment_not_found` | The attachment does not exist, belongs to another organization, or was erased with its ticket. |
| `422` | `invalid_path_parameter` | The `id` path parameter is not a valid attachment ID. |
| `429` | `too_many_requests` | Rate limit exceeded. Honor `Retry-After`. |

See [Errors](https://docs.replyful.com/api-reference/errors.md) for the full error envelope reference.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.