- Site
- Session
- User
- Callback
- Workflow
- File
- Permission
- Upload
- Pin
- Version
- Direct Link
- List filesGET
- List file activitiesGET
- Get file infoGET
- Get thumbnail URLGET
- Update file contentPUT
- Create viewer sessionPUT
- Create filePOST
- Rename filePOST
- Move or copy filesPOST
- Create download URLPOST
- Restore from trash binPOST
- Delete fileDELETE
- Force unlockDELETE
- Patch metadataPATCH
- Mount storage policyPATCH
- Update view settingPATCH
- Share
- VAS
- Group
- WebDAV
Create viewer session
PUT
/file/viewerSession
Auth: JWT Optional
Request
Authorization
Add the parameter
Authorization
to Headers,whose value is to concatenate the Token after the Bearer.Example:
Authorization: Bearer ********************
Header Params
X-Cr-Purchase-Ticket
string
optional
Example:
1f63aa26-edc0-40ce-950a-cb4d4323158e
Body Params application/json
version
string | null
optional
Example:
zOe1D
viewer_id
string
required
file_viewers
in Get site settings under explorer
section.Example:
af01b85b-f57d-46d2-8ad6-1d9b96548e78
preferred_action
enum<string>
required
Allowed values:
editview
parent_uri
string | null
optional
Usualy it can be calculated from
uri
field. But for single-file symbolic links, uri
can be a different folder or filesystem from where the symbolic link is located.Example:
cloudreve://my/Inspirations
Example
{
"uri": "cloudreve://JbVTn@share/1.docx",
"viewer_id": "af01b85b-f57d-46d2-8ad6-1d9b96548e78",
"preferred_action": "edit",
"parent_uri": "cloudreve://my/Inspirations"
}
Request samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request PUT '/file/viewerSession' \
--header 'X-Cr-Purchase-Ticket: 1f63aa26-edc0-40ce-950a-cb4d4323158e' \
--header 'Content-Type: application/json' \
--data-raw '{
"uri": "cloudreve://JbVTn@share/1.docx",
"viewer_id": "af01b85b-f57d-46d2-8ad6-1d9b96548e78",
"preferred_action": "edit",
"parent_uri": "cloudreve://my/Inspirations"
}'
Responses
🟢200Success
application/json
Body
data
object
optional
session
object
required
wopi_src
string | null
optional
code
integer
required
0
- Success.Default:
0
Example:
0
msg
string
optional
error
string | null
optional
correlation_id
string <uuid> | null
optional
Example:
b4351ecc-ee1a-4455-bc94-2c3dbcc58538
Example
{
"code": 0,
"data": {
"session": {
"id": "7f50a377-e55b-41f3-a64e-3624e9cd120d",
"access_token": "7f50a377-e55b-41f3-a64e-3624e9cd120d.y0SWlTrJFWd2dcPg7fcyx2tSovFpsq45U2iHGfjeyYq23Zkq5KOnyLgcwPkwZEy27gKLQW4b9Lv713Objot2dvsiuJq4vbDKvx637mnolww35tDbIMOdJKDUb5J8qDzD",
"expires": 1749576616773
},
"wopi_src": "http://localhost:9980/browser/594b605/cool.html?WOPISrc=http%3A%2F%2Fhost.docker.internal%3A5212%2Fapi%2Fv4%2Ffile%2Fwopi%2F6Zebb3Ug\u0026lang=lng"
},
"msg": ""
}
Modified at 2025-06-10 08:30:10