Self-hosted

ONLYOFFICE Docs is available for Windows, Linux and Docker.

To install it on your local server:

  1. Download ONLYOFFICE Docs Developer solution and install it on your local server following the instructions in ONLYOFFICE Help Center:

  2. In the target HTML file where the editors are to be embedded, specify 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>
    

    Where documentserver is the name of the server with the ONLYOFFICE Docs installed. In this case, this is an address of you local server (http://localhost).

    https://documentserver/web-apps/apps/api/documents/api.js is the address where the API JavaScript file can normally be found.

    Starting from version 8.1, it is recommended to add the shardkey parameter to the URL QueryString with the key value in it. For example, ?shardkey=Khirz6zTPdfd7. This allows you to load balance requests.

  3. Specify the page code containing the changeable parameters:

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

    Where config is an object:

    const config = {
      document: {
        fileType: "docx",
        key: "Khirz6zTPdfd7",
        title: "Example Document Title.docx",
        url: "https://example.com/url-to-example-document.docx",
      },
      documentType: "word",
      editorConfig: {
        callbackUrl: "https://example.com/url-to-callback.ashx",
      },
    }
    

    Where example.com 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 ONLYOFFICE Docs 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 ONLYOFFICE Docs correct startup.

  4. Specify the additional non-obligatory parameters that 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.

  5. Add an encrypted signature to the requests in the form of token to prevent the substitution of important parameters.

Before you start

Before working with ONLYOFFICE Docs API documentation, it is recommended to make the following settings if necessary:

Health check

To check if the editors are available, send the GET request to /healthcheck. This request checks the availability of the databases, message broker, Redis connection, and storage.

The response must be true, which means that the editors are ready to use.

If something went wrong, make sure that you have followed the installation instructions above.

Next steps

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).