# Attachment

## Download an attachment.

> Downloads the attachment body by the attachment ID, stream ID, and message ID.

```json
{"openapi":"3.0.1","info":{"title":"Agent API","version":"25.8.1"},"servers":[{"url":"youragentURL.symphony.com/agent"}],"paths":{"/v1/stream/{sid}/attachment":{"get":{"tags":["Attachments"],"summary":"Download an attachment.","description":"Downloads the attachment body by the attachment ID, stream ID, and message ID.","parameters":[{"name":"sid","in":"path","description":"Stream ID","required":true,"schema":{"type":"string"}},{"name":"fileId","in":"query","description":"The attachment ID (Base64-encoded)","required":true,"schema":{"type":"string"}},{"name":"messageId","in":"query","description":"The ID of the message containing the attachment","required":true,"schema":{"type":"string"}},{"name":"sessionToken","in":"header","description":"Session authentication token.","required":true,"schema":{"type":"string"}},{"name":"keyManagerToken","in":"header","description":"Key Manager authentication token.","schema":{"type":"string"}}],"responses":{"200":{"description":"Attachment body as Base64 encoded string.","content":{"application/octet-stream":{"schema":{"type":"string","format":"byte"}}}},"400":{"description":"Client error, see response body for further details.","content":{"application/octet-stream":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized: Session tokens invalid.","content":{"application/octet-stream":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Forbidden: Caller lacks necessary entitlement.","content":{"application/octet-stream":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Server error, see response body for further details.","content":{"application/octet-stream":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"schemas":{"Error":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}}}}}}
```

> #### 🚧 Note
>
> A successful call returns the attachment body encoded in Base64. Be sure to decode the downloaded attachment.

> #### 📘 Attachments
>
> * Anyone can download attachments from public rooms or rooms with *viewHistory* enabled.
> * The Content Export service user is able to download attachments even from rooms he is not a member of.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rest-api.symphony.com/main/messages/attachment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
