Basic concepts

ONLYOFFICE Document Server API is used to let the developers integrate the ONLYOFFICE Document/Spreadsheet/Presentation Editors into their own web sites and setup and manage the editors.

The API JavaScript file can normally be found in the following editors folder:


Where the documentserver is the name of the server with the ONLYOFFICE Document Server installed.

For Document Server versions prior to 4.0 the path to the API JavaScript file will look like this:

The target HTML file where the editors are to be embedded need to have a placeholder div tag, where all the information about the editor parameters will be passed:

<div id="placeholder"></div>
<script type="text/javascript" src="https://documentserver/web-apps/apps/api/documents/api.js"></script>

The page code containing the changeable parameters looks the following way:

var docEditor = new DocsAPI.DocEditor("placeholder", config);

Where config is an object:

config = {
    "document": {
        "fileType": "docx",
        "key": "Khirz6zTPdfd7",
        "title": "Example Document Title.docx",
        "url": ""
    "documentType": "text",
    "editorConfig": {
        "callbackUrl": ""

Where the is the name of the server where document manager and document storage service are installed. See the How it works section to find out more on Document Server service client-server interactions.

From now the docEditor object can be used to call the document editor Methods.

The example above includes all the parameters necessary for Document Server correct startup. There are additional non-obligatory parameters though which can be changed to achieve different goals with your document (change access rights for the document, display different information about the document, etc.). See the Advanced parameters section to find out what these parameters are and how you can change them.


You can ask our developers at (registration required).