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.
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.