{"id":31697193,"url":"https://github.com/onlyoffice/docspace-sdk-js","last_synced_at":"2025-10-28T23:38:17.056Z","repository":{"id":232810856,"uuid":"784658550","full_name":"ONLYOFFICE/docspace-sdk-js","owner":"ONLYOFFICE","description":"Simple integration JavaScript SDK for ONLYOFFICE DocSpace","archived":false,"fork":false,"pushed_at":"2025-10-16T14:12:19.000Z","size":579,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-10-17T17:17:16.739Z","etag":null,"topics":["docspace","integration"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ONLYOFFICE.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-04-10T09:40:45.000Z","updated_at":"2025-04-16T12:47:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"ab6f230d-e45d-480d-8496-b268a9a28d22","html_url":"https://github.com/ONLYOFFICE/docspace-sdk-js","commit_stats":null,"previous_names":["onlyoffice/docspace-sdk-js"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ONLYOFFICE/docspace-sdk-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ONLYOFFICE%2Fdocspace-sdk-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ONLYOFFICE%2Fdocspace-sdk-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ONLYOFFICE%2Fdocspace-sdk-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ONLYOFFICE%2Fdocspace-sdk-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ONLYOFFICE","download_url":"https://codeload.github.com/ONLYOFFICE/docspace-sdk-js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ONLYOFFICE%2Fdocspace-sdk-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281533479,"owners_count":26517826,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docspace","integration"],"created_at":"2025-10-08T18:00:51.517Z","updated_at":"2025-10-28T23:38:17.050Z","avatar_url":"https://github.com/ONLYOFFICE.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ONLYOFFICE DocSpace JavaScript SDK\n\n## Basic concepts\n\nThe ONLYOFFICE DocSpace SDK based on JavaScript allows developers to use all the DocSpace possibilities with *api.js*. You can integrate ONLYOFFICE DocSpace into your own web application, allowing users to create and submit documents directly from your website. For example, you can use the ONLYOFFICE DocSpace [React component](https://api.onlyoffice.com/docspace/javascript-sdk/get-started/react-component/) to integrate ONLYOFFICE DocSpace into React projects.\n\nYou don't need to be an experienced JavaScript developer to use the DocSpace JavaScript SDK because we provide you with all the basics. You only need a few lines of JavaScript to set up a fully functional integration.\n\nFollow the steps below to connect DocSpace as a frame to your website.\n\n## Step 1. Specifying the DocSpace URL\n\nFor the JavaScript SDK to work correctly, it must be launched on the server. Note that running the HTML file directly will not work. Please make sure you are using a server environment.\n\nYou need to add the URL of your server's root directory to the **Developer Tools** section of DocSpace:\n\n1. Go to the DocSpace settings.\n2. Navigate to the **Developer Tools** section.\n3. On the **JavaScript SDK** tab, in the **Enter the address of DocSpace to embed** field, add the URL of your server's root directory.\n\n## Step 2. Creating the HTML file\n\nCreate the target HTML file which must include a placeholder *div* tag, where all the information about DocSpace parameters will be passed:\n\n``` html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n    \u003chead\u003e\n        \u003cmeta charset=\"UTF-8\"\u003e\n        \u003ctitle\u003eDocSpace JavaScript SDK\u003c/title\u003e\n        \u003cscript src=\"{PORTAL_SRC}/static/scripts/sdk/2.0.0/api.js\"\u003e\u003c/script\u003e\n    \u003c/head\u003e\n    \u003cbody\u003e\n        \u003cdiv id=\"ds-frame\"\u003e\u003c/div\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n\nThe API JavaScript file can normally be found in the following DocSpace folder:\n\n`{PORTAL\\_SRC}/static/scripts/sdk/2.0.0/api.js`\n\nwhere **{PORTAL\\_SRC}** is the name of the server with the ONLYOFFICE DocSpace installed.\n\n## Step 3. Getting the base class\n\nWhen the API JavaScript is connected to the page, get the base class that provides all the basic functionality of *api.js*:\n\n| Class        | Description                                                                                                                               |\n| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |\n| DocSpace.SDK | Defines the DocSpace document manager and allows you to perform operations with rooms, folders, and documents within the DocSpace portal. |\n\n## Step 4. Authorizing\n\n*api.js* uses the active DocSpace application sessions to authenticate users. If the user is logged in to the DocSpace portal that the SDK will connect to, then *api.js* recognizes and uses that active session.\n\nIf the users are not authenticated, they will see a page asking them to sign in to DocSpace the first time they use it. Authentication is also possible through the SDK [methods](https://api.onlyoffice.com/docspace/javascript-sdk/usage-sdk/methods/#login).\n\n## Step 5. Initializing\n\n\u003e Please note that when working via HTTPS, it is necessary to set the **\"SameSite\": \"none\"** parameter in *appsettings.json* to avoid blocking the work with cookies during cross-domain requests.\n\nInitialize DocSpace frame using the [initFrame](https://api.onlyoffice.com/docspace/javascript-sdk/usage-sdk/methods/#initframe) method with the SDK config passed to it:\n\n``` ts\nconst docSpace = DocSpace.SDK.initFrame({\n  frameId: \"frameId\",\n  showMenu: true,\n})\n```\n\nYou can use other available [methods](https://api.onlyoffice.com/docspace/javascript-sdk/usage-sdk/methods/) to initialize DocSpace.\n\nThe full list of [config parameters](https://api.onlyoffice.com/docspace/javascript-sdk/usage-sdk/config/) can be found here.\n\n## Step 6. Using\n\nAfter initialization, the current SDK instance can be accessed by using its [frameId](https://api.onlyoffice.com/docspace/javascript-sdk/usage-sdk/config/#frameid). The list of current SDK instances is available in the *DocSpace.SDK.frames* array. To get the specific SDK instance, use the following string:\n\n``` ts\nDocSpace.SDK.frames[frameId]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonlyoffice%2Fdocspace-sdk-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonlyoffice%2Fdocspace-sdk-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonlyoffice%2Fdocspace-sdk-js/lists"}