AuthorizeFileUpload

Updated at:

Grants authorization for clients to upload files directly to the specified bucket and object key, and then use the object URL as OssFileUrl to create a parsing task.

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

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

dtsai:AuthorizeFileUpload

create

*All Resource

*

None
  • dtsai:CallWithBearerToken

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID, such as cn-beijing.

cn-beijing

AgentName

string

No

The source of the agent or client that initiates the call, such as codex, cursor, or openapi. The maximum length is 32 characters. This parameter is used only for statistics and does not participate in authentication, throttling, quotas, or billing.

codex

FileFormat

string

No

The format of the file to be uploaded.

pdf

BatchSize

string

No

The number of OSS PostObject direct upload authorizations returned in the current request.

10

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The request ID.

A30D0930-xxxx-xxxx-xxxx-C2C661CC8B58

Success

boolean

Indicates whether the request is successful.

true

HttpStatusCode

integer

The business semantic status code.

200

ErrorCode

string

The error code.

InvalidParameter

ErrorMessage

string

The error message.

The parameter [Query] is not valid.

AccessKeyId

string

The temporary AccessKey ID used for OSS PostObject.

STS.NV5xxx

SecurityToken

string

The temporary Security Token Service (STS) token.

CAISxxx

Bucket

string

The destination OSS bucket.

dts-ai-upload-cn-beijing7500163e0eae09

EncodedPolicy

string

The Base64-encoded PostObject policy, which includes the object key and file size limit.

eyJleHBpcmF0aW9uIjo...

Endpoint

string

OSS Endpoint

oss-cn-beijing.aliyuncs.com

ObjectKey

string

The object key that must be used as-is for the upload.

0a1b_123456_0123456789abcdef0123456789abcdef

Signature

string

The policy signature.

masked-signature

ExpireTime

integer

The expiration time of the OSS PostObject direct upload authorization.

0

Authorizations

array<object>

The list of OSS PostObject direct upload authorizations returned in batch.

object

A single OSS PostObject direct upload authorization.

ObjectKey

string

The object key that must be used as-is for the upload.

0a1b_123456_0123456789abcdef0123456789abcdef

EncodedPolicy

string

The Base64-encoded PostObject policy, which includes the object key and file size limit.

eyJleHBpcmF0aW9uIjo...

Signature

string

The policy signature.

masked-signature

Examples

Success response

JSON format

{
  "RequestId": "A30D0930-xxxx-xxxx-xxxx-C2C661CC8B58",
  "Success": true,
  "HttpStatusCode": 200,
  "ErrorCode": "InvalidParameter",
  "ErrorMessage": "The parameter [Query] is not valid.",
  "AccessKeyId": "STS.NV5xxx",
  "SecurityToken": "CAISxxx",
  "Bucket": "dts-ai-upload-cn-beijing7500163e0eae09",
  "EncodedPolicy": "eyJleHBpcmF0aW9uIjo...",
  "Endpoint": "oss-cn-beijing.aliyuncs.com",
  "ObjectKey": "0a1b_123456_0123456789abcdef0123456789abcdef",
  "Signature": "masked-signature",
  "ExpireTime": 0,
  "Authorizations": [
    {
      "ObjectKey": "0a1b_123456_0123456789abcdef0123456789abcdef",
      "EncodedPolicy": "eyJleHBpcmF0aW9uIjo...",
      "Signature": "masked-signature"
    }
  ]
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.