Skip to content

AddFile

Imports an unstructured document stored in the temporary storage space to Data Management. You cannot use the API to import structured documents. Use the console instead.

Operation description

  • Before you call this operation, make sure that you have obtained the lease and uploaded the document to the temporary storage space by using the ApplyFileUploadLease operation. For more information, see Upload files by calling API.

Note After you call this operation, the used lease ID expires immediately. Do not use the same lease ID to submit new requests.

  • You must call this operation within 12 hours after you call the ApplyFileUploadLease operation. Otherwise, the lease expires and the request fails.
  • After you call this operation, the system parses and imports your document. The process takes some time.
  • This interface is not idempotent.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples. Debug

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
sfm:AddFilecreate* All Resources *nonenone

Request syntax

PUT /{WorkspaceId}/datacenter/file HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
LeaseIdstringYesThe lease ID, which corresponds to the FileUploadLeaseId parameter returned by the ApplyFileUploadLease operation.68abd1dea7b6404d8f7d7b9f7fbd332d.1716698936847
ParserstringYesThe parser. Valid value: - DASHSCOPE_DOCMIND: Intelligent document parsing by Alibaba Cloud.DASHSCOPE_DOCMIND
CategoryIdstringYesThe primary key ID of the category to which the document is uploaded. This parameter corresponds to the CategoryId returned by the AddCategory operation. You can also click the ID icon next to the category name on the Unstructured Data tab of the Application Data page to view the ID. You can set the parameter to default, which specifies the Default Category created by the system.cate_cdd11b1b79a74e8bbd675c356a91ee3510024405
WorkspaceIdstringYesThe ID of the workspace to which the document is uploaded. On the homepage of the console, click the workspace Details icon in the upper-left corner to view the workspace ID.ws_3AXoiweeTyTd03IN
TagsarrayNoA list of tags associated with the document. The default value is null, which means no tags. You can specify up to 10 tags.
stringNoThe tag of the document. A tag can be up to 12 characters in length and can contain letters, digits, digits, underscores (_), and hyphens (-).Product Introduction
CategoryTypestringNoThe type of the category. Valid values: - UNSTRUCTURED - SESSION_FILEUNSTRUCTURED

Response parameters

ParameterTypeDescriptionExample
objectSchema of Response
CodestringThe status code.DataCenter.FileTooLarge
DataobjectThe returned data fields.
FileIdstringThe primary key ID of the document. We recommend that you store the ID because it is required for all subsequent API operations related to this document.file_9a65732555b54d5ea10796ca5742ba22_XXXXXXXX
ParserstringThe parser that is used to parse the document. Valid value: - DASHSCOPE_DOCMIND: Intelligent document parsing by Alibaba Cloud.DASHSCOPE_DOCMIND
MessagestringThe error message.User not authorized to operate on the specified resource.
RequestIdstringThe request ID.778C0B3B-xxxx-5FC1-A947-36EDD13606AB
StatusstringThe HTTP status code.200
SuccessbooleanIndications whether the call is successful. Valid values: - true - falsetrue

Examples

Sample success responses

JSONformat

{
  "Code": "DataCenter.FileTooLarge",
  "Data": {
    "FileId": "file_9a65732555b54d5ea10796ca5742ba22_XXXXXXXX",
    "Parser": "DASHSCOPE_DOCMIND"
  },
  "Message": "User not authorized to operate on the specified resource.",
  "RequestId": "778C0B3B-xxxx-5FC1-A947-36EDD13606AB",
  "Status": 200,
  "Success": true
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation

No change history

Mirror of Alibaba Cloud Model Studio docs for reference and RAG. Not affiliated with Alibaba Cloud.