Conversion API

In order to convert different file formats in the online office, the POST request should be used. These requests are sent to the /cool/convert-to/<format>&<lang=xx-XX> or /lool/convert-to/<format>&<lang=xx-XX> endpoints.

Request parameters and their description

ParameterDescriptionTypePresence
formatThe output file format.stringrequired
PDFVerThe pdf version for the respective type of PDF to be used for the output file (PDF/A-1b, PDF/A-2b, etc.).stringoptional
FullSheetPreviewSpecifies if the full sheet previews will be available or not.bolleanoptional
fileA file to convert in the payload.objectrequired
langThe default format language. It is used for the date type cells. If the language is specified, it determines the display/output format.stringoptional

Sample of conversion request

  1. curl -F "data=sample.txt" https://documentserver/cool/convert-to/docx > result.docx

where the documentserver is the name of the server with the ONLYOFFICE Docs installed.

Sample of conversion request in the HTML format

  1. <form action="https://documentserver/cool/convert-to/docx" enctype="multipart/form-data" method="post">
  2. File: <input type="file" name="data"><br/>
  3. <input type="submit" value="Convert to DOCX">
  4. </form>

where the documentserver is the name of the server with the ONLYOFFICE Docs installed.

Sample of conversion request with the format parameter

  1. curl -F "data=sample.odt" -F "format=pdf" "PDFVer=PDF/A-2b" https://documentserver/cool/convert-to > result.pdf

where the documentserver is the name of the server with the ONLYOFFICE Docs installed.

Sample of conversion request with the format parameter in the HTML format

  1. <form action="https://documentserver/cool/convert-to" enctype="multipart/form-data" method="post">
  2. File: <input type="file" name="data"><br/>
  3. Format: <input type="text" name="format"><br/>
  4. <input type="submit" value="Convert">
  5. </form>

where the documentserver is the name of the server with the ONLYOFFICE Docs installed.