Get Started
Usage API
More information

POST api/2.0/mail/messages/{id}/document This function requires authentication

Description

Attaches a document to the message with the ID specified in the request.

Parameters
Name Description Type Example
id
sent in url
Message ID number 1234
fileId
sent in body
Document ID string some text
version
sent in body
Document version string some text
needSaveToTemp
sent in body
Specifies if this document needs to be saved to a template message or not Bool value true
Example
POST api/2.0/mail/messages/1234/document
Host: yourportal.onlyoffice.com
Content-Type: application/json
Accept: application/json

{
  "fileId": "some text",
  "version": "some text",
  "needSaveToTemp": true
}
Returns

Attached document

Example Response

application/json

{
  "status": 0,
  "response": {
    "fileId": 1234,
    "fileName": "fileName",
    "size": 1234,
    "contentType": "contentType",
    "needSaveToTemp": true,
    "contentId": "contentId",
    "fileNumber": 333,
    "storedName": "storedName",
    "streamId": "streamId",
    "savedToMyDocuments": true,
    "tempStoredUrl": "tempStoredUrl"
  }
}

text/xml

<result>
  <status>0</status>
  <response>
    <fileId>1234</fileId>
    <fileName>fileName</fileName>
    <size>1234</size>
    <contentType>contentType</contentType>
    <needSaveToTemp>True</needSaveToTemp>
    <contentId>contentId</contentId>
    <fileNumber>333</fileNumber>
    <storedName>storedName</storedName>
    <streamId>streamId</streamId>
    <savedToMyDocuments>True</savedToMyDocuments>
    <tempStoredUrl>tempStoredUrl</tempStoredUrl>
  </response>
</result>