What is storage
The Storage APIs provide an intelligent and secure data management solution for organizations and meet the needs of office collaboration scenarios centered around file storage. Core capabilities include but are not limited to file upload, download, management, and transfer, online preview and editing of mainstream file formats, and permission management. You can use the Storage APIs to build everything from simple app attachments to fully featured cloud drive products. After your app integrates the Storage APIs, you can:- Transfer files efficiently between your app and other DingTalk apps.
- Meet the file governance needs of Organization Admins. For more information, see DingTalk admin console.
Open capability overview
Storage exposes a rich set of open API capabilities. Developers can integrate storage with their organization’s business systems through API calls.Organization management
| API | Description | API version |
|---|---|---|
| Obtain organization information | Obtains information about the organization’s storage. | New |
App
| API | Description | API version |
|---|---|---|
| Obtain group storage space information | Obtains information about a group storage space. | New |
| Send a storage file to a specified user as the app | Sends a file to a specified user as the app identity. | New |
| Send a file to a specified chat | Sends a file to a specified chat. | New |
| Send a file link to a specified chat | Sends a file link to a specified chat. | New |
| Obtain app information | Obtains information about the current app. | New |
Space management
| API | Description | API version |
|---|---|---|
| Add a space | Adds a new space within the organization’s storage. | New |
| Obtain space information | Obtains information about a storage space. | New |
File management
| API | Description | API version |
|---|---|---|
| Add a folder | Adds a folder within a storage space. | New |
| Copy a file or folder | Copies a file or folder. | New |
| Copy files or folders in bulk | Copies files or folders in bulk. | New |
| Move a file or folder | Moves the location of a file or folder. | New |
| Move files or folders in bulk | Moves files or folders in bulk. | New |
| Rename a file or folder | Renames a file or folder. | New |
| Delete a file or folder | Deletes a file or folder. | New |
| Delete files or folders in bulk | Deletes files or folders in bulk. | New |
| Restore a previous version of a file | Restores a previous version of a file. | New |
| Obtain the file version list | Obtains the version list of a file. | New |
| Obtain file or folder information | Obtains information about a file or folder. | New |
| Obtain file or folder information in bulk | Obtains information about files or folders in bulk. | New |
| Obtain the file or folder list | Obtains the list of files or folders within a space. | New |
| Obtain the list of all files or folders under a space | Obtains a flattened list of all files or folders under a space. | New |
| Obtain file preview or editing information | Obtains the preview or editing link of a file. | New |
| Update the app attributes of a file or folder | Updates the app attributes of a file or folder. | New |
| Delete the app attributes of a file or folder | Deletes the app attributes of a file or folder. | New |
| Obtain file thumbnails in bulk | Obtains thumbnail information of files in bulk. | New |
File transfer
| API | Description | API version |
|---|---|---|
| Obtain file upload information | Obtains file upload information. | New |
| Submit a file | Submits a file to complete the upload. | New |
| Initialize a multipart upload | Initializes a multipart upload of a file. | New |
| Obtain multipart upload information | Obtains the upload information for each part after a file is split. | New |
| Obtain file download information | Obtains download information of a file in a storage space. | New |
Permission management
| API | Description | API version |
|---|---|---|
| Add permissions | Adds permissions to a storage space. | New |
| Delete permissions | Deletes permissions from a storage space. | New |
| Modify permissions | Modifies the permissions of a storage space. | New |
| Obtain the permission list | Obtains the permission list of a storage space. | New |
| Set the permission inheritance mode | Sets the permission inheritance mode based on the file uuid, the operator’s unionId, and the inheritance mode. | New |
| Obtain the permission inheritance mode | Obtains the permission inheritance mode based on the file uuid and the operator’s unionId. | New |
Recycle Bin management
| API | Description | API version |
|---|---|---|
| Obtain Recycle Bin information | Obtains information about the Recycle Bin. | New |
| Obtain the recycle item list | Obtains the list of recycle items in the Recycle Bin. | New |
| Obtain recycle item information | Obtains information about a recycle item. | New |
| Restore a recycle item | Restores a recycle item. | New |
| Restore recycle items in bulk | Restores recycle items in bulk. | New |
| Delete a recycle item | Deletes a recycle item from the Recycle Bin. | New |
| Delete recycle items in bulk | Deletes recycle items in the Recycle Bin in bulk. | New |
| Empty the Recycle Bin | Empties the Recycle Bin based on its ID. | New |
Task management
| API | Description | API version |
|---|---|---|
| Obtain asynchronous task information in storage | Obtains information about asynchronous tasks in storage. | New |
Event subscription
| API | Description | API version |
|---|---|---|
| Subscribe to file change events | Subscribes to storage file change events. | New |
| Unsubscribe from file change events | Unsubscribes from storage file change events. | New |
Tutorials
DingTalk provides integration flow examples for the Storage APIs.| Tutorial | Description | Audience | Demo download |
|---|---|---|---|
| Upload, preview, and download Drive files | Upload, download, and preview Drive files. | All DingTalk developers | file-demo.zip |
| Upload local files to DingTalk Docs (My Docs) | Upload local files to the My Docs directory in DingTalk Docs. | All DingTalk developers | doc-demo.zip |
Resource reference
-
The Space resource includes the following attributes:
Attribute Type Description spaceId string The space ID. spaceName string The space name. spaceType string The space type. - USER: user space - APP: app space quota int64 The total capacity of the space. Note A value of -1 indicates that the space has no quota limit. If the space has an organization attribute, the quota cannot exceed the organization’s space quota. usedQuota int64 The used capacity of the space. createTime string (iso8601) The created time. modifyTime string (iso8601) The modified time. -
The File and folder resource includes the following attributes:
Attribute Type Description id string The ID of the file or folder. spaceId string The space ID. path string The path of the file or folder within the space. status string The status. - NORMAL: normal - DELETED: deleted - EXPIRED: expired partitionType string The storage partition. - PUBLIC_OSS_PARTITION: public cloud OSS storage partition - MINI_OSS_PARTITION: dedicated MiniOSS storage partition parentId string The parent folder ID. fileType string The file type. - FILE: file - FOLDER: folder extension string The file name extension. -
The Permission resource includes the following attributes:
Attribute Type Description id string The ID of the permission user. - If the type parameter is ORG, set this parameter to the organization’s corpId. - If the type parameter is DEPT, set this parameter to the deptId of the department. Call the Obtain the department list API to obtain the dept_id value. - If the type parameter is TAG, set this parameter to the tag name. - If the type parameter is CONVERSATION, set this parameter to the openConversationId of the chat, which is obtained through the create group chat API or the create scenario group API. - If the type parameter is USER, set this parameter to the user’s unionId. Call the Query user details API to obtain the unionid value. roleId string The permission role ID. - OWNER: owner - MANAGER: manager - EDITOR: editor - DOWNLOADER: downloader - READER: viewer type string The permission user type: - ORG: organization - DEPT: department - TAG: custom tag - CONVERSATION: chat - USER: user duration string The authorization validity period, in seconds. The default value is -1, which indicates permanent validity. - The authorization validity period takes effect when the space type of the granted permission is APP. - The authorization validity period does not take effect when the space type of the granted permission is USER, and defaults to permanent validity.