List consumption aggregates

Aggregate rated usage charges into fixed 10-minute windows and return their source record references.

GET https://billing.moi.matrixorigin.cn/api/v1/billing/accounts/$ACCOUNT_ID/transaction-aggregates

Before you begin

  1. Prepare a valid personal access token for the account owner.

  2. 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/transaction-aggregates?page_size=2" \
  -H "X-API-Key: $MOI_PERSONAL_ACCESS_TOKEN"

Path parameters

Parameter

Type

Required

Description

accountID

string

Yes

Target account ID from items[].billing_account_id in the List current accounts response.

Query parameters

Parameter

Type

Required

Description

from

string

No

Inclusive start by record creation time; accepts RFC 3339, YYYY-MM-DD, or Unix seconds as a string. Defaults to the start of the last 30 days, including today.

to

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.

timezone

string

No

IANA time zone; defaults to the billing time zone for the account region.

period

string

No

Filter by posting period in YYYY-MM format.

meter_code

string

No

Filter by meter code.

billing_item_code

string

No

Filter by billing item code; when combined with meter_code, both must match the same meter.

workspace_id

string

No

Filter by the workspace of the usage event.

status

string

No

Filter by usage record status; use charged for charged records. Omitted means no status filter.

subject_type

string

No

Filter by account owner type.

subject_id

string

No

Filter by account owner ID.

q

string

No

Case-insensitive search over rated record ID, usage event ID, meter code, or event key.

search

string

No

Alias for q, used only when q is empty.

page_size

integer

No

Page size, 1–100; omitted, nonpositive, or greater than 100 uses 50.

page_token

string

No

Next-page token. Omit for the first request; then use next_page_token from the response.

Successful response

Returns HTTP 200 with consumption aggregates with their associated usage and charges.

{
  "items": [
    {
      "aggregation_window_key": "window_example",
      "billing_account_id": "billing_account_example",
      "window_start": "2026-09-01T00:00:00+08:00",
      "window_end": "2026-09-01T00:10:00+08:00",
      "window_start_unix": 1788192000,
      "window_end_unix": 1788192600,
      "net_credit": "0.900000000000",
      "gross_credit": "1.000000000000",
      "discount_credit": "0.100000000000",
      "source_record_ids": [
        "rated_record_example"
      ],
      "source_record_count": 1,
      "meter_codes": [
        "meter_example"
      ],
      "workspace_ids": []
    }
  ],
  "total": 1,
  "next_page_token": ""
}

Field

Type

Description

items

array of object

Records returned by this request.

items[].aggregation_window_key

string

Identifier of the 10-minute aggregation window.

items[].billing_account_id

string

Billing account ID.

items[].window_start

string

Window start in RFC 3339 format.

items[].window_end

string

Exclusive window end.

items[].window_start_unix

integer

Window start in Unix seconds.

items[].window_end_unix

integer

Window end in Unix seconds.

items[].net_credit

string

Net charge in Credit.

items[].gross_credit

string

Gross charge in Credit.

items[].discount_credit

string

Discount in Credit.

items[].source_record_ids

array of string

Rated usage record IDs included in the aggregate.

items[].source_record_count

integer

Number of records included in the aggregate.

items[].meter_codes

array of string

Meter codes included in the window.

items[].workspace_ids

array of string

Workspace IDs included in the window.

total

integer

Total records matching the filters.

next_page_token

string

Next-page token; an empty string marks the last page.

In field paths, [] denotes each array item. For example, items[].aggregation_window_key refers to the corresponding field in each item.

For the next page, set $NEXT_PAGE_TOKEN to next_page_token from the preceding response and retain the same filters. Stop when the token is empty.

curl -X GET \
  "https://billing.moi.matrixorigin.cn/api/v1/billing/accounts/$ACCOUNT_ID/transaction-aggregates?page_size=2&page_token=$NEXT_PAGE_TOKEN" \
  -H "X-API-Key: $MOI_PERSONAL_ACCESS_TOKEN"

Error response

Missing authentication returns HTTP 401; provide a valid personal access token.

{
  "code": "unauthenticated",
  "message": "missing bearer token",
  "error": "missing bearer token"
}

Field

Type

Description

code

string

Error code.

message

string

Error message.

error

string

Compatibility error message, with the same content as message.

Last updated on