GetKnowledgeBasePreSignedUrl

Updated at:
Copy as MD

Generates an **Object Storage Service (OSS) pre-signed PUT URL** pointing to the dedicated storage of the knowledge base for each file in `Documents`. Callers use the URL to upload file content directly to OSS and then call `AddDocuments` to complete the registration. A maximum of 100 files can be processed at a time.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request syntax

POST /api/v1/datasets/{datasetId}/getKnowledgeBasePreSignedUrl HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

datasetId

string

No

The ID of the knowledge base.

kb-3bd02617e9be335f

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The request body.

KnowledgeBaseId

string

No

The ID of the knowledge base. This parameter and datasetId are mutually exclusive. If both are specified, this parameter takes precedence.

kb-3bd02617e9be335f

Documents

array<object>

No

The list of files to be uploaded. You can specify 1 to 100 files.

object

No

The imported document.

Path

string

No

The file name or relative path for local upload scenarios. The path cannot start with direct_upload/ or uploaded/, cannot contain empty segments, ., or .., and must be less than or equal to 1,024 bytes in length.

contract-2026.md

Name

string

No

The display name of the file. If not specified, the file name from Path is used by default.

CHANGELOG.md

Size

integer

No

The size of the file in bytes.

1024

ExpiresIn

integer

No

The validity period of the pre-signed URL in seconds. Default value: 3600.

3600

Response elements

Element

Type

Description

Example

object

Schema of Response

data

object

The response data.

preSignedUrls

array

The list of pre-signed PUT URLs. The order corresponds one-to-one with the Documents in the request.

string

The pre-signed URL.

https://example.oss-cn-hangzhou.aliyuncs.com/object?signature=xxx

bucketName

string

The name of the bucket.

knowledgebase-fileupload

expiresIn

integer

The validity period of the pre-signed URL in seconds.

3600

code

integer

The business status code.

0

accessDeniedDetail

string

The details of the access denial.

{"PolicyType":"AccountLevelIdentityBasedPolicy","AuthPrincipalOwnerId":"1234567890123456","AuthPrincipalType":"SubUser","AuthPrincipalDisplayName":"1234567890123456","NoPermissionType":"ImplicitDeny","AuthAction":"milvusknowledgebase:ListDatasets"}

success

boolean

Indicates whether the request is successful.

true

httpStatusCode

integer

The HTTP status code.

403

{
  "code": 0,
  "message": "success",
  "requestId": "DDDBE0E5-4314-156F-B7F1-C4BCFD25A509",
  "success": true,
  "data": {
    "bucketName": "kd-8b682030a90e5-1722921615717059",
    "expiresIn": 3600,
    "preSignedUrls": [
      "https://kd-8b682030a90e5-1722921615717059.oss-cn-hangzhou.aliyuncs.com/direct_upload/1722921615717059/kd-8b682030a90e5/contract-2026.md?OSSAccessKeyId=xxx&Expires=xxx&Signature=xxx",
      "https://kd-8b682030a90e5-1722921615717059.oss-cn-hangzhou.aliyuncs.com/direct_upload/1722921615717059/kd-8b682030a90e5/guide.md?OSSAccessKeyId=xxx&Expires=xxx&Signature=xxx"
    ]
  }
}

Examples

Success response

JSON format

{
  "data": {
    "preSignedUrls": [
      "https://example.oss-cn-hangzhou.aliyuncs.com/object?signature=xxx"
    ],
    "bucketName": "knowledgebase-fileupload",
    "expiresIn": 3600
  },
  "code": 0,
  "accessDeniedDetail": "{\"PolicyType\":\"AccountLevelIdentityBasedPolicy\",\"AuthPrincipalOwnerId\":\"1234567890123456\",\"AuthPrincipalType\":\"SubUser\",\"AuthPrincipalDisplayName\":\"1234567890123456\",\"NoPermissionType\":\"ImplicitDeny\",\"AuthAction\":\"milvusknowledgebase:ListDatasets\"}",
  "success": true,
  "httpStatusCode": 403
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.