> For the complete documentation index, see [llms.txt](https://atlas.anywhere.now/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://atlas.anywhere.now/developer-docs/generic-dialogue-provider/attachments.md).

# Generic Dialogue Provider API attachments

Upload, download, and delete Generic Dialogue Provider message attachments.

Use these endpoints to manage message attachments. For shared path parameters and error behavior, see [Messages, dialogues, and attachments](/developer-docs/generic-dialogue-provider/messages-and-dialogues.md).

## POST /api/v1/message/{messageId}/attachment

Upload an attachment for a message.

Attachments are current API functionality. Availability can depend on the Generic Dialogue Provider attachment feature configuration.

### URL parameters

| Parameter   | Type   | Required | Description                |
| ----------- | ------ | -------- | -------------------------- |
| `messageId` | string | Yes      | Message ID in GUID format. |

### Request body

Send `multipart/form-data` with a `file` part.

| Field  | Type | Required | Description                                   |
| ------ | ---- | -------- | --------------------------------------------- |
| `file` | file | Yes      | Attachment file. The file size cannot be `0`. |

### Response

#### Success: 201 Created

```json
{
  "id": "8f14b9a5-bb29-4af6-9f28-8f8f4e1f5a5a"
}
```

| Field | Type   | Description            |
| ----- | ------ | ---------------------- |
| `id`  | string | Created attachment ID. |

#### Error responses

| Status                      | Description                                                                                                          |
| --------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| `400 Bad Request`           | `messageId` is not in GUID format, the file is missing, or the file size is `0`.                                     |
| `401 Unauthorized`          | The bearer token is missing or invalid.                                                                              |
| `404 Not Found`             | The message could not be found.                                                                                      |
| `409 Conflict`              | Generic Dialogue Provider settings are not available or the attachment cannot be added in the current message state. |
| `500 Internal Server Error` | The service could not process the request.                                                                           |

### Example

```bash
curl -X POST "<base-url>/api/v1/message/3657e938-d1ae-42f6-8b89-75e5e39f1be9/attachment" \
  -H "Authorization: Bearer <access-token>" \
  -F "file=@screenshot.png;type=image/png"
```

## GET /api/v1/message/{messageId}/attachment/{attachmentId}

Download an attachment.

### URL parameters

| Parameter      | Type   | Required | Description                   |
| -------------- | ------ | -------- | ----------------------------- |
| `messageId`    | string | Yes      | Message ID in GUID format.    |
| `attachmentId` | string | Yes      | Attachment ID in GUID format. |

### Response

#### Success: 200 OK

The endpoint returns the attachment file content. Successful responses can use `application/octet-stream`; error responses can use JSON.

#### Error responses

| Status                      | Description                                           |
| --------------------------- | ----------------------------------------------------- |
| `400 Bad Request`           | `messageId` or `attachmentId` is not in GUID format.  |
| `401 Unauthorized`          | The bearer token is missing or invalid.               |
| `404 Not Found`             | The message or attachment could not be found.         |
| `409 Conflict`              | Generic Dialogue Provider settings are not available. |
| `500 Internal Server Error` | The service could not process the request.            |

## DELETE /api/v1/message/{messageId}/attachment/{attachmentId}

Delete an attachment.

### URL parameters

| Parameter      | Type   | Required | Description                   |
| -------------- | ------ | -------- | ----------------------------- |
| `messageId`    | string | Yes      | Message ID in GUID format.    |
| `attachmentId` | string | Yes      | Attachment ID in GUID format. |

### Response

#### Success: 204 No Content

The attachment is deleted. The response body is empty.

#### Error responses

| Status                      | Description                                                                                                            |
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `400 Bad Request`           | `messageId` or `attachmentId` is not in GUID format.                                                                   |
| `401 Unauthorized`          | The bearer token is missing or invalid.                                                                                |
| `404 Not Found`             | The message or attachment could not be found.                                                                          |
| `409 Conflict`              | Generic Dialogue Provider settings are not available or the attachment cannot be deleted in the current message state. |
| `500 Internal Server Error` | The service could not process the request.                                                                             |

## Related topics

* [Messages, dialogues, and attachments](/developer-docs/generic-dialogue-provider/messages-and-dialogues.md)
* [Messages](/developer-docs/generic-dialogue-provider/messages.md)
* [Dialogues](/developer-docs/generic-dialogue-provider/dialogues.md)
* [Authentication](/developer-docs/generic-dialogue-provider/authentication.md)
* [Event subscriptions and callbacks](/developer-docs/generic-dialogue-provider/events.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://atlas.anywhere.now/developer-docs/generic-dialogue-provider/attachments.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
