跳到主要内容

aiAttachmentsSaveFile

AiAttachment aiAttachmentsSaveFile(AiAttachmentsSaveFileRequest)

POST /api/2.0/ai/attachments/save-file

Save file

Stores one file attachment as a draft and returns it, so its ID can be attached to a message later. input carries the host path - the DocSpace entry ID the AI backend resolves server-side - the text content already extracted from that file, the ONLYOFFICE numeric file type, and optionally a title; the text is what the model reads, so this operation does not open the file itself. Archives are refused outright, whatever their declared name says. Drafts are not bound to a conversation until POST api/2.0/ai/attachments/link-to-message is called, so an unlinked draft outlives the round that created it.

Parameters​

NameInTypeDescriptionNotes
AiAttachmentsSaveFileRequestbodyAiAttachmentsSaveFileRequest[required]

Responses​

Status codeDescriptionTypeResponse headers
200The stored draft, whose ID links it to a message later.AiAttachment-
400The attachment payload is malformed.AiErrorResponse-
401Missing asc_auth_key cookie or Authorization header.AiErrorResponse-
403AI is disabled for this portal, the caller is a guest, or the room named by entityId is one the caller cannot open. Relayed from the DocSpace AI service or the Files API.AiErrorResponse-
413The request body is larger than 100 KB, the JSON parser's limit on this route.AiErrorResponse-
500Unhandled failure. The reason is logged server-side and never echoed back.AiErrorResponse-

Return type​

AiAttachment

Authorization​

cookieAuth, bearerAuth

HTTP request headers​

  • Content-Type: application/json
  • Accept: application/json