Skip to content

API Introduction

Cloudreve server provides RESTful API interfaces, which you can use to perform operations such as file management, user management, and system management for Cloudreve.

Routes

Except for a few special redirect routes, all API routes start with /api/v4/.

Responses

Except for a few special routes, all API routes return data in JSON format. The HTTP response code is fixed at 200, and actual error information is returned through the code and message fields.

json
{
  "data": ..., // Any type
  "code": 0, // 0 means no error
  "msg": ""
}

Error Codes

The definition of error codes can be found in the error.go file. Below is a reference list:

CodeDescription
203Not Fully Successful
401Not Logged In
403No Permission to Access
404Resource Not Found
409Resource Conflict
40001Parameter Error
40002Upload Failed
40003Folder Creation Failed
40004Object Already Exists
40005Signature Expired
40006Current Storage Policy Not Allowed
40007User Group Not Allowed for This Operation
40008Admin Privileges Required
40009Master Node Not Registered
40010Phone Binding Required
40011Upload Session Expired
40012Invalid Chunk Index
40013Invalid Content Length
40014Batch Source Size Limit Exceeded
40015Maximum Aria2 Task Limit Exceeded
40016Parent Directory Does Not Exist
40017User Banned
40018User Not Activated
40019Feature Not Enabled
40020Invalid Credentials
40021User Not Found
400222FA Code Error
40023Login Session Does Not Exist
40024Cannot Initialize WebAuthn
40025Invalid WebAuthn Credential
40026Captcha Error
40027Captcha Refresh Needed
40028Failed to Send Email
40029Invalid Temporary Link
40030Temporary Link Expired
40031Email Provider Banned
40032Email Already Exists
40033Email Has Been Resent
40034User Cannot Be Activated
40035Storage Policy Does Not Exist
40036Cannot Delete Default Storage Policy
40037Storage Policy Still Has Files
40038Storage Policy Bound to User Groups
40039User Group Not Found
40040Invalid Action on System Group
40041User Group in Use
40042Cannot Change Group for Default User
40043Invalid Action on Default User
40044File Not Found
40045Failed to List Files
40046Invalid Action on System Node
40047Failed to Create File System
40048Failed to Create Task
40049File Too Large
40050File Type Not Allowed
40051Insufficient User Capacity
40052Illegal Object Name
40053Root Directory Protected
40054File with Same Name Being Uploaded
40055Metadata Mismatch
40056Unsupported Archive Type
40057Available Storage Policy Changed
40058Share Link Not Found
40059Cannot Save Own Share
40060Slave Cannot Send Callback to Master
40061Cloudreve Version Mismatch
40062Insufficient Credit
40063Group Conflict
40064Already in Current User Group
40065Invalid Gift Code
40066Account Already Bound
40067Account Bound to Another User
40068Account Not Linked
40069Incorrect Password
40070Share Preview Disabled
40071Invalid Signature
40072Admin Cannot Purchase User Group
40073Lock Conflict
40074Too Many URIs
40075Lock Token Expired
40076Current Version is Stale
40077Entity Does Not Exist
40078File is in Recycle Bin
40079File Count Limit Reached
40080Invalid Password
40081Batch Operation Not Fully Completed
40082Owner Operation Only
40083Purchase Required
40084Managed Account Minimum OpenID
40085Amount Too Small
40086Node Used by Storage Policy
40087Domain Not Licensed
50001Database Operation Failed
50002Encryption Failed
50004IO Operation Failed
50005Internal Setting Parameter Error
50006Cache Operation Failed
50007Callback Failed
50008Failed to Update Backend Settings
50009Failed to Add CORS Policy
50010Node Offline
50011Failed to Query File Metadata