调用条件、权限、请求字段、响应字段与错误处理。
请求与权限
GEThttps://openapi.qwenwork.ai/v1/biz/usage/meta
鉴权:Authorization: Bearer <access_token>;使用用户 OAuth 授权获得的访问令牌。
所需业务 Scope:biz.usage.read
契约声明的授权方式:组织授权(organization)
Scope 需由平台为应用开通;用户须有相应业务权限,目标资源须在其可访问范围内。个人/组织方式是否为该应用开放,以控制台实际配置为准。
功能与限制
查询最新可用的用量统计日期和数据更新时间,适用于确定后续成员用量查询应使用的数据日期。 应用需要 biz.usage.read 授权,操作者需要企业用量读取权限,调用时无需业务参数。 成功返回 latest_usage_data_date 和 last_data_update_time。暂无可用统计数据时,两者均为 null。更新时间使用数据源提供的时间字符串。请求体
公开契约未声明请求体。不要自行添加身份字段或未经声明的业务字段。成功响应
保持各业务接口原始响应结构,不统一添加code/msg/data 包装。
HTTP 200
查询用量数据版本成功 响应类型:application/json
Copy
{
"last_data_update_time": "2026-11-13 02:15:00",
"latest_usage_data_date": "2026-11-12"
}
| 字段 | 类型 | 必含 | 说明及约束 |
|---|---|---|---|
last_data_update_time | string | null | 是 | 统计更新时间,沿用 Databus 原值。 |
latest_usage_data_date | string | null | 是 | 最新可查询用量数据日期,YYYY-MM-DD。 |
错误响应
| HTTP | 说明及处理 |
|---|---|
400 | 请求不符合参数契约。 |
401 | 令牌缺失或无效。检查企业授权访问令牌。 |
403 | 企业授权、操作者权限或应用来源 IP 校验失败。 |
422 | 参数值未通过 Biz 校验。检查请求路径及参数。 |
429 | 调用频率超限。降低调用频率后重试。 |
500 | Databus 拒绝查询或 Biz 处理失败。保留请求 ID 联系维护方。 |
502 | 用量上游响应无效或 Gateway 未取得有效的 Biz 响应。保留请求 ID 联系维护方。 |
503 | 用量依赖、Biz 或平台暂不可用。稍后重试。 |
504 | 调用超时。 |
default | 其他平台或服务错误。按 error_code 判断处理方式,并保留请求 ID。 |
完整字段契约
下方 JSON 包含本接口完整请求、响应、错误 Schema、嵌套约束和公开扩展定义,可复制用于核对。未声明的成功示例不作推测。展开完整接口 OpenAPI JSON
展开完整接口 OpenAPI JSON
Copy
{
"components": {
"securitySchemes": {
"OpenPlatformBearer": {
"description": "企业授权应用访问令牌;Scope 不代替操作者权限与资源隔离",
"scheme": "bearer",
"type": "http"
}
}
},
"openapi": "3.1.0",
"paths": {
"/v1/biz/usage/meta": {
"get": {
"description": "查询最新可用的用量统计日期和数据更新时间,适用于确定后续成员用量查询应使用的数据日期。\n\n应用需要 biz.usage.read 授权,操作者需要企业用量读取权限,调用时无需业务参数。\n\n成功返回 latest_usage_data_date 和 last_data_update_time。暂无可用统计数据时,两者均为 null。更新时间使用数据源提供的时间字符串。",
"operationId": "biz-get-usage-metadata",
"responses": {
"200": {
"content": {
"application/json": {
"example": {
"last_data_update_time": "2026-11-13 02:15:00",
"latest_usage_data_date": "2026-11-12"
},
"schema": {
"additionalProperties": false,
"properties": {
"last_data_update_time": {
"description": "统计更新时间,沿用 Databus 原值。",
"type": [
"string",
"null"
]
},
"latest_usage_data_date": {
"description": "最新可查询用量数据日期,YYYY-MM-DD。",
"type": [
"string",
"null"
]
}
},
"required": [
"latest_usage_data_date",
"last_data_update_time"
],
"type": "object"
}
}
},
"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": {
"code": 400,
"data": null,
"error_code": "OPENAPI_INVALID_REQUEST",
"msg": "请求参数不符合接口要求"
},
"schema": {
"additionalProperties": false,
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"error_code": {
"type": "string"
},
"msg": {
"type": "string"
},
"request_id": {
"type": "string"
},
"trace_id": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data",
"error_code"
],
"type": "object"
}
}
},
"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"
}
}
}
},
"401": {
"content": {
"application/json": {
"example": {
"code": 401,
"data": null,
"error_code": "OPENAPI_UNAUTHENTICATED",
"msg": "访问凭证缺失、无效或已失效"
},
"schema": {
"additionalProperties": false,
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"error_code": {
"type": "string"
},
"msg": {
"type": "string"
},
"request_id": {
"type": "string"
},
"trace_id": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data",
"error_code"
],
"type": "object"
}
}
},
"description": "令牌缺失或无效。检查企业授权访问令牌。",
"headers": {
"WWW-Authenticate": {
"schema": {
"type": "string"
}
},
"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": {
"code": 403,
"data": null,
"error_code": "openapi_permission_denied",
"msg": "没有操作权限"
},
"schema": {
"additionalProperties": false,
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"error_code": {
"type": "string"
},
"msg": {
"type": "string"
},
"request_id": {
"type": "string"
},
"trace_id": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data",
"error_code"
],
"type": "object"
}
}
},
"description": "企业授权、操作者权限或应用来源 IP 校验失败。",
"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"
}
}
}
},
"422": {
"content": {
"application/json": {
"example": {
"code": 422,
"data": null,
"error_code": "OPENAPI_INVALID_REQUEST",
"msg": "请求参数无效"
},
"schema": {
"additionalProperties": false,
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"error_code": {
"type": "string"
},
"msg": {
"type": "string"
},
"request_id": {
"type": "string"
},
"trace_id": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data",
"error_code"
],
"type": "object"
}
}
},
"description": "参数值未通过 Biz 校验。检查请求路径及参数。",
"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": {
"example": {
"code": 429,
"data": null,
"error_code": "OPENAPI_RATE_LIMITED",
"msg": "调用频率超限"
},
"schema": {
"additionalProperties": false,
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"error_code": {
"type": "string"
},
"msg": {
"type": "string"
},
"request_id": {
"type": "string"
},
"trace_id": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data",
"error_code"
],
"type": "object"
}
}
},
"description": "调用频率超限。降低调用频率后重试。",
"headers": {
"Retry-After": {
"description": "Delay in seconds or HTTP date before retrying.",
"schema": {
"type": "string"
}
},
"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": {
"example": {
"code": 500,
"data": null,
"error_code": "usage_request_rejected",
"msg": "用量查询被上游拒绝"
},
"schema": {
"additionalProperties": false,
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"error_code": {
"type": "string"
},
"msg": {
"type": "string"
},
"request_id": {
"type": "string"
},
"trace_id": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data",
"error_code"
],
"type": "object"
}
}
},
"description": "Databus 拒绝查询或 Biz 处理失败。保留请求 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"
}
}
}
},
"502": {
"content": {
"application/json": {
"example": {
"code": 502,
"data": null,
"error_code": "usage_upstream_invalid",
"msg": "用量服务返回无效数据"
},
"schema": {
"additionalProperties": false,
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"error_code": {
"type": "string"
},
"msg": {
"type": "string"
},
"request_id": {
"type": "string"
},
"trace_id": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data",
"error_code"
],
"type": "object"
}
}
},
"description": "用量上游响应无效或 Gateway 未取得有效的 Biz 响应。保留请求 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"
}
}
}
},
"503": {
"content": {
"application/json": {
"example": {
"code": 503,
"data": null,
"error_code": "usage_unavailable",
"msg": "用量服务暂不可用"
},
"schema": {
"additionalProperties": false,
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"error_code": {
"type": "string"
},
"msg": {
"type": "string"
},
"request_id": {
"type": "string"
},
"trace_id": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data",
"error_code"
],
"type": "object"
}
}
},
"description": "用量依赖、Biz 或平台暂不可用。稍后重试。",
"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": {
"example": {
"code": 504,
"data": null,
"error_code": "OPENAPI_TIMEOUT",
"msg": "请求处理超时"
},
"schema": {
"additionalProperties": false,
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"error_code": {
"type": "string"
},
"msg": {
"type": "string"
},
"request_id": {
"type": "string"
},
"trace_id": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data",
"error_code"
],
"type": "object"
}
}
},
"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"
}
}
}
},
"default": {
"content": {
"application/json": {
"schema": {
"additionalProperties": false,
"properties": {
"code": {
"type": "integer"
},
"data": {
"type": "null"
},
"error_code": {
"type": "string"
},
"msg": {
"type": "string"
},
"request_id": {
"type": "string"
},
"trace_id": {
"type": "string"
}
},
"required": [
"code",
"msg",
"data",
"error_code"
],
"type": "object"
}
}
},
"description": "其他平台或服务错误。按 error_code 判断处理方式,并保留请求 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"
}
}
}
}
},
"security": [
{
"OpenPlatformBearer": []
}
],
"summary": "查询用量数据版本",
"tags": [
"用量"
]
}
}
},
"info": {
"title": "查询用量数据版本",
"version": "2026-11-24"
},
"servers": [
{
"url": "https://openapi.qwenwork.ai"
}
]
}