Cloudreve API Docs
  1. Upload
Cloudreve API Docs
  • Site
    • Ping
      GET
    • Get CAPTCHA
      GET
    • Get site settings
      GET
    • Report abuse
      POST
  • Session
    • Token
      • Password sign-in
      • Finish sign-in with 2FA
      • Refresh Token
      • Sign out
    • OpenID
      • Prepare OpenID sign-in
      • Finish OpenID sign-in
      • Unlink OpenID
    • Passkey
      • Prepare Passkey sign-in
      • Finish Passkey sign-in
    • Prepare login
  • User
    • Passkey
      • Prepare passkey registration
      • Finish passkey registration
      • Delete passkey
    • Setting
      • List available storage policies
      • List available nodes
      • Get preferences
      • Prepare enabling 2FA
      • Update preference setting
      • Update profile pricture
    • Sign up
    • Send reset password email
    • Reset password via temp link
    • Get profile picture
    • Get user
    • List user's share links
    • Get storage capacity
    • Search user
    • List credit changes
    • List payments
  • Callback
    • Complete OBS upload
    • Complete OneDrive upload
    • Complete COS upload
    • Complete S3 upload
  • Workflow
    • Remote Download
      • Create remote download
      • Select files to download
      • Cancel task
    • List tasks
    • Get task progress
    • Create archive
    • Extract archive
    • Relocate storage policy
    • Import external files
  • File
    • Permission
      • Set permission
      • Delete permission setting
    • Upload
      • Create upload session
        PUT
      • Upload file chunk
        POST
      • Delete upload session
        DELETE
    • Pin
      • Pin to sidebar
      • Delete a pin
    • Version
      • Set file version
      • Delete file version
    • Direct Link
      • Create direct links
      • Delete direct link
    • List files
      GET
    • List file activities
      GET
    • Get file info
      GET
    • Get thumbnail URL
      GET
    • Update file content
      PUT
    • Create viewer session
      PUT
    • Create file
      POST
    • Rename file
      POST
    • Move or copy files
      POST
    • Create download URL
      POST
    • Restore from trash bin
      POST
    • Delete file
      DELETE
    • Force unlock
      DELETE
    • Patch metadata
      PATCH
    • Mount storage policy
      PATCH
    • Update view setting
      PATCH
  • Share
    • Create share link
    • Edit share link
    • Get share link info
    • List my share links
    • Delete share link
  • VAS
    • Payment
      • Create a payment
      • Get payment status
    • GiftCode
      • Check gift code
      • Redeem gift code
  • Group
    • List groups
  • WebDAV
    • List accounts
    • Create account
    • Update account
    • Delete account
  1. Upload

Create upload session

PUT
/file/upload
Create a upload session, which is required before uploading files. After upload session created, client should start uploading using the information included in the upload session. The implementation of upload differs from different storage policy type, you can find Cloudreve's implentation in uploader.
A general file uploading includes 3 steps: Create upload session, upload chunks, finish upload request. For small files, please consider using Update file content.

1. Create upload session#

Use current method to create an upload session.

2. Upload chunks#

For local storage policy, or any other storage policy with storage_policy.relay set to true, use Upload file chunk;
For remote storage policy, send chunks to the URL defined in upload_urls, there should be only one element in upload_urls. The request is similar to Upload file chunk, except:
Chunk index is passed through query chunk, e.g. http://slavecloudreve.com:5213/api/v4/slave/upload/f1dd2c8c-0c51-475b-a086-b338ae1d8109?chunk=2
Authorization shoud be the value of credential in upload session, e.g. Bearer Cr sBnnQ3rZ-UBr7d8ohKpUFtsQc8OMLuWwn1VhuJtdc5k=:1749623351
For any other storage policies, please refer to:
S3: UploadPart
OSS: UploadPart
COS: UploadPart
OBS: Uploading Parts
OneDrive: Upload bytes to the upload session
Qiniu: 分块上传数据
Upyun: 大文件上传

3. Finish upload#

For local/remote/upyun storage policy, or any other storage policy with storage_policy.relay set to true, you don't need to finish upload, it's automatically finished after last chunk uploaded.
OneDrive: Complete OneDrive upload
S3: CompleteMultipartUpload, then send Complete S3 upload
COS: Complete Multipart Upload, then send Complete COS upload
OBS: Completing a Multipart Upload, then send Complete OBS upload
Qiniu: 完成文件上传

Request

Authorization
Add the parameter
Authorization
to Headers
,whose value is to concatenate the Token after the Bearer.
Example:
Authorization: Bearer ********************
Header Params

Body Params application/json

Example
{
    "uri": "cloudreve://my/Inspirations/archive%20(3).zip",
    "size": 65328441,
    "policy_id": "J7uV",
    "last_modified": 1749524701494,
    "mime_type": "application/zip"
}

Request Code 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/upload' \
--header 'Content-Type: application/json' \
--data-raw '{
    "uri": "cloudreve://my/Inspirations/archive%20(3).zip",
    "size": 65328441,
    "policy_id": "J7uV",
    "last_modified": 1749524701494,
    "mime_type": "application/zip"
}'

Responses

🟢200Success
application/json
Body

Example
{
    "code": 0,
    "data": {
        "session_id": "9897ebae-7b73-4169-aabc-6396f470e4bb",
        "upload_id": "",
        "chunk_size": 26214400,
        "expires": 1749620196,
        "storage_policy": {
            "id": "J7uV",
            "name": "Default storage policy",
            "type": "local",
            "max_size": 0
        },
        "uri": "cloudreve://my/Inspirations/archive%20(3).zip",
        "callback_secret": "0SivUl28p44BADmQDkTJrJOo7iozN74W"
    },
    "msg": ""
}
Modified at 2025-08-12 07:15:19
Previous
Delete permission setting
Next
Upload file chunk
Built with