### 列出文件和文件夹请求示例 Source: https://openapi.ctfile.com/ 请求列出文件和文件夹,支持搜索和筛选。参数包括 xtlink、folder_id、keyword、filter、orderby、start 和 session。 ```json { "xtlink": "xtc61380487-d67238530-c7daf9-5124", "filter": "", "folder_id": "d0", "orderby": "old", "keyword": "小苹果", "session": "f924c2ae06b14157403b7ad4ca93a9aa" } ``` -------------------------------- ### POST /v1/public/folder/create Source: https://openapi.ctfile.com/ 在指定位置创建新文件夹。 ```APIDOC ## POST /v1/public/folder/create ### Description 在指定位置创建新文件夹。 ### Method POST ### Endpoint /v1/public/folder/create ### Parameters #### Request Body - **session** (string) - Required - 登录获取的 session token - **name** (string) - Required - 文件夹名称 - **folder_id** (string) - Optional - 父文件夹ID(默认0为根目录) - **description** (string) - Optional - 文件夹描述 - **is_hidden** (boolean) - Optional - 是否隐藏文件夹 ### Request Example { "session": "f924c2ae06b14157403b7ad4ca93a9aa", "name": "我的文件夹", "folder_id": "0", "description": "这是一个测试文件夹", "is_hidden": false } ### Response #### Success Response (200) - **code** (integer) - 状态码 - **message** (string) - 提示信息 - **folder_id** (string) - 新文件夹ID - **path** (string) - 文件夹路径 #### Response Example { "code": 200, "message": "文件夹创建成功", "folder_id": "d123456", "path": "/我的文件夹" } #### Error Response (403) - **code** (integer) - 错误码 - **message** (string) - 错误信息 - **folder_id** (string) - 文件夹ID - **folder_path** (string) - 文件夹路径 #### Error Response Example { "code": 403, "message": "该文件夹名已经存在", "folder_id": "d123456", "folder_path": "/我的文件夹" } ``` -------------------------------- ### 获取文件下载链接成功响应 Source: https://openapi.ctfile.com/ 获取文件下载链接的成功响应,返回 download_url 字段。 ```json { "code": 200, "download_url": "https://download.ctfile.com/..." } ``` -------------------------------- ### POST /v1/browser/file/list Source: https://openapi.ctfile.com/ 根据 xtlink 列出分享的文件和文件夹,支持搜索和筛选。 ```APIDOC ## [POST] /v1/browser/file/list ### Description 根据 xtlink 列出分享的文件和文件夹,支持搜索和筛选。 ### Method POST ### Endpoint /v1/browser/file/list ### Parameters #### Path Parameters - **xtlink** (string) - Required - 分享链接代码 - **folder_id** (string) - Optional - 文件夹ID(默认 "d0" 表示根目录) - **keyword** (string) - Optional - 搜索关键词(至少3个字符) - **filter** (string) - Optional - 文件类型筛选:all/video/music/picture/document/app/zip/other - **orderby** (string) - Optional - 排序方式:new/old/az/za/big/small - **start** (integer) - Optional - 分页起始位置(默认 0) - **session** (string) - Optional - 如果已登录,可传入 session ### Request Example { "xtlink": "xtc61380487-d67238530-c7daf9-5124", "filter": "", "folder_id": "d0", "orderby": "old", "keyword": "小苹果", "session": "f924c2ae06b14157403b7ad4ca93a9aa" } ### Response #### Success Response (200) - **code** (integer) - 状态码 - **num** (integer) - 当前返回的结果数量(不是总数) - **folder_id** (string) - 当前文件夹ID - **folder_path** (string) - 当前文件夹的完整路径 - **results** (array) - 文件和文件夹列表 - **key** (string) - 文件或文件夹ID - **icon** (string) - 图标类型 - **name** (string) - 名称 - **date** (string) - 日期 - **status** (integer) - 状态 - **imgsrc** (string) - 缩略图地址(图片/视频/音频文件有效) - **size** (integer) - 文件大小 - **xturl** (string) - 小通链接(xturl 格式) - **xtid** (string) - 加密的文件ID,用于获取下载链接 #### Response Example { "code": 200, "num": 10, "folder_id": "d0", "folder_path": "/我的文件夹", "results": [ { "key": "d123", "icon": "folder", "name": "我的文件夹", "date": "2023-11-15 10:30:00", "status": 1 }, { "key": "f456", "icon": "mp3", "name": "小苹果.mp3", "imgsrc": "https://thumbnails.ctfile.com/audio/abc123.mp3", "size": 5242880, "date": "2023-11-15 10:30:00", "xturl": "ctfile://xturlABC123...", "xtid": "ABC123...", "status": 1 } ] } #### Error Response (401) { "code": 401, "message": "未登录" } ``` -------------------------------- ### 准备下载文件成功响应 Source: https://openapi.ctfile.com/ 成功响应示例,返回文件下载信息列表,包含文件 key、icon、userid、name、size 和 path。 ```json { "code": 200, "results": [ { "key": "f123456", "icon": "pdf", "userid": 61380487, "name": "document.pdf", "size": 1048576, "path": "/" }, { "key": "f789012", "icon": "mp4", "userid": 61380487, "name": "video.mp4", "size": 52428800, "path": "/我的文件夹/" } ] } ``` -------------------------------- ### POST /v1/public/file/list Source: https://openapi.ctfile.com/ 列出用户自己的文件,支持筛选、搜索、分页等功能。与 browser API 类似,但用于管理自己的文件。 ```APIDOC ## POST /v1/public/file/list ### Description 列出用户自己的文件,支持筛选、搜索、分页等功能。与 browser API 类似,但用于管理自己的文件。 ### Method POST ### Endpoint /v1/public/file/list ### Parameters #### Request Body - **session** (string) - Required - 登录获取的 session token ### Response #### Success Response (200) - **code** (integer) - 状态码 - **results** (array) - 文件列表(具体字段未在文档中列出) ``` -------------------------------- ### POST /v1/browser/file/download Source: https://openapi.ctfile.com/ 获取指定文件和文件夹的下载信息列表。 ```APIDOC ## [POST] /v1/browser/file/download ### Description 获取指定文件和文件夹的下载信息列表。 ### Method POST ### Endpoint /v1/browser/file/download ### Parameters #### Path Parameters - **xtlink** (string) - Required - 分享链接代码 - **ids** (string) - Required - 文件/文件夹ID列表,逗号分隔(如 "f123,d456") ### Request Example { "xtlink": "xtc61380487-d67238530-c7daf9-5124", "ids": "f123456,d789012" } ### Response #### Success Response (200) - **code** (integer) - 状态码 - **results** (array) - 下载信息列表 - **key** (string) - 文件或文件夹ID - **icon** (string) - 图标类型 - **userid** (integer) - 用户ID - **name** (string) - 名称 - **size** (integer) - 文件大小 - **path** (string) - 路径 #### Response Example { "code": 200, "results": [ { "key": "f123456", "icon": "pdf", "userid": 61380487, "name": "document.pdf", "size": 1048576, "path": "/" }, { "key": "f789012", "icon": "mp4", "userid": 61380487, "name": "video.mp4", "size": 52428800, "path": "/我的文件夹/" } ] } ``` -------------------------------- ### 转存文件请求示例 Source: https://openapi.ctfile.com/ 请求转存文件到自己的空间,需要登录。参数包括 xtlink、ids 和 session。 ```json { "xtlink": "xtc61380487-d67238530-c7daf9-5124", "ids": "f123456,d789012", "session": "f924c2ae06b14157403b7ad4ca93a9aa" } ``` -------------------------------- ### POST /v1/browser/file/fetch_url Source: https://openapi.ctfile.com/ 获取单个文件的实际下载地址。 ```APIDOC ## POST /v1/browser/file/fetch_url ### Description 获取单个文件的实际下载地址。 ### Method POST ### Endpoint /v1/browser/file/fetch_url ### Parameters #### Request Body - **xtlink** (string) - Required - 分享链接代码 - **file_id** (string) - Required - 文件ID(不带 f 前缀) - **carrier** (integer) - Optional - 运营商节点选择 ### Response #### Success Response (200) - **code** (integer) - 状态码 - **download_url** (string) - 下载地址 #### Response Example { "code": 200, "download_url": "https://download.ctfile.com/..." } ``` -------------------------------- ### POST /v1/public/folder/meta Source: https://openapi.ctfile.com/ 获取文件夹的详细信息。 ```APIDOC ## POST /v1/public/folder/meta ### Description 获取文件夹的详细信息。 ### Method POST ### Endpoint /v1/public/folder/meta ### Parameters #### Request Body - **session** (string) - Required - 登录获取的 session token - **folder_id** (string) - Required - 文件夹ID(不带 d 前缀) ### Response #### Success Response (200) - **code** (integer) - 状态码 - **key** (string) - 文件夹标识 - **key_id** (integer) - 文件夹ID - **name** (string) - 文件夹名称 - **description** (string) - 文件夹描述 - **path** (string) - 路径 - **date** (string) - 创建时间 - **parent_folder_id** (integer) - 父文件夹ID - **folder_count** (integer) - 子文件夹数量 - **document_count** (integer) - 文件数量 - **total_size** (integer) - 总大小 - **is_hidden** (integer) - 是否隐藏 - **pinned** (integer) - 是否置顶 - **icon** (string) - 图标 - **folder_id** (string) - 文件夹ID #### Response Example ```json { "code": 200, "key": "d123456", "key_id": 123456, "name": "我的文件夹", "description": "文件夹描述", "path": "/", "date": "2023-11-15 10:30:00", "parent_folder_id": 0, "folder_count": 5, "document_count": 20, "total_size": 10485760, "is_hidden": 0, "pinned": 0, "icon": "folder", "folder_id": "d0" } ``` ``` -------------------------------- ### POST /v1/public/folder/list Source: https://openapi.ctfile.com/ 列出指定文件夹下的所有子文件夹。 ```APIDOC ## POST /v1/public/folder/list ### Description 列出指定文件夹下的所有子文件夹。 ### Method POST ### Endpoint /v1/public/folder/list ### Parameters #### Request Body - **session** (string) - Required - 登录获取的 session token - **folder_id** (string) - Optional - 文件夹ID(默认0为根目录) - **orderby** (string) - Optional - 排序方式:new/old/az/za/big/small ### Response #### Success Response (200) - **code** (integer) - 状态码 - **folder_path** (string) - 文件夹路径 - **results** (array) - 子文件夹列表 - **key** (string) - 文件夹ID - **icon** (string) - 图标类型 - **name** (string) - 文件夹名称 - **date** (string) - 日期时间 #### Response Example { "code": 200, "folder_path": "/", "results": [ { "key": "d123", "icon": "folder", "name": "文档", "date": "2023-11-15 10:30:00" }, { "key": "d456", "icon": "folder", "name": "图片", "date": "2023-11-15 11:00:00" } ] } ``` -------------------------------- ### POST /v1/public/file/fetch_url Source: https://openapi.ctfile.com/ 获取用户自己文件的下载地址。VIP用户有更高的下载速度。 ```APIDOC ## POST /v1/public/file/fetch_url ### Description 获取用户自己文件的下载地址。VIP用户有更高的下载速度。 ### Method POST ### Endpoint /v1/public/file/fetch_url ### Parameters #### Request Body - **session** (string) - Required - 登录获取的 session token - **file_id** (string) - Required - 文件ID(不带 f 前缀) - **carrier** (integer) - Optional - 运营商节点选择 ### Response #### Success Response (200) - **code** (integer) - 状态码 - **download_url** (string) - 下载地址 #### Response Example { "code": 200, "download_url": "https://download.ctfile.com/..." } ``` -------------------------------- ### POST /v1/browser/file/meta Source: https://openapi.ctfile.com/ 获取文件的详细信息,包括名称、大小、描述等。 ```APIDOC ## [POST] /v1/browser/file/meta ### Description 获取文件的详细信息,包括名称、大小、描述等。 ### Method POST ### Endpoint /v1/browser/file/meta ### Parameters #### Path Parameters - **xtlink** (string) - Required - 分享链接代码 - **file_id** (string) - Required - 文件ID(不带 f 前缀) ### Request Example { "xtlink": "xtc61380487-d67238530-c7daf9-5124", "file_id": "123456" } ### Response #### Success Response (200) - **code** (integer) - 状态码 - **key** (string) - 文件ID(带 f 前缀) - **file_id** (integer) - 文件ID - **name** (string) - 文件名 - **description** (string) - 文件描述 - **size** (integer) - 文件大小 - **date** (string) - 日期 - **views** (integer) - 浏览次数 - **extension** (string) - 文件扩展名 - **icon** (string) - 图标类型 #### Response Example { "code": 200, "key": "f123456", "file_id": 123456, "name": "document.pdf", "description": "文件描述", "size": 1048576, "date": "2023-11-15 10:30:00", "views": 100, "extension": "pdf", "icon": "pdf" } ``` -------------------------------- ### 列出文件和文件夹错误响应(未登录) Source: https://openapi.ctfile.com/ 未登录时的错误响应,返回 401 状态码和错误消息。 ```json { "code": 401, "message": "未登录" } ``` -------------------------------- ### POST /v1/union/info/switch_mode Source: https://openapi.ctfile.com/ 切换联盟收益模式(低收益/高收益/关闭)。 ```APIDOC ## POST /v1/union/info/switch_mode ### Description 切换联盟收益模式(低收益/高收益/关闭)。 ### Method POST ### Endpoint /v1/union/info/switch_mode ### Parameters #### Request Body - **session** (string) - Required - 登录获取的 session token - **mode** (integer) - Required - 收益模式:0=关闭,1=低收益,5+=高收益 ### Request Example { "session": "f924c2ae06b14157403b7ad4ca93a9aa", "mode": 5 } ### Response #### Success Response (200) - **code** (integer) - 状态码 - **message** (string) - 提示信息 #### Response Example { "code": 200, "message": "高收益模式已开启" } ``` -------------------------------- ### 列出文件和文件夹成功响应 Source: https://openapi.ctfile.com/ 成功响应示例,返回文件列表。字段说明:num 为当前返回结果数量,folder_path 为当前文件夹路径,imgsrc 为缩略图地址,xturl 为小通链接,xtid 为加密文件ID。 ```json { "code": 200, "num": 10, "folder_id": "d0", "folder_path": "/我的文件夹", "results": [ { "key": "d123", "icon": "folder", "name": "我的文件夹", "date": "2023-11-15 10:30:00", "status": 1 }, { "key": "f456", "icon": "mp3", "name": "小苹果.mp3", "imgsrc": "https://thumbnails.ctfile.com/audio/abc123.mp3", "size": 5242880, "date": "2023-11-15 10:30:00", "xturl": "ctfile://xturlABC123...", "xtid": "ABC123...", "status": 1 } ] } ``` -------------------------------- ### 列出文件夹成功响应 Source: https://openapi.ctfile.com/ 列出文件夹的成功响应,返回当前文件夹路径和子文件夹列表,每个子文件夹包含 key、icon、name 和 date 字段。 ```json { "code": 200, "folder_path": "/", "results": [ { "key": "d123", "icon": "folder", "name": "文档", "date": "2023-11-15 10:30:00" }, { "key": "d456", "icon": "folder", "name": "图片", "date": "2023-11-15 11:00:00" } ] } ``` -------------------------------- ### 创建文件夹请求、成功响应与错误响应 Source: https://openapi.ctfile.com/ 创建文件夹的请求示例,包含 session、name、folder_id、description 和 is_hidden 参数。成功响应返回新文件夹的 ID 和路径;错误响应(如文件夹名已存在)返回 403 错误码。 ```json { "session": "f924c2ae06b14157403b7ad4ca93a9aa", "name": "我的文件夹", "folder_id": "0", "description": "这是一个测试文件夹", "is_hidden": false } ``` ```json { "code": 200, "message": "文件夹创建成功", "folder_id": "d123456", "path": "/我的文件夹" } ``` ```json { "code": 403, "message": "该文件夹名已经存在", "folder_id": "d123456", "folder_path": "/我的文件夹" } ``` -------------------------------- ### 分享文件请求与成功响应 Source: https://openapi.ctfile.com/ 请求示例展示分享文件所需的 session 和 ids 参数。成功响应返回每个文件/文件夹的分享链接信息,包括 weblink、xtcode 和 drlink(文件夹的 drlink 为 null)。 ```json { "session": "f924c2ae06b14157403b7ad4ca93a9aa", "ids": "f123456,d789012" } ``` ```json { "code": 200, "results": [ { "key": "f123456", "icon": "pdf", "name": "document.pdf", "weblink": "https://url.ctfile.com/f/12345-67890-abcdef (访问密码:1234)", "xtcode": "ctfile://xtc12345-f67890-abcdef-1234", "drlink": "https://drfs.ctcontents.com/file/12345/67890/abcdef/document.pdf", "size": 1048576, "date": "2023-11-15 10:30:00" }, { "key": "d789012", "icon": "folder", "name": "我的文件夹", "weblink": "https://url.ctfile.com/d/12345-789012-abcdef", "xtcode": "ctfile://xtc12345-d789012-abcdef-1234", "drlink": null, "size": 0, "date": "2023-11-15 11:00:00" } ] } ``` -------------------------------- ### POST /v1/public/file/share Source: https://openapi.ctfile.com/ 创建文件或文件夹的分享链接,支持批量分享多个文件/文件夹。 ```APIDOC ## POST /v1/public/file/share ### Description 创建文件或文件夹的分享链接。支持批量分享多个文件/文件夹。 ### Method POST ### Endpoint /v1/public/file/share ### Parameters #### Request Body - **session** (string) - Required - 登录获取的 session token - **ids** (string) - Required - 文件/文件夹ID列表,逗号分隔(如 "f123,d456") ### Request Example { "session": "f924c2ae06b14157403b7ad4ca93a9aa", "ids": "f123456,d789012" } ### Response #### Success Response (200) - **code** (integer) - 状态码 - **results** (array) - 分享结果列表 - **key** (string) - 文件/文件夹ID - **icon** (string) - 图标类型 - **name** (string) - 名称 - **weblink** (string) - 网页访问链接(如果有密码会显示在链接后) - **xtcode** (string) - 小通链接,用于移动端或API访问 - **drlink** (string|null) - 直链地址,仅文件有效,文件夹为 null - **size** (integer) - 文件大小(字节) - **date** (string) - 日期时间 #### Response Example { "code": 200, "results": [ { "key": "f123456", "icon": "pdf", "name": "document.pdf", "weblink": "https://url.ctfile.com/f/12345-67890-abcdef (访问密码:1234)", "xtcode": "ctfile://xtc12345-f67890-abcdef-1234", "drlink": "https://drfs.ctcontents.com/file/12345/67890/abcdef/document.pdf", "size": 1048576, "date": "2023-11-15 10:30:00" }, { "key": "d789012", "icon": "folder", "name": "我的文件夹", "weblink": "https://url.ctfile.com/d/12345-789012-abcdef", "xtcode": "ctfile://xtc12345-d789012-abcdef-1234", "drlink": null, "size": 0, "date": "2023-11-15 11:00:00" } ] } ``` -------------------------------- ### 移动文件成功响应 Source: https://openapi.ctfile.com/ 移动文件或文件夹的成功响应,返回操作成功的消息。注意不能将文件夹移动到自身或其子文件夹中。 ```json { "code": 200, "message": "文件/文件夹已移动到新的位置" } ``` -------------------------------- ### 批量获取文件信息成功响应 (POST /v1/public/file/ids_list) Source: https://openapi.ctfile.com/ 该 JSON 示例展示了批量获取文件信息接口的成功响应。响应包含一个结果数组,每个元素包含文件的关键信息,如 key、图标、名称、大小、日期和状态。 ```json { "code": 200, "results": [ { "key": "f123", "icon": "pdf", "name": "document.pdf", "imgsrc": "", "size": 1048576, "date": "2023-11-15 10:30:00", "status": 1 } ] } ``` -------------------------------- ### 准备下载文件请求示例 Source: https://openapi.ctfile.com/ 请求准备下载文件,参数包括 xtlink 和 ids(文件/文件夹ID列表,逗号分隔)。 ```json { "xtlink": "xtc61380487-d67238530-c7daf9-5124", "ids": "f123456,d789012" } ``` -------------------------------- ### POST /v1/public/file/move Source: https://openapi.ctfile.com/ 将文件或文件夹移动到指定位置。 ```APIDOC ## POST /v1/public/file/move ### Description 将文件或文件夹移动到指定位置。 ### Method POST ### Endpoint /v1/public/file/move ### Parameters #### Request Body - **session** (string) - Required - 登录获取的 session token - **ids** (string) - Required - 文件/文件夹ID列表,逗号分隔 - **folder_id** (string) - Required - 目标文件夹ID(0为根目录) ### Response #### Success Response (200) - **code** (integer) - 状态码 - **message** (string) - 提示信息 #### Response Example { "code": 200, "message": "文件/文件夹已移动到新的位置" } ``` -------------------------------- ### POST /v1/browser/file/save Source: https://openapi.ctfile.com/ 将分享的文件或文件夹转存到自己的账号中。需要登录。 ```APIDOC ## [POST] /v1/browser/file/save ### Description 将分享的文件或文件夹转存到自己的账号中。需要登录。 ### Method POST ### Endpoint /v1/browser/file/save ### Parameters #### Path Parameters - **xtlink** (string) - Required - 分享链接代码 - **ids** (string) - Required - 文件/文件夹ID列表,逗号分隔 - **session** (string) - Required - 登录获取的 session token ### Request Example { "xtlink": "xtc61380487-d67238530-c7daf9-5124", "ids": "f123456,d789012", "session": "f924c2ae06b14157403b7ad4ca93a9aa" } ### Response #### Success Response (200) - **code** (integer) - 状态码 - **message** (string) - 提示信息 #### Response Example { "code": 200, "message": "文件/文件夹已保存" } #### Error Response (403) { "code": 403, "message": "转存总数(150个)超过限制(100个),请升级会员" } ``` -------------------------------- ### POST /v1/browser/file/ids_list Source: https://openapi.ctfile.com/ 根据文件/文件夹 ID 列表批量获取详细信息。 ```APIDOC ## [POST] /v1/browser/file/ids_list ### Description 根据文件/文件夹 ID 列表批量获取详细信息。 ### Method POST ### Endpoint /v1/browser/file/ids_list ### Parameters #### Path Parameters - **xtlink** (string) - Required - 分享链接代码 - **ids** (string) - Required - 文件/文件夹ID列表,逗号分隔(如 "f123,d456") - **onlyFiles** (boolean) - Optional - 是否只返回文件(不包含文件夹) ### Response #### Success Response (200) - **code** (integer) - 状态码 - **results** (array) - 文件/文件夹信息列表 - **key** (string) - 文件或文件夹ID - **icon** (string) - 图标类型 - **name** (string) - 名称 - **date** (string) - 日期 - **status** (integer) - 状态 - **imgsrc** (string) - 缩略图地址 - **size** (integer) - 文件大小 #### Response Example { "code": 200, "results": [ { "key": "d123", "icon": "folder", "name": "我的文件夹", "date": "2023-11-15 10:30:00", "status": 1 }, { "key": "f456", "icon": "pdf", "name": "document.pdf", "imgsrc": "", "size": 1048576, "date": "2023-11-15 10:30:00", "status": 1 } ] } ``` -------------------------------- ### POST /v1/public/file/ids_list Source: https://openapi.ctfile.com/ 根据文件/文件夹 ID 列表批量获取详细信息。 ```APIDOC ## POST /v1/public/file/ids_list ### Description 根据文件/文件夹 ID 列表批量获取详细信息。 ### Method POST ### Endpoint /v1/public/file/ids_list ### Parameters #### Request Body - **session** (string) - Required - 登录获取的 session token - **ids** (string) - Required - 文件/文件夹ID列表,逗号分隔 - **onlyFiles** (boolean) - Optional - 是否只返回文件 ### Response #### Success Response (200) - **code** (integer) - 状态码 - **results** (array) - 文件/文件夹信息列表 - **key** (string) - 标识 - **icon** (string) - 图标 - **name** (string) - 名称 - **imgsrc** (string) - 图片地址 - **size** (integer) - 大小 - **date** (string) - 日期 - **status** (integer) - 状态 #### Response Example ```json { "code": 200, "results": [ { "key": "f123", "icon": "pdf", "name": "document.pdf", "imgsrc": "", "size": 1048576, "date": "2023-11-15 10:30:00", "status": 1 } ] } ``` ``` -------------------------------- ### POST /v1/public/file/upload Source: https://openapi.ctfile.com/ 获取文件上传 URL。实际文件上传需要通过返回的 upload_url 进行。 ```APIDOC ## [POST] /v1/public/file/upload ### Description 获取文件上传 URL。实际文件上传需要通过返回的 upload_url 进行。 ### Method POST ### Endpoint /v1/public/file/upload ### Parameters #### Path Parameters - **session** (string) - Required - 登录获取的 session token - **folder_id** (string) - Optional - 上传到指定文件夹ID(默认0为根目录) ### Request Example { "session": "f924c2ae06b14157403b7ad4ca93a9aa", "folder_id": "0" } ### Response #### Success Response (200) - **code** (integer) - 状态码 - **upload_url** (string) - 上传URL,包含所有必要的参数(userid, maxsize, folderid, workspaceid, ctt, key) #### Response Example { "code": 200, "upload_url": "https://upload.ctfile.com/web/upload.do?userid=12345&maxsize=50000000000&folderid=0&workspaceid=123&ctt=1699999999&key=abc123..." } ``` -------------------------------- ### 获取上传地址请求示例 Source: https://openapi.ctfile.com/ 请求获取上传地址,参数包括 session 和可选的 folder_id(默认0为根目录)。 ```json { "session": "f924c2ae06b14157403b7ad4ca93a9aa", "folder_id": "0" } ``` -------------------------------- ### 获取文件夹元数据成功响应 (POST /v1/public/folder/meta) Source: https://openapi.ctfile.com/ 该 JSON 示例展示了获取文件夹元数据接口的成功响应。响应包含文件夹 ID、名称、路径、子文件夹数量、文件数量等详细信息。 ```json { "code": 200, "key": "d123456", "key_id": 123456, "name": "我的文件夹", "description": "文件夹描述", "path": "/", "date": "2023-11-15 10:30:00", "parent_folder_id": 0, "folder_count": 5, "document_count": 20, "total_size": 10485760, "is_hidden": 0, "pinned": 0, "icon": "folder", "folder_id": "d0" } ``` -------------------------------- ### 转存文件成功响应 Source: https://openapi.ctfile.com/ 成功响应示例,表示文件/文件夹已保存。 ```json { "code": 200, "message": "文件/文件夹已保存" } ``` -------------------------------- ### 获取收益信息成功响应 Source: https://openapi.ctfile.com/ 获取收益信息的成功响应,包含收益模式、账户类型、用户等级、今日收益、今日点击次数以及各类收益金额。字段说明见文档。 ```json { "code": 200, "account_mode": 5, "account_mode_info": "高收益模式已开启", "account_type": "普通账户", "user_level": 2, "today_income": 12.50, "today_clicked": 150, "aspire_income": 1250.00, "unpaid_income": 350.00, "paid_income": 900.00 } ``` -------------------------------- ### 获取上传地址成功响应 Source: https://openapi.ctfile.com/ 成功响应示例,返回上传 URL。upload_url 包含所有必要参数,有效期为 24 小时,最大文件大小为 50GB。 ```json { "code": 200, "upload_url": "https://upload.ctfile.com/web/upload.do?userid=12345&maxsize=50000000000&folderid=0&workspaceid=123&ctt=1699999999&key=abc123..." } ``` -------------------------------- ### POST /v1/public/file/delete Source: https://openapi.ctfile.com/ 将文件或文件夹移至回收站。 ```APIDOC ## POST /v1/public/file/delete ### Description 将文件或文件夹移至回收站。 ### Method POST ### Endpoint /v1/public/file/delete ### Parameters #### Request Body - **session** (string) - Required - 登录获取的 session token - **ids** (string) - Required - 文件/文件夹ID列表,逗号分隔 ### Response #### Success Response (200) - **code** (integer) - 状态码 - **message** (string) - 提示信息 #### Response Example { "code": 200, "message": "文件已删除" } ``` -------------------------------- ### 批量获取文件信息成功响应 Source: https://openapi.ctfile.com/ 成功响应示例,根据文件/文件夹 ID 列表批量获取详细信息,返回结果数组。 ```json { "code": 200, "results": [ { "key": "d123", "icon": "folder", "name": "我的文件夹", "date": "2023-11-15 10:30:00", "status": 1 }, { "key": "f456", "icon": "pdf", "name": "document.pdf", "imgsrc": "", "size": 1048576, "date": "2023-11-15 10:30:00", "status": 1 } ] } ``` -------------------------------- ### POST /v1/union/info/income Source: https://openapi.ctfile.com/ 获取用户的联盟收益统计信息,包括今日收益、总收益等。 ```APIDOC ## POST /v1/union/info/income ### Description 获取用户的联盟收益统计信息,包括今日收益、总收益等。 ### Method POST ### Endpoint /v1/union/info/income ### Parameters #### Request Body - **session** (string) - Required - 登录获取的 session token ### Response #### Success Response (200) - **code** (integer) - 状态码 - **account_mode** (integer) - 收益模式(0=关闭,1=低收益,2=临时低收益,5+=高收益) - **account_mode_info** (string) - 收益模式说明 - **account_type** (string) - 账户类型 - **user_level** (integer) - 用户等级 - **today_income** (number) - 今日收益金额 - **today_clicked** (integer) - 今日点击次数 - **aspire_income** (number) - Aspire 总收益 - **unpaid_income** (number) - 未支付收益 - **paid_income** (number) - 已支付收益 #### Response Example { "code": 200, "account_mode": 5, "account_mode_info": "高收益模式已开启", "account_type": "普通账户", "user_level": 2, "today_income": 12.50, "today_clicked": 150, "aspire_income": 1250.00, "unpaid_income": 350.00, "paid_income": 900.00 } ``` -------------------------------- ### 修改文件夹信息成功响应 (POST /v1/public/folder/modify_meta) Source: https://openapi.ctfile.com/ 该 JSON 示例展示了修改文件夹信息接口的成功响应。响应包含状态码和成功消息。注意:重命名文件夹会自动更新所有子文件夹的路径信息。 ```json { "code": 200, "message": "文件夹信息修改成功" } ``` -------------------------------- ### 获取文件元数据成功响应 (POST /v1/public/file/meta) Source: https://openapi.ctfile.com/ 该 JSON 示例展示了获取用户自己文件元数据接口的成功响应。响应包含文件 ID、名称、大小、日期、下载次数等详细信息。 ```json { "code": 200, "key": "f123456", "file_id": 123456, "name": "document.pdf", "description": "文件描述", "size": 1048576, "date": "2023-11-15 10:30:00", "views": 100, "downloads": 50, "extension": "pdf", "icon": "pdf", "folder_id": "d0", "path": "/", "is_locked": 0, "pinned": 0 } ``` -------------------------------- ### 切换收益模式请求与成功响应 Source: https://openapi.ctfile.com/ 切换收益模式的请求示例,mode 为 5 表示高收益。成功响应返回开启成功的消息。注意某些账户可能无法切换模式并返回错误。 ```json { "session": "f924c2ae06b14157403b7ad4ca93a9aa", "mode": 5 } ``` ```json { "code": 200, "message": "高收益模式已开启" } ``` -------------------------------- ### 获取文件元数据请求示例 Source: https://openapi.ctfile.com/ 请求获取文件元数据,参数包括 xtlink 和 file_id(不带 f 前缀)。 ```json { "xtlink": "xtc61380487-d67238530-c7daf9-5124", "file_id": "123456" } ``` -------------------------------- ### 转存文件错误响应(超过限制) Source: https://openapi.ctfile.com/ 错误响应示例,当转存数量超过限制时返回 403 状态码和错误消息。 ```json { "code": 403, "message": "转存总数(150个)超过限制(100个),请升级会员" } ```