---
title: "POST /knowledgeBases/{knowledgeBaseId}/messageTemplates/{messageTemplateId}/attachments"
method: POST
path: "/knowledgeBases/{knowledgeBaseId}/messageTemplates/{messageTemplateId}/attachments"
---

# POST /knowledgeBases/{knowledgeBaseId}/messageTemplates/{messageTemplateId}/attachments

`POST /knowledgeBases/{knowledgeBaseId}/messageTemplates/{messageTemplateId}/attachments`

Uploads an attachment file to the specified Amazon Q in Connect message template. The name of the message template attachment has to be unique for each message template referenced by the <code>$LATEST</code> qualifier. The body of the attachment file should be encoded using base64 encoding. After the file is uploaded, you can use the pre-signed Amazon S3 URL returned in response to download the uploaded file.

## Path parameters

- `knowledgeBaseId` string, required
- `messageTemplateId` string, required

## Request body

- object
  - `contentDisposition` 'ATTACHMENT', required — The presentation information for the attachment file.
  - `name` string, password, required — The name of the attachment file being uploaded. The name should include the file extension.
  - `body` string, password, required — The body of the attachment file being uploaded. It should be encoded using base64 encoding.
  - `clientToken` string — A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see <a href="http://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.

## Response `200`

Success

- CreateMessageTemplateAttachmentResponse
  - `attachment` object — The message template attachment.
    - `contentDisposition` 'ATTACHMENT', required — The presentation information for the attachment file.
    - `name` string, password, required — The name of the attachment file being uploaded. The name should include the file extension.
    - `uploadedTime` string, date-time, required — The timestamp when the attachment file was uploaded.
    - `url` string, password, required — A pre-signed Amazon S3 URL that can be used to download the attachment file.
    - `urlExpiry` string, date-time, required — The expiration time of the pre-signed Amazon S3 URL.
    - `attachmentId` string, required — The identifier of the attachment file.

## Other responses

- `480` — ConflictException
- `481` — ValidationException
- `482` — ServiceQuotaExceededException
- `483` — UnauthorizedException
- `484` — AccessDeniedException
- `485` — ResourceNotFoundException
- `486` — ThrottlingException

---

[API](https://skmtc.net/aws/apis/qconnect.md) · [All operations](https://skmtc.net/aws/apis/qconnect/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/qconnect/versions/833f5de92023/schema)
