DocSpace REST API samples
The following examples will show you how to use ONLYOFFICE DocSpace API implemented as REST over HTTP using GET/POST/PUT/DELETE to integrate ONLYOFFICE DocSpace into your own application and interact with its backend.
Basic samples
Authenticate a user
This example demonstrates how to authenticate a user in ONLYOFFICE DocSpace using the API and check the authentication with a token received.
Copy or move a file to a folder
This example demonstrates how to copy or move a file in ONLYOFFICE DocSpace.
Create and open a new file
This example demonstrates how to create a new file inside a specific folder in ONLYOFFICE DocSpace using the API. After creation, the file is automatically opened in the default web browser using the returned editor link.
Create a room and invite a user
This example demonstrates how to programmatically create a new room in ONLYOFFICE DocSpace and invite a user to it via email with specific access permissions.
Create a text file
This example demonstrates how to create a .txt file in a specified folder in ONLYOFFICE DocSpace using the API. You can set a custom title and content for the file when uploading it to a folder.
Create a virtual data room (VDR) with a watermark
This example demonstrates how to create a Virtual Data Room (VDR) in ONLYOFFICE DocSpace using the API. The room is created with a text watermark enabled, including dynamic elements such as UserName and CurrentDate.
Duplicate files and folders
This example demonstrates how to duplicate one or more files and folders in ONLYOFFICE DocSpace using the API. The duplicated items will appear in the same location with a modified title.
Get folder and room contents
This example demonstrates how to retrieve the contents of a folder or room in ONLYOFFICE DocSpace. The same API endpoint returns both files and subfolders.
Get login history
This example automates the retrieval of the last login events in ONLYOFFICE DocSpace. It extracts unique user IDs from the latest login records, ensuring that duplicate entries are removed.
Invite users
This example automates the process of creating new users and sending them invitations in ONLYOFFICE DocSpace. It ensures that only newly created users receive invitations, avoiding unnecessary duplicate invites.
Lock and unlock a file
This example demonstrates how to lock or unlock the specified file in ONLYOFFICE DocSpace and get a list of users and their access levels for the file.
Manage active portal connections
This example shows how to manage active user sessions in ONLYOFFICE DocSpace. You can retrieve active sessions, log out all users except the current one, terminate a specific session, or revoke all sessions for a particular user.
Manage files in "My Documents"
This example demonstrates how to interact with a user's personal space ("My Documents") in ONLYOFFICE DocSpace using the API. It includes retrieving contents, uploading a file, creating a new document, and deleting a file.
Manage files
This example demonstrates how to manage files in ONLYOFFICE DocSpace using the API. It covers creating, uploading, updating, and deleting files through API requests.
Manage folders
This example demonstrates how to manage folders in ONLYOFFICE DocSpace using the API. It covers creating, retrieving, renaming, and deleting folders through API requests.
Manage groups
This example demonstrates how to manage groups in ONLYOFFICE DocSpace using the API. It covers creating, retrieving, updating, and deleting groups through API requests. The script follows a logical sequence to demonstrate how to interact with the group management system in a real-world scenario.
Manage IP restrictions
This example demonstrates how to retrieve and update IP restriction settings in ONLYOFFICE DocSpace using API requests. IP restrictions enhance security by controlling which IP addresses are allowed access, ensuring that only authorized users can log in from designated networks.
Manage login settings
This example demonstrates how to configure login security settings, including failed login attempt limits, account blocking duration, and login monitoring periods using API requests. Managing these settings ensures better protection against brute-force attacks and unauthorized access.
Manage room links
This example demonstrates how to set and retrieve room invitation or external links in ONLYOFFICE DocSpace using the API. These links provide access to rooms based on specified permissions.
Manage rooms
This example demonstrates how to manage rooms in ONLYOFFICE DocSpace using the API. It covers creating, retrieving, renaming, archiving, and deleting rooms through API requests.
Manage the Trash section
This example demonstrates how to retrieve, restore, and empty the contents of the Trash section in ONLYOFFICE DocSpace using the API.
Manage user photo
This example demonstrates how to upload and delete user profile photos in ONLYOFFICE DocSpace using API requests. Managing user profile pictures helps create a personalized and professional experience within the system.
Manage users
This example demonstrates how to manage user accounts in ONLYOFFICE DocSpace using the API. It covers creating, retrieving, terminating, and deleting users, following a structured administrative workflow.
Restore file to previous version
This example demonstrates how to retrieve the edit history of a file in ONLYOFFICE DocSpace and restore it to a specific previous version using the API.
Retrieve user login audit events
This example demonstrates how to retrieve user login audit activities in ONLYOFFICE DocSpace. You can either fetch the most recent login records or apply filters such as user ID, action type, and time period.
Update group manager
This example demonstrates how to update group manager in ONLYOFFICE DocSpace.
Update user contacts
This example demonstrates how to create and retrieve user contacts in ONLYOFFICE DocSpace using API requests. Managing user contacts is crucial for maintaining accurate and up-to-date communication details within the system.
Update user role
This example demonstrates how to automate user onboarding in ONLYOFFICE DocSpace using the API. It covers creating a user, retrieving their profile, and updating their role.
Integration samples
Add DocSpace users to Trello
This script automates the process of retrieving DocSpace users and adding them to a Trello board. It ensures that all DocSpace team members are onboarded into Trello for project management.
Add Notion users to DocSpace
This script automates the process of retrieving Notion users and adding them to the DocSpace. It ensures that all Notion team members are onboarded into DocSpace.
Add Trello users to DocSpace
This script automates the process of retrieving Trello users and adding them to the DocSpace. It ensures that all Trello team members are onboarded into DocSpace.
Create DocSpace room from Trello board
This integration retrieves the name of a Trello board and creates a new room in ONLYOFFICE DocSpace with the same title. It's helpful for mirroring Trello project structures into your document collaboration environment.
Export DocSpace file to Dropbox
This integration allows you to automatically export files from DocSpace to Dropbox using a presigned download URL. It’s ideal for building document archiving workflows, offloading files to external storage, or syncing selected documents outside of the DocSpace environment.
Generate DocSpace structure from Asana projects
This integration creates collaboration rooms in ONLYOFFICE DocSpace based on Asana projects and generates folders for each task inside the corresponding room. This setup is ideal for aligning your document structure with your project management workflow.
Import Dropbox file to DocSpace
This integration allows you to automatically import files from Dropbox into a specific room in ONLYOFFICE DocSpace. It’s ideal for collecting external resources, migrating document libraries, or building automated submission workflows.
Import Trello card attachments to DocSpace
This integration allows you to automatically import all file attachments from a specific Trello card into an ONLYOFFICE DocSpace room. It's useful for syncing project files, archiving task assets, or aggregating external documentation into a centralized workspace.
Invite DocSpace user from Asana task
This integration automatically retrieves the email of the assignee from an Asana task and invites them to ONLYOFFICE DocSpace. It helps ensure that project contributors are granted access to collaborative workspaces without manual steps.
Share Dropbox folders with DocSpace group members
This integration automates the process of creating shared Dropbox folders for DocSpace group members and inviting them to collaborate.
Share Dropbox folders with DocSpace users
This integration automates the process of sharing Dropbox folders with DocSpace users.