Browser

When performing the client-side browser requests to ONLYOFFICE Document Server a token must be added to the parameters to validate the data.

Opening file

When a file is opened for editing in ONLYOFFICE Document Server, the token must be added to the configuration to validate the parameters.

The payload for the JWT token in the JSON format must have the same structure as the config.

Please note that starting from version 7.1, the parameter list to be signed will be strictly regulated. Don’t forget to add all the parameters listed below to your signature.

  1. {
  2. "document": {
  3. "key": "Khirz6zTPdfd7",
  4. "permissions": {
  5. "comment": true,
  6. "commentGroups": {
  7. "edit": ["Group2", ""],
  8. "remove": [""],
  9. "view": ""
  10. },
  11. "copy": true,
  12. "deleteCommentAuthorOnly": false,
  13. "download": true,
  14. "edit": true,
  15. "editCommentAuthorOnly": false,
  16. "fillForms": true,
  17. "modifyContentControl": true,
  18. "modifyFilter": true,
  19. "print": true,
  20. "review": true,
  21. "reviewGroups": ["Group1", "Group2", ""]
  22. },
  23. "url": "https://example.com/url-to-example-document.docx"
  24. },
  25. "editorConfig": {
  26. "callbackUrl": "https://example.com/url-to-callback.ashx",
  27. "mode": "edit",
  28. "user": {
  29. "group": "Group1",
  30. "id": "78e1e841",
  31. "name": "Smith"
  32. }
  33. }
  34. }

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 Document Server service client-server interactions.

Sample token

  1. eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb2N1bWVudCI6eyJrZXkiOiJLaGlyejZ6VFBkZmQ3IiwicGVybWlzc2lvbnMiOnsiY29tbWVudCI6dHJ1ZSwiY29tbWVudEdyb3VwcyI6eyJlZGl0IjpbIkdyb3VwMiIsIiJdLCJyZW1vdmUiOlsiIl0sInZpZXciOiIifSwiY29weSI6dHJ1ZSwiZGVsZXRlQ29tbWVudEF1dGhvck9ubHkiOmZhbHNlLCJkb3dubG9hZCI6dHJ1ZSwiZWRpdCI6dHJ1ZSwiZWRpdENvbW1lbnRBdXRob3JPbmx5IjpmYWxzZSwiZmlsbEZvcm1zIjp0cnVlLCJtb2RpZnlDb250ZW50Q29udHJvbCI6dHJ1ZSwibW9kaWZ5RmlsdGVyIjp0cnVlLCJwcmludCI6dHJ1ZSwicmV2aWV3Ijp0cnVlLCJyZXZpZXdHcm91cHMiOlsiR3JvdXAxIiwiR3JvdXAyIiwiIl19LCJ1cmwiOiJodHRwczovL2V4YW1wbGUuY29tL3VybC10by1leGFtcGxlLWRvY3VtZW50LmRvY3gifSwiZWRpdG9yQ29uZmlnIjp7ImNhbGxiYWNrVXJsIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS91cmwtdG8tY2FsbGJhY2suYXNoeCIsIm1vZGUiOiJlZGl0IiwidXNlciI6eyJncm91cCI6Ikdyb3VwMSIsImlkIjoiNzhlMWU4NDEiLCJuYW1lIjoiU21pdGgifX19.irYst9vmsLoQtC-95A-6W8DnbqGXCbmcxJajfbPh6tQ

Methods

  • insertImage - when calling the insertImage method to insert an image into the file, the token must be added to validate the parameters.

    The payload for the JWT token in the JSON format must have the same structure as the method parameter. The parameter list to be signed is not strictly regulated, but we recommend that you specify all the parameter sent:

    1. {
    2. "c": "add",
    3. "images": [
    4. {
    5. "fileType": "png",
    6. "url": "https://example.com/url-to-example-image.png"
    7. }
    8. ]
    9. }

    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 Document Server service client-server interactions.

    Sample token

    1. eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjIjoiYWRkIiwiaW1hZ2VzIjpbeyJmaWxlVHlwZSI6InBuZyIsInVybCI6Imh0dHBzOi8vZXhhbXBsZS5jb20vdXJsLXRvLWV4YW1wbGUtaW1hZ2UucG5nIn1dfQ._tPxpJrPbom_f83qgX4_AB9v1cfK2LSQsfomfl7zJ58
  • setHistoryData - when calling the setHistoryData method to view the document history version in ONLYOFFICE Document Server, the token must be added to validate the parameters.

    The payload for the JWT token in the JSON format must have the same structure as the method parameter. The parameter list to be signed is not strictly regulated, but we recommend that you specify all the parameter sent:

    1. {
    2. "changesUrl": "https://example.com/url-to-changes.zip",
    3. "key": "Khirz6zTPdfd7",
    4. "previous": {
    5. "key": "af86C7e71Ca8",
    6. "url": "https://example.com/url-to-the-previous-version-of-the-document.docx"
    7. },
    8. "url": "https://example.com/url-to-example-document.docx",
    9. "version": 2
    10. }

    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 Document Server service client-server interactions.

    Sample token

    1. eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjaGFuZ2VzVXJsIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS91cmwtdG8tY2hhbmdlcy56aXAiLCJrZXkiOiJLaGlyejZ6VFBkZmQ3IiwicHJldmlvdXMiOnsia2V5IjoiYWY4NkM3ZTcxQ2E4IiwidXJsIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS91cmwtdG8tdGhlLXByZXZpb3VzLXZlcnNpb24tb2YtdGhlLWRvY3VtZW50LmRvY3gifSwidXJsIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS91cmwtdG8tZXhhbXBsZS1kb2N1bWVudC5kb2N4IiwidmVyc2lvbiI6Mn0.7gaOe1_4OvgRLYD0oGk_bMrVdPaLmgZVNIgQCUQdgoE
  • setMailMergeRecipients - when calling the setMailMergeRecipients method to insert recipient data for mail merge into the file, the token must be added to validate the parameters.

    The payload for the JWT token in the JSON format must have the same structure as the method parameter. The parameter list to be signed is not strictly regulated, but we recommend that you specify all the parameter sent:

    1. {
    2. "fileType": "xlsx",
    3. "url": "https://example.com/url-to-example-recipients.xlsx"
    4. }

    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 Document Server service client-server interactions.

    Sample token

    1. eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmaWxlVHlwZSI6Inhsc3giLCJ1cmwiOiJodHRwczovL2V4YW1wbGUuY29tL3VybC10by1leGFtcGxlLXJlY2lwaWVudHMueGxzeCJ9.P3TjOyX1Tv3xAVRAc8qtNb-uFLD6FH_WErag_rbI6nQ
  • setReferenceData - when calling the setReferenceData method to insert data into the spreadsheet by an external link, the token must be added to validate the parameters.

    The payload for the JWT token in the JSON format must have the same structure as the method parameter. The parameter list to be signed is not strictly regulated, but we recommend that you specify all the parameter sent:

    1. {
    2. "fileType": "xlsx",
    3. "path": "sample.xlsx",
    4. "referenceData": {
    5. "fileKey": "BCFA2CED",
    6. "instanceId": "https://example.com"
    7. },
    8. "url": "https://example.com/url-to-example-document.xlsx"
    9. }

    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 Document Server service client-server interactions.

    Sample token

    1. eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmaWxlVHlwZSI6Inhsc3giLCJwYXRoIjoic2FtcGxlLnhsc3giLCJyZWZlcmVuY2VEYXRhIjp7ImZpbGVLZXkiOiJCQ0ZBMkNFRCIsImluc3RhbmNlSWQiOiJodHRwczovL2V4YW1wbGUuY29tIn0sInVybCI6Imh0dHBzOi8vZXhhbXBsZS5jb20vdXJsLXRvLWV4YW1wbGUtZG9jdW1lbnQueGxzeCJ9.UXosmM-E_Cu9j9QGSlcj9FEoSu5m-zCS4b6FxO_2k7w
  • setRevisedFile - when calling the setRevisedFile method to select a document for comparing, the token must be added to validate the parameters.

    The payload for the JWT token in the JSON format must have the same structure as the method parameter. The parameter list to be signed is not strictly regulated, but we recommend that you specify all the parameter sent:

    1. {
    2. "fileType": "docx",
    3. "url": "https://example.com/url-to-example-document.docx"
    4. }

    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 Document Server service client-server interactions.

    Sample token

    1. eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmaWxlVHlwZSI6ImRvY3giLCJ1cmwiOiJodHRwczovL2V4YW1wbGUuY29tL3VybC10by1leGFtcGxlLWRvY3VtZW50LmRvY3gifQ.t8660n_GmxJIppxcwkr_mUxmXYtE8cg-jF2cTLMtuk8