1. Request an upload lease
Request syntax
Request parameters
Name | Type | Required | Description | Example |
|---|---|---|---|---|
fileName | string | Yes | The name of the document. | Alibaba Cloud Model Studio.pdf |
sizeBytes | number | Yes | The size of the document to upload, in bytes. | 28123 |
md5 | string | Yes | The MD5 hash of the document. |
Response parameters
Name | Type | Description |
|---|---|---|
code | int | The status code. |
data | object | The response data. |
-param | object | The HTTP request parameters for uploading the document. |
-headers | object | The key-value pairs to include in the header for step 2 (uploading the document). Both the key and value are strings. |
-x-bailian-extra | string | |
-Content-Type | string | |
-method | string | The HTTP method to call. |
-url | string | The URL to request for step 2 (uploading the document). |
-type | string | The upload method for the document. |
-lease_id | string | The unique ID of the lease. This parameter is required for step 3 (submitting the document for parsing). |
requestId | string | The request ID. |
success | boolean | Success |
message | string | The response message. |
Example
Sample success response
JSON format
2. Upload the document to OSS
Use the data.param.url, data.param.method, x-bailian-extra, and Content-Type parameters from data.param.headers returned in the previous step (requesting an upload lease) to upload your local document to Object Storage Service (OSS). The following code provides an example.
3. Submit the document for parsing
Request syntax
Request parameters
Name | Type | Required | Description | Example |
|---|---|---|---|---|
leaseId | string | Yes | The unique ID of the lease. You can obtain this ID by requesting a lease. | 3631bf9f24ea4ac7b3dr5135deee7fec.1752176287488 |
Response parameters
Name | Type | Description |
|---|---|---|
code | int | The status code. |
data | object | |
-fileSize | string | The document size. |
-docId | string | docId |
-name | string | The document name. |
-pageSize | number | The number of pages. |
-type | string | The document type. |
-url | string | The document URL. |
-fileId | string | The file ID. This ID is required for subsequent conversations. |
requestId | string | The request ID. |
success | boolean | Indicates whether the request was successful. |
message | string | The response message. |
Example
Sample success response
JSON format