跳到主要内容

查询日用量 (V2)

本接口查询指定组织指定时间段的日用量。当前用户须为组织所有者或计费管理员。

POST/v2/usage/query
连接端点

该 API 的 Base URL 格式如下:

https://api.cloud.zilliz.com

📘说明

控制面接口速率限制为单用户单接口每秒最多 20 个请求。

如果您在使用该接口过程中遇到任何问题,欢迎您联系 Zilliz Cloud 技术支持。

shell
export BASE_URL="https://api.cloud.zilliz.com"
参数
Authorizationstringheader必填项

认证令牌,应为具备适当权限的 API 密钥。

示例值:Bearer {{TOKEN}}
请求体
startstring<date-time>

查询时间段的开始时间,采用 RFC 3339 格式(例如 2026-09-16T00:00:00Z)。必须为 UTC 零点整。非 UTC 时区偏移会先被换算为 UTC,日期随之偏移。开始时间不是 UTC 零点时,接口不报错,静默返回当天 items 为空、total 为 0 的日区间。

endstring<date-time>

查询时间段的结束时间,采用 RFC 3339 格式(例如 2026-09-17T00:00:00Z)。结束日期为包含边界:end 与 start 相同时仅返回一个日区间。

bash
export TOKEN="YOUR_API_KEY"

curl --request POST \
--url "${BASE_URL}/v2/usage/query" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Request-Timeout: 5" \
--header "Content-Type: application/json" \
-d '{
"start": "2024-01-01T00:00:00Z",
"end": "2024-02-01T00:00:00Z"
}'
响应

返回指定组织指定时间段的日用量详情。

返回指定组织指定时间段的日用量详情。

codeinteger

响应码。

dataobject

用量查询结果。整个查询区间在单次响应中完整返回。

resultsarray
[]resultsobject
intervalStartstring<date-time>

查询时间段开始时间,格式为 YYYY-MM-DDTHH:mm:ssZ。

intervalEndstring<date-time>

查询时间段结束时间,格式为 YYYY-MM-DDTHH:mm:ssZ。

totalnumber

指定时间段内的用量总金额。

currencystring

总金额币种。

itemsarray

指定时间段内的用量明细。

[]itemsobject
costTypestring

费用类型。

propertiesobject

当前费用项详情。

projectIdstring

产生当前费用项目的集群所属项目 ID。

regionIdstring

产生当前费用项目的集群所属区域 ID。

cuTypestring

产生当前费用项目的集群的 CU 类型。

planstring

产生当前费用项目的集群的订阅计划。

clusterIdstring

产生当前费用项目的集群 ID。

resourceTypestring

计费资源类型。

resourceIdstring

计费资源 ID。

volumeNamestring

Volume 名称。

requestClassstring

计费请求的类别。

quantitynumber

当前费用项对应的已使用的资源数量。

unitstring

当前费用项对应的已使用的资源数量单位。

listPriceobject

当前费用项对应的已使用的资源列表价格。

unitPricenumber

资源单价。

priceobject

当前费用项对应的已使用的资源实际价格。

unitPricenumber

资源单价。

amountnumber

当前费用项的费用金额,币种与该时间区间的 currency 一致。

返回错误消息。

codeinteger

响应码。

messagestring

错误描述。

Successjson
{
"code": 0,
"data": {
"results": [
{
"intervalStart": "2024-01-01T00:00:00Z",
"intervalEnd": "2024-01-02T00:00:00Z",
"total": 12345.12345678,
"currency": "USD",
"items": [
{
"costType": "compute",
"properties": {
"projectId": "proj-xxxxxxxxxxxxxxxxxxxx",
"regionId": "ali-cn-hangzhou",
"cuType": "Performance-optimized",
"plan": "Standard",
"clusterId": "inxx-xxxxx"
},
"quantity": 55.6778,
"unit": "CU-hours",
"listPrice": {
"unitPrice": 123
},
"price": {
"unitPrice": 123
},
"amount": 12345.12345678
},
{
"costType": "storage",
"properties": {
"projectId": "proj-xxxxxxxxxxxxxxxxxxxx",
"regionId": "ali-cn-hangzhou",
"cuType": "Performance-optimized",
"plan": "Standard",
"clusterId": "inxx-xxxxx"
},
"quantity": 55.6778,
"unit": "...",
"amount": 12345.12345678
},
{
"costType": "read_vcu",
"properties": {
"projectId": "proj-xxxxxxxxxxxxxxxxxxxx",
"regionId": "ali-cn-hangzhou",
"clusterId": "inxx-xxxxx"
},
"quantity": 8123789132,
"unit": "...",
"amount": 12345.12345678,
"listPrice": {
"unitPrice": 123
},
"price": {
"unitPrice": 123
}
}
]
}
]
}
}