:::endpoint GET /v1/me/ai/messages/{id}/attachments/{index}

The file itself, back to the person who attached it. Use the `url` of a file in
a message's `attachments`, which is this path with the message's `id` and the
file's `index` already in it.

Not JSON: the body is the file, as for a
[mail attachment](/docs/api/mail/attachments).

## Request

```bash
curl https://api.proppertrading.com/v1/me/ai/messages/aimsg_dkr8n8ctvh9qtmce/attachments/0 \
  -H "Authorization: Bearer ptat_9f2c1a44_3b8e7d2f5c9a1b4e6d8f0a2c4e6b8d1f" \
  -o chart.png
```

## Response

```
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Length: 90
Content-Disposition: attachment; filename=chart.png
X-Content-Type-Options: nosniff
```

:::warning The type is always octet-stream
Whatever the file is, as on the website. A file that calls itself a picture can
hold anything, so decide what to do with the bytes on your side. The message
already says which files are images in `content_type`.
:::

## Errors

| Status | Code | Meaning |
| ------ | ---- | ------- |
| 400 | `workspace_required` | Our own staff, without a firm in `Propper-Workspace` |
| 403 | `ai_unavailable` | The firm has the assistant switched off for this chat |
| 403 | `forbidden` | Staff whose role does not include `use_ai_chat` |
| 403 | `insufficient_scope` | This device does not hold `ai:read` |
| 404 | `resource_not_found` | No such file, a message of somebody else or of another chat, or the file is no longer stored |