- Request a lease (this endpoint) — get the OSS presigned URL and
leaseId. - PUT to OSS — upload the file binary via HTTP PUT using the returned
param.urlandparam.headers. - Register the file (
addFile) — register the uploaded file with the data center usingleaseId.
sizeBytes must be passed as a string (for example "1048576"), not a number.Authorizations
DashScope API Key, obtained from the API Key page in the console.
Body
application/jsonCategory ID (the field is named category, not categoryId). Returned by listCategory.
File name, including the extension.
File size in bytes, passed as a string.
MD5 of the file content, Base64-encoded.
Category type. Defaults to UNSTRUCTURED. UNSTRUCTURED: a category used to build Knowledge Bases. SESSION_FILE: files used for agent session interactions. When using SESSION_FILE, addFile must also receive SESSION_FILE as categoryType; such files are valid only for the current session and expire once it closes (at most 7 days). They cannot be stored long term.
Whether to upload through the internal endpoint of the secure storage space. Defaults to false.
Response
Response code. Success on success.
Error or informational message; an empty string on success.
Unique request identifier. Include this ID when reporting an issue.
Business status code. 200 on success, 400 for failures such as invalid parameters. Note that the HTTP status code remains 200 even on failure, so rely on this field and code to determine the result.