Skip to content

Attach a file to the conversation

POST
/api/v1/chat/attachment
curl --request POST \
--url http://localhost:11044/api/v1/chat/attachment \
--header 'Content-Type: multipart/form-data' \
--header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \
--form file=@file

Stores the file, links it to the conversation, and raises an attachment.received signal that handlers may claim. Accepts any media type — what happens to a file is decided by dispatch, not by this endpoint. If more than one handler could take it, a question is posted into the conversation.

caption
string

Optional text posted as the user’s message the file is attached to; omitted or blank, the message reads [attached: <filename>]. Not yet read for routing intent — use target for that

target
string

Realm or capability id to route to. An instruction: it wins outright and proceeds even for irreversible work.

Media typemultipart/form-data
object
file
required

The file, as a multipart part; any media type is accepted, and its original filename and content type are kept (application/octet-stream when the part has none). Empty is a 400; the upload is bounded by the configured multipart limit (50MB as shipped)

string format: binary

Attachment accepted

Media type*/*

A file stored and linked to the conversation. What happens to it next is up to dispatch

object
attachmentId
required

The stored attachment’s id, which a later answer may name

string
filename
required

The file’s name as uploaded, or attachment where it had none

string
mimeType
required

The file’s media type as uploaded, or application/octet-stream where it had none

string
sizeBytes
required

The file’s size in bytes

integer format: int64
status
required

Always accepted

string

Example

accepted

Empty or oversized file

Media type*/*

A refusal from the attachment endpoints: the word error and the reason, written to be shown

object
message
required

Why the file or the answer was refused: an empty or oversized file, or no active chat session

string
status
required

Always error

string

Example

error

No active chat session

Media type*/*

A refusal from the attachment endpoints: the word error and the reason, written to be shown

object
message
required

Why the file or the answer was refused: an empty or oversized file, or no active chat session

string
status
required

Always error

string

Example

error