Requirements, permissions, request and response fields, and error handling.
Request and permissions
POSThttps://openapi.qwenwork.ai/v1/drive/direct-uploads
Authentication: Authorization: Bearer <access_token>. Use an access token obtained through user OAuth authorization.
Required business Scope: drive.upload.write
Authorization types declared in the contract: Organization authorization (organization) and personal authorization (personal).
The platform must enable the Scope for your application. The user must have the relevant business permissions and access to the target resource. Availability of personal and organization authorization for your application depends on its console configuration.
Behavior and limitations
Create or resume a direct upload. Signed URLs expire. Do not log or share them, and do not send the platform token when accessing OSS. The upstream service continues to validate the user and Scope.Header parameters
| Parameter | Type | Required | Description and constraints |
|---|---|---|---|
Idempotency-Key | string | Yes | Reuse for retries of the same logical upload; do not reuse with different parameters. Minimum length: 1 Maximum length: 128 Pattern: "^[!-~]+$" |
Request body
A request body is required.application/json
A child field is required only when its parent object is present. Union branches are listed separately; fields from all branches are not required together.| Field | Type | Required | Description and constraints |
|---|---|---|---|
mime_type | string | No | Maximum length: 255 |
path | string | Yes | Minimum length: 1 Pattern: "^/" |
size | integer | Yes | Minimum (inclusive): 1 |
upload_mode | string | Yes | Allowed values: ["single", "multipart"] |
Success responses
Each business API retains its original response structure; no commoncode/msg/data wrapper is added.
HTTP 200
Idempotent replay Response type:application/json
| Field | Type | Required | Description and constraints |
|---|---|---|---|
session_id | string | Yes | — |
status | string | Yes | — |
upload | object | No | — |
upload | object | No | Exactly one branch must match: branch 1 — |
upload.headers | object | Yes | Exactly one branch must match: branch 1 Additional properties: "Subject to schema constraints; see the complete contract" |
upload.url | string | Yes | Exactly one branch must match: branch 1 — |
upload | object | No | Exactly one branch must match: branch 2 — |
upload.headers | object | Yes | Exactly one branch must match: branch 2 Additional properties: "Subject to schema constraints; see the complete contract" |
upload.part_size | integer | Yes | Exactly one branch must match: branch 2 — |
upload.parts | array | Yes | Exactly one branch must match: branch 2 — |
upload.parts[] | object | No | Exactly one branch must match: branch 2 — |
upload.parts[].part_number | integer | Yes | Exactly one branch must match: branch 2 — |
upload.parts[].url | string | Yes | Exactly one branch must match: branch 2 — |
upload_mode | string | Yes | — |
HTTP 201
Created successfully Response type:application/json
Fields are the same as for HTTP 200 above.
Error responses
| HTTP | Description and handling |
|---|---|
400 | Business or gateway error |
401 | Business or gateway error |
403 | Business or gateway error |
404 | Business or gateway error |
409 | Business or gateway error |
410 | Business or gateway error |
413 | Business or gateway error |
429 | Business or gateway error |
500 | Business or gateway error |
502 | Business or gateway error |
503 | Business or gateway error |
504 | Business or gateway error |
Complete field contract
The JSON below contains the complete request, response, and error schemas, nested constraints, and public extension definitions for this API. Copy it to verify the contract. Success examples not declared in the contract are not inferred.Expand the complete OpenAPI JSON
Expand the complete OpenAPI JSON
Copy
{
"components": {
"schemas": {
"Error": {
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object"
},
"Upload": {
"properties": {
"session_id": {
"type": "string"
},
"status": {
"type": "string"
},
"upload": {
"oneOf": [
{
"properties": {
"headers": {
"additionalProperties": {
"type": "string"
},
"type": "object"
},
"url": {
"type": "string"
}
},
"required": [
"url",
"headers"
],
"type": "object"
},
{
"properties": {
"headers": {
"additionalProperties": {
"type": "string"
},
"type": "object"
},
"part_size": {
"type": "integer"
},
"parts": {
"items": {
"properties": {
"part_number": {
"type": "integer"
},
"url": {
"type": "string"
}
},
"required": [
"part_number",
"url"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"part_size",
"headers",
"parts"
],
"type": "object"
}
]
},
"upload_mode": {
"type": "string"
}
},
"required": [
"session_id",
"upload_mode",
"status"
],
"type": "object"
}
},
"securitySchemes": {
"OpenPlatformBearer": {
"scheme": "bearer",
"type": "http"
}
}
},
"openapi": "3.1.0",
"paths": {
"/v1/drive/direct-uploads": {
"post": {
"description": "Create or resume a direct upload. Signed URLs expire. Do not log or share them, and do not send the platform token when accessing OSS. The upstream service continues to validate the user and Scope.",
"operationId": "drive-post-direct-uploads",
"parameters": [
{
"description": "Reuse for retries of the same logical upload; do not reuse with different parameters.",
"in": "header",
"name": "Idempotency-Key",
"required": true,
"schema": {
"maxLength": 128,
"minLength": 1,
"pattern": "^[!-~]+$",
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"mime_type": {
"maxLength": 255,
"type": "string"
},
"path": {
"minLength": 1,
"pattern": "^/",
"type": "string"
},
"size": {
"minimum": 1,
"type": "integer"
},
"upload_mode": {
"enum": [
"single",
"multipart"
],
"type": "string"
}
},
"required": [
"path",
"size",
"upload_mode"
],
"type": "object"
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Upload"
}
}
},
"description": "Idempotent replay",
"headers": {
"X-Request-ID": {
"description": "Request ID generated by the open platform for each HTTP request, used for log correlation and troubleshooting. Retries generate a new ID. This is not an idempotency key or a distributed trace ID.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "OpenTelemetry TraceID for the current open platform request, correlated with X-Request-ID through request logs. A complete trace may be unavailable if it was not retained by sampling.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"201": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Upload"
}
}
},
"description": "Created successfully",
"headers": {
"X-Request-ID": {
"description": "Request ID generated by the open platform for each HTTP request, used for log correlation and troubleshooting. Retries generate a new ID. This is not an idempotency key or a distributed trace ID.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "OpenTelemetry TraceID for the current open platform request, correlated with X-Request-ID through request logs. A complete trace may be unavailable if it was not retained by sampling.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"400": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"msg": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data"
],
"type": "object"
}
]
}
}
},
"description": "Business or gateway error",
"headers": {
"X-Request-ID": {
"description": "Request ID generated by the open platform for each HTTP request, used for log correlation and troubleshooting. Retries generate a new ID. This is not an idempotency key or a distributed trace ID.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "OpenTelemetry TraceID for the current open platform request, correlated with X-Request-ID through request logs. A complete trace may be unavailable if it was not retained by sampling.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"401": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"msg": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
}
},
"required": [
"code"
],
"type": "object"
}
]
}
}
},
"description": "Business or gateway error",
"headers": {
"X-Request-ID": {
"description": "Request ID generated by the open platform for each HTTP request, used for log correlation and troubleshooting. Retries generate a new ID. This is not an idempotency key or a distributed trace ID.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "OpenTelemetry TraceID for the current open platform request, correlated with X-Request-ID through request logs. A complete trace may be unavailable if it was not retained by sampling.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"403": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"msg": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
}
},
"required": [
"code"
],
"type": "object"
}
]
}
}
},
"description": "Business or gateway error",
"headers": {
"X-Request-ID": {
"description": "Request ID generated by the open platform for each HTTP request, used for log correlation and troubleshooting. Retries generate a new ID. This is not an idempotency key or a distributed trace ID.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "OpenTelemetry TraceID for the current open platform request, correlated with X-Request-ID through request logs. A complete trace may be unavailable if it was not retained by sampling.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"404": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"msg": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data"
],
"type": "object"
}
]
}
}
},
"description": "Business or gateway error",
"headers": {
"X-Request-ID": {
"description": "Request ID generated by the open platform for each HTTP request, used for log correlation and troubleshooting. Retries generate a new ID. This is not an idempotency key or a distributed trace ID.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "OpenTelemetry TraceID for the current open platform request, correlated with X-Request-ID through request logs. A complete trace may be unavailable if it was not retained by sampling.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"409": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"msg": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data"
],
"type": "object"
}
]
}
}
},
"description": "Business or gateway error",
"headers": {
"X-Request-ID": {
"description": "Request ID generated by the open platform for each HTTP request, used for log correlation and troubleshooting. Retries generate a new ID. This is not an idempotency key or a distributed trace ID.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "OpenTelemetry TraceID for the current open platform request, correlated with X-Request-ID through request logs. A complete trace may be unavailable if it was not retained by sampling.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"410": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"msg": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data"
],
"type": "object"
}
]
}
}
},
"description": "Business or gateway error",
"headers": {
"X-Request-ID": {
"description": "Request ID generated by the open platform for each HTTP request, used for log correlation and troubleshooting. Retries generate a new ID. This is not an idempotency key or a distributed trace ID.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "OpenTelemetry TraceID for the current open platform request, correlated with X-Request-ID through request logs. A complete trace may be unavailable if it was not retained by sampling.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"413": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"msg": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data"
],
"type": "object"
}
]
}
}
},
"description": "Business or gateway error",
"headers": {
"X-Request-ID": {
"description": "Request ID generated by the open platform for each HTTP request, used for log correlation and troubleshooting. Retries generate a new ID. This is not an idempotency key or a distributed trace ID.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "OpenTelemetry TraceID for the current open platform request, correlated with X-Request-ID through request logs. A complete trace may be unavailable if it was not retained by sampling.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"429": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"msg": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data"
],
"type": "object"
}
]
}
}
},
"description": "Business or gateway error",
"headers": {
"X-Request-ID": {
"description": "Request ID generated by the open platform for each HTTP request, used for log correlation and troubleshooting. Retries generate a new ID. This is not an idempotency key or a distributed trace ID.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "OpenTelemetry TraceID for the current open platform request, correlated with X-Request-ID through request logs. A complete trace may be unavailable if it was not retained by sampling.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"500": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"msg": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data"
],
"type": "object"
}
]
}
}
},
"description": "Business or gateway error",
"headers": {
"X-Request-ID": {
"description": "Request ID generated by the open platform for each HTTP request, used for log correlation and troubleshooting. Retries generate a new ID. This is not an idempotency key or a distributed trace ID.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "OpenTelemetry TraceID for the current open platform request, correlated with X-Request-ID through request logs. A complete trace may be unavailable if it was not retained by sampling.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"502": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"msg": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data"
],
"type": "object"
}
]
}
}
},
"description": "Business or gateway error",
"headers": {
"X-Request-ID": {
"description": "Request ID generated by the open platform for each HTTP request, used for log correlation and troubleshooting. Retries generate a new ID. This is not an idempotency key or a distributed trace ID.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "OpenTelemetry TraceID for the current open platform request, correlated with X-Request-ID through request logs. A complete trace may be unavailable if it was not retained by sampling.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"503": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"msg": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
}
},
"required": [
"code"
],
"type": "object"
}
]
}
}
},
"description": "Business or gateway error",
"headers": {
"X-Request-ID": {
"description": "Request ID generated by the open platform for each HTTP request, used for log correlation and troubleshooting. Retries generate a new ID. This is not an idempotency key or a distributed trace ID.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "OpenTelemetry TraceID for the current open platform request, correlated with X-Request-ID through request logs. A complete trace may be unavailable if it was not retained by sampling.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"504": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"msg": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data"
],
"type": "object"
}
]
}
}
},
"description": "Business or gateway error",
"headers": {
"X-Request-ID": {
"description": "Request ID generated by the open platform for each HTTP request, used for log correlation and troubleshooting. Retries generate a new ID. This is not an idempotency key or a distributed trace ID.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "OpenTelemetry TraceID for the current open platform request, correlated with X-Request-ID through request logs. A complete trace may be unavailable if it was not retained by sampling.",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
}
},
"security": [
{
"OpenPlatformBearer": []
}
],
"summary": "Create or resume a direct upload",
"tags": [
"直传上传"
]
}
}
},
"info": {
"title": "Create or resume a direct upload",
"version": "2026-11-24"
},
"servers": [
{
"url": "https://openapi.qwenwork.ai"
}
]
}