Skip to main content
POST
Upload an attachment

Authorizations

Authorization
string
header
required

A project API key, created in the dashboard.

Headers

Idempotency-Key
string

A unique key that makes the request safe to retry, such as a V4 UUID. 1 to 255 printable ASCII characters.

Required string length: 1 - 255

Path Parameters

conversation
string
required

ID of the conversation.

Body

multipart/form-data
file
file
required

The file. Its type is detected from its contents, and its name is returned as filename.

Response

The stored file, waiting to be sent.

A file uploaded for the user's next message. To send it, pass its id in attachment_ids.

object
any
required
conversation_id
string
required
id
string
required

Unique identifier for the attachment, stable across requests.

type
enum<string>
required
Available options:
image,
video,
audio,
document
mime
string | null
required

The MIME type, such as image/png. null if the channel didn't report one.

filename
string | null
required

The original file name. null if the channel didn't send one.

size
integer | null
required

The size in bytes. null for channel media, whose size is only known once downloaded.

url
string<uri> | null
required

A link to download the file, valid until url_expires_at. It doesn't need an API key, so treat it as a secret. List the messages again to get a new link. Channels can remove files at any time, and the link then returns 410 attachment_unavailable. null if a link couldn't be created. Listing again retries.

url_expires_at
string<date-time> | null
required

Time at which url expires, 5 minutes after the request. null if url is.