调用条件、权限、请求字段、响应字段与错误处理。
请求与权限
POSThttps://openapi.qwenwork.ai/v1/scheduler/tasks/{id}/run-once
鉴权:Authorization: Bearer <access_token>;使用用户 OAuth 授权获得的访问令牌。
所需业务 Scope:scheduler.task.run
契约声明的授权方式:组织授权(organization)、个人授权(personal)
Scope 需由平台为应用开通;用户须有相应业务权限,目标资源须在其可访问范围内。个人/组织方式是否为该应用开放,以控制台实际配置为准。
功能与限制
使用用户 OAuth token,需要 scheduler.task.run。只支持用户 OAuth Token。按任务当前配置立即触发一次执行,不修改任务触发器或调度池,不影响下一次正常触发时间。任务必须属于当前用户、状态为 active 且由云端调度;否则返回 403/404/409。执行记录异步创建,可通过 correlation_id/fire_id 关联日志。路径参数
| 参数 | 类型 | 必填 | 说明及约束 |
|---|---|---|---|
id | string | 是 | 任务 ID(UUID)。 格式:"uuid" |
请求体
公开契约未声明请求体。不要自行添加身份字段或未经声明的业务字段。成功响应
保持各业务接口原始响应结构,不统一添加code/msg/data 包装。
HTTP 202
手动执行事件已受理。 响应类型:application/json
Copy
{
"causation_id": "manual:73abb1ac-8c5a-4538-95ba-97c06297ebce",
"correlation_id": "b6e4a3f0-1c2d-4e5f-8a9b-0c1d2e3f4a5b",
"fire_id": "c7f5b4e1-2d3e-4f5a-9b0c-1d2e3f4a5b6c",
"run_type": "manual",
"scheduled_fire_at": "2026-11-17T02:00:00Z",
"task_id": "73abb1ac-8c5a-4538-95ba-97c06297ebce"
}
| 字段 | 类型 | 必含 | 说明及约束 |
|---|---|---|---|
causation_id | string | 是 | — |
correlation_id | string | 是 | — |
fire_id | string | 是 | — |
run_type | string | 是 | — |
scheduled_fire_at | string | 是 | 格式:"date-time" |
task_id | string | 是 | 格式:"uuid" |
错误响应
| HTTP | 说明及处理 |
|---|---|
400 | 任务 ID 或请求不合法。 |
401 | 用户凭证无效、过期或凭证类型不支持。 |
403 | 缺少 scheduler.task.run Scope 或任务不属于当前用户。 |
404 | 任务不存在或已删除。 |
409 | 任务当前不可执行:paused(task_not_active)或非云端调度(incompatible_run_type)。 |
429 | 触发平台限流。 |
500 | 业务处理失败。 |
502 | 网关上游响应失败。 |
503 | 网关或业务依赖不可用。 |
504 | 请求超时。 |
完整字段契约
下方 JSON 包含本接口完整请求、响应、错误 Schema、嵌套约束和公开扩展定义,可复制用于核对。未声明的成功示例不作推测。展开完整接口 OpenAPI JSON
展开完整接口 OpenAPI JSON
Copy
{
"components": {
"schemas": {
"Error": {
"additionalProperties": false,
"properties": {
"error": {
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"reason": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object"
}
},
"required": [
"error"
],
"type": "object"
},
"GatewayError": {
"additionalProperties": false,
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"msg": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data"
],
"type": "object"
},
"RunOnce": {
"additionalProperties": false,
"properties": {
"causation_id": {
"type": "string"
},
"correlation_id": {
"type": "string"
},
"fire_id": {
"type": "string"
},
"run_type": {
"type": "string"
},
"scheduled_fire_at": {
"format": "date-time",
"type": "string"
},
"task_id": {
"format": "uuid",
"type": "string"
}
},
"required": [
"task_id",
"scheduled_fire_at",
"run_type",
"correlation_id",
"fire_id",
"causation_id"
],
"type": "object"
}
},
"securitySchemes": {
"OpenPlatformBearer": {
"scheme": "bearer",
"type": "http"
}
}
},
"openapi": "3.1.0",
"paths": {
"/v1/scheduler/tasks/{id}/run-once": {
"post": {
"description": "使用用户 OAuth token,需要 scheduler.task.run。只支持用户 OAuth Token。按任务当前配置立即触发一次执行,不修改任务触发器或调度池,不影响下一次正常触发时间。任务必须属于当前用户、状态为 active 且由云端调度;否则返回 403/404/409。执行记录异步创建,可通过 correlation_id/fire_id 关联日志。",
"operationId": "runSchedulerTaskOnce",
"parameters": [
{
"description": "任务 ID(UUID)。",
"in": "path",
"name": "id",
"required": true,
"schema": {
"format": "uuid",
"type": "string"
}
}
],
"responses": {
"202": {
"content": {
"application/json": {
"example": {
"causation_id": "manual:73abb1ac-8c5a-4538-95ba-97c06297ebce",
"correlation_id": "b6e4a3f0-1c2d-4e5f-8a9b-0c1d2e3f4a5b",
"fire_id": "c7f5b4e1-2d3e-4f5a-9b0c-1d2e3f4a5b6c",
"run_type": "manual",
"scheduled_fire_at": "2026-11-17T02:00:00Z",
"task_id": "73abb1ac-8c5a-4538-95ba-97c06297ebce"
},
"schema": {
"$ref": "#/components/schemas/RunOnce"
}
}
},
"description": "手动执行事件已受理。",
"headers": {
"X-Request-ID": {
"description": "开放平台为每次 HTTP 请求生成的请求 ID,用于日志关联与故障排查;重试生成新的 ID,不是幂等键或分布式 Trace ID。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "开放平台当前请求的 OpenTelemetry TraceID,通过请求日志与 X-Request-ID 关联;采样未保留时可能没有完整链路记录。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"400": {
"content": {
"application/json": {
"example": {
"error": {
"code": "bad_request",
"message": "任务 ID 或请求不合法。"
}
},
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"$ref": "#/components/schemas/GatewayError"
}
]
}
}
},
"description": "任务 ID 或请求不合法。",
"headers": {
"X-Request-ID": {
"description": "开放平台为每次 HTTP 请求生成的请求 ID,用于日志关联与故障排查;重试生成新的 ID,不是幂等键或分布式 Trace ID。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "开放平台当前请求的 OpenTelemetry TraceID,通过请求日志与 X-Request-ID 关联;采样未保留时可能没有完整链路记录。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"401": {
"content": {
"application/json": {
"example": {
"error": {
"code": "unauthorized",
"message": "用户凭证无效、过期或凭证类型不支持。"
}
},
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"$ref": "#/components/schemas/GatewayError"
}
]
}
}
},
"description": "用户凭证无效、过期或凭证类型不支持。",
"headers": {
"X-Request-ID": {
"description": "开放平台为每次 HTTP 请求生成的请求 ID,用于日志关联与故障排查;重试生成新的 ID,不是幂等键或分布式 Trace ID。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "开放平台当前请求的 OpenTelemetry TraceID,通过请求日志与 X-Request-ID 关联;采样未保留时可能没有完整链路记录。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"403": {
"content": {
"application/json": {
"example": {
"error": {
"code": "forbidden",
"message": "缺少 scheduler.task.run Scope 或任务不属于当前用户。"
}
},
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"$ref": "#/components/schemas/GatewayError"
}
]
}
}
},
"description": "缺少 scheduler.task.run Scope 或任务不属于当前用户。",
"headers": {
"X-Request-ID": {
"description": "开放平台为每次 HTTP 请求生成的请求 ID,用于日志关联与故障排查;重试生成新的 ID,不是幂等键或分布式 Trace ID。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "开放平台当前请求的 OpenTelemetry TraceID,通过请求日志与 X-Request-ID 关联;采样未保留时可能没有完整链路记录。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"404": {
"content": {
"application/json": {
"example": {
"error": {
"code": "not_found",
"message": "任务不存在或已删除。"
}
},
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"$ref": "#/components/schemas/GatewayError"
}
]
}
}
},
"description": "任务不存在或已删除。",
"headers": {
"X-Request-ID": {
"description": "开放平台为每次 HTTP 请求生成的请求 ID,用于日志关联与故障排查;重试生成新的 ID,不是幂等键或分布式 Trace ID。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "开放平台当前请求的 OpenTelemetry TraceID,通过请求日志与 X-Request-ID 关联;采样未保留时可能没有完整链路记录。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"409": {
"content": {
"application/json": {
"example": {
"error": {
"code": "task_not_active",
"message": "任务当前不可执行。"
}
},
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"$ref": "#/components/schemas/GatewayError"
}
]
}
}
},
"description": "任务当前不可执行:paused(task_not_active)或非云端调度(incompatible_run_type)。",
"headers": {
"X-Request-ID": {
"description": "开放平台为每次 HTTP 请求生成的请求 ID,用于日志关联与故障排查;重试生成新的 ID,不是幂等键或分布式 Trace ID。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "开放平台当前请求的 OpenTelemetry TraceID,通过请求日志与 X-Request-ID 关联;采样未保留时可能没有完整链路记录。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"429": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"$ref": "#/components/schemas/GatewayError"
}
]
}
}
},
"description": "触发平台限流。",
"headers": {
"X-Request-ID": {
"description": "开放平台为每次 HTTP 请求生成的请求 ID,用于日志关联与故障排查;重试生成新的 ID,不是幂等键或分布式 Trace ID。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "开放平台当前请求的 OpenTelemetry TraceID,通过请求日志与 X-Request-ID 关联;采样未保留时可能没有完整链路记录。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"500": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"$ref": "#/components/schemas/GatewayError"
}
]
}
}
},
"description": "业务处理失败。",
"headers": {
"X-Request-ID": {
"description": "开放平台为每次 HTTP 请求生成的请求 ID,用于日志关联与故障排查;重试生成新的 ID,不是幂等键或分布式 Trace ID。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "开放平台当前请求的 OpenTelemetry TraceID,通过请求日志与 X-Request-ID 关联;采样未保留时可能没有完整链路记录。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"502": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"$ref": "#/components/schemas/GatewayError"
}
]
}
}
},
"description": "网关上游响应失败。",
"headers": {
"X-Request-ID": {
"description": "开放平台为每次 HTTP 请求生成的请求 ID,用于日志关联与故障排查;重试生成新的 ID,不是幂等键或分布式 Trace ID。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "开放平台当前请求的 OpenTelemetry TraceID,通过请求日志与 X-Request-ID 关联;采样未保留时可能没有完整链路记录。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"503": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"$ref": "#/components/schemas/GatewayError"
}
]
}
}
},
"description": "网关或业务依赖不可用。",
"headers": {
"X-Request-ID": {
"description": "开放平台为每次 HTTP 请求生成的请求 ID,用于日志关联与故障排查;重试生成新的 ID,不是幂等键或分布式 Trace ID。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "开放平台当前请求的 OpenTelemetry TraceID,通过请求日志与 X-Request-ID 关联;采样未保留时可能没有完整链路记录。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
},
"504": {
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"$ref": "#/components/schemas/GatewayError"
}
]
}
}
},
"description": "请求超时。",
"headers": {
"X-Request-ID": {
"description": "开放平台为每次 HTTP 请求生成的请求 ID,用于日志关联与故障排查;重试生成新的 ID,不是幂等键或分布式 Trace ID。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
},
"X-Trace-ID": {
"description": "开放平台当前请求的 OpenTelemetry TraceID,通过请求日志与 X-Request-ID 关联;采样未保留时可能没有完整链路记录。",
"schema": {
"pattern": "^[0-9a-f]{32}$",
"type": "string"
}
}
}
}
},
"security": [
{
"OpenPlatformBearer": []
}
],
"summary": "立即执行定时任务",
"tags": [
"定时任务"
]
}
}
},
"info": {
"title": "立即执行定时任务",
"version": "2026-11-24"
},
"servers": [
{
"url": "https://openapi.qwenwork.ai"
}
]
}