Attach a file to the conversation
const url = 'http://localhost:11044/api/v1/chat/attachment';const form = new FormData();form.append('file', 'file');
const options = {method: 'POST', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>'}};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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=@fileStores 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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”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
Realm or capability id to route to. An instruction: it wins outright and proceeds even for irreversible work.
Request Body
Section titled “Request Body”object
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)
Responses
Section titled “Responses”Attachment accepted
A file stored and linked to the conversation. What happens to it next is up to dispatch
object
The stored attachment’s id, which a later answer may name
The file’s name as uploaded, or attachment where it had none
The file’s media type as uploaded, or application/octet-stream where it had none
The file’s size in bytes
Always accepted
Example
acceptedEmpty or oversized file
A refusal from the attachment endpoints: the word error and the reason, written to be shown
object
Why the file or the answer was refused: an empty or oversized file, or no active chat session
Always error
Example
errorNo active chat session
A refusal from the attachment endpoints: the word error and the reason, written to be shown
object
Why the file or the answer was refused: an empty or oversized file, or no active chat session
Always error
Example
error
