Get rated usage summary¶
Aggregate rated usage by billing period, hour, day, or month, grouped by meter, workspace, and record status.
GET https://billing.moi.matrixorigin.cn/api/v1/billing/accounts/$ACCOUNT_ID/usage-summary
Before you begin¶
Prepare a valid personal access token for the account owner.
Call List current accounts to obtain the target account’s ID.
Request example¶
Replace $MOI_PERSONAL_ACCESS_TOKEN and $ACCOUNT_ID in the example with your personal access token and the selected account’s ID.
curl -X GET \
"https://billing.moi.matrixorigin.cn/api/v1/billing/accounts/$ACCOUNT_ID/usage-summary?granularity=period" \
-H "X-API-Key: $MOI_PERSONAL_ACCESS_TOKEN"
Path parameters¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Target account ID from |
Query parameters¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
No |
Inclusive start by record creation time; accepts RFC 3339, |
|
string |
No |
Exclusive end by record creation time. A date-only value expands to midnight after that date. Defaults to tomorrow at midnight in the billing time zone. |
|
string |
No |
IANA time zone; defaults to the billing time zone for the account region. |
|
string |
No |
Time granularity: period, hour, day, or month; defaults to period. |
|
string |
No |
Alias used only when granularity is empty. |
|
string |
No |
Filter by posting period in |
|
string |
No |
Filter by meter code. |
|
string |
No |
Filter by billing item code; when combined with |
|
string |
No |
Filter by the workspace of the usage event. |
|
string |
No |
Filter by usage record status; use charged for charged records. Omitted means no status filter. |
|
string |
No |
Filter by account owner type. |
|
string |
No |
Filter by account owner ID. |
|
string |
No |
Case-insensitive search over rated record ID, usage event ID, meter code, or event key. |
|
string |
No |
Alias for q, used only when q is empty. |
Successful response¶
Returns HTTP 200 with usage and charges aggregated at the selected time granularity.
{
"items": [
{
"bucket_start": "2026-09-01T00:00:00+08:00",
"bucket_end": "2026-10-01T00:00:00+08:00",
"bucket_start_unix": 1788192000,
"bucket_end_unix": 1790784000,
"period": "2026-09",
"meter_code": "meter_example",
"billing_item_code": "meter_example",
"billing_item_display_name": "Example usage",
"unit": "token",
"status": "charged",
"quantity": "1000",
"gross_credit": "1.000000000000",
"discount_credit": "0.100000000000",
"net_credit": "0.900000000000",
"source_record_ids": [
"rated_record_example"
],
"source_record_count": 1
}
],
"total_credit": "0.900000000000",
"granularity": "period",
"timezone": "Asia/Shanghai",
"from": "2026-09-01T00:00:00+08:00",
"to": "2026-10-01T00:00:00+08:00"
}
Field |
Type |
Description |
|---|---|---|
|
array of object |
Aggregated results. |
|
string |
Bucket start in RFC 3339 format. |
|
string |
Exclusive bucket end. |
|
integer |
Bucket start in Unix seconds. |
|
integer |
Bucket end in Unix seconds. |
|
string |
Usage period in |
|
string |
Meter code. |
|
string |
Billing item code. |
|
string |
Billing item display name. |
|
string |
Usage unit. |
|
string |
Workspace ID; may be omitted when no workspace is associated. |
|
string |
Status of the aggregated usage records. |
|
string |
Usage quantity in the billing item’s unit. |
|
string |
Gross charge in Credit. |
|
string |
Discount in Credit. |
|
string |
Net charge in Credit. |
|
array of string |
Rated usage record IDs included in the aggregate. |
|
integer |
Number of records included in the aggregate. |
|
string |
Sum of returned net charges in Credit. |
|
string |
Applied time granularity. |
|
string |
Applied IANA time zone. |
|
string |
Inclusive query start. |
|
string |
Exclusive query end. |
In field paths, [] denotes each array item. For example, items[].bucket_start refers to the corresponding field in each item.
Error response¶
An unsupported time granularity returns HTTP 400; correct the query parameters.
{
"code": "invalid_request",
"message": "invalid request",
"error": "invalid request"
}
Field |
Type |
Description |
|---|---|---|
|
string |
Error code. |
|
string |
Error message. |
|
string |
Compatibility error message, with the same content as message. |