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:

http://documentserver/web-apps/apps/api/documents/api.js

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:
http://documentserver/OfficeWeb/apps/api/documents/api.js

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="http://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": "http://example.com/url-to-example-document.docx",
    },
    "documentType": "text",
    "editorConfig": {
        "callbackUrl": "http://example.com/url-to-callback.ashx",
    },
};

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.

Support

You can ask our developers at dev.onlyoffice.org (registration required).