---
title: "Upload attachments"
method: POST
path: "/inbox/v1/virtual-agent/conversations/{conversationId}/attachments/{filename}"
tags: ["Inbox"]
---

# Upload attachments

`POST /inbox/v1/virtual-agent/conversations/{conversationId}/attachments/{filename}`

## Request

- Base URL: `https://platform.hootsuite.com`
- URL: `https://platform.hootsuite.com/inbox/v1/virtual-agent/conversations/{conversationId}/attachments/{filename}`
- Auth: OAuth 2
  - Authorization code: `https://platform.hootsuite.com/oauth2/auth`
  - Token URL: `https://platform.hootsuite.com/oauth2/token`

This allows you to upload an attachment that you can send in a conversation. You need to upload the attachment first,
and then you can send a message with text and an attachment. For example, if you upload an attachment
to `/inbox/v1/virtual-agent/conversations/attachments/cat.jpg`, you can send that attachment by sending

```json
{
  "sendMessage": {
    "text": "This is a cat!",
    "attachment": "cat.jpg"
  }
}
```

to `/inbox/v1/virtual-agent/conversations/{conversationId}`. The file name should be unique within a conversation and is visible to the contact
if they download your attachment.

The `Content-Type` header should contain the correct mime-type of the attachment (such as `image/jpeg`).
The `Content-Length` header should contain the size of the attachment in bytes. Attachments should be fewer than 10
megabytes to prevent error.

## Path parameters

- `conversationId` string, required
- `filename` string, required

## Headers

- `Content-Type` string, required
- `Content-Length` string, required

## Request body `application/octet-stream`

- string, binary

## Response `200`

The attachment is uploaded and ready to use in your conversation. Note: after uploading the attachment to Inbox 2.0,
you still need to specifically send it to the contact

- object

## Other responses

- `400`: The request is malformed. This can happen because the filename contains an invalid character, or because the attachment type cannot be sent to the medium.
- `401`: Unauthorized: when using an invalid or expired access token.
- `404`: The conversation id does not exist or is no longer assigned to the virtual agent.

---

[API](https://skmtc.dev/hootsuite/apis/hootsuite-rest-api.md) - [All operations](https://skmtc.dev/hootsuite/apis/hootsuite-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/hootsuite/apis/hootsuite-rest-api/revisions/adac53bd28bb?raw)
