List monthly bill usage line items¶
Group rated usage by posting period and return bill usage line items.
GET https://billing.moi.matrixorigin.cn/api/v1/billing/accounts/$ACCOUNT_ID/monthly-bills/$PERIOD/line-items
Before you begin¶
Prepare a valid personal access token for the account owner.
Call List current accounts to obtain the target account’s ID.
Call List rated usage records to obtain a posting period with usage for that account.
Request example¶
Replace $MOI_PERSONAL_ACCESS_TOKEN, $ACCOUNT_ID, and $PERIOD with your personal access token, account ID, and posting period.
curl -X GET \
"https://billing.moi.matrixorigin.cn/api/v1/billing/accounts/$ACCOUNT_ID/monthly-bills/$PERIOD/line-items?dimension=meter&page_size=2" \
-H "X-API-Key: $MOI_PERSONAL_ACCESS_TOKEN"
Path parameters¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Target account ID from |
|
string |
Yes |
Posting period for the target account from |
Query parameters¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
No |
Aggregation dimension: meter, workspace, service, or day; defaults to meter. Daily grouping uses UTC dates. |
|
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. |
|
integer |
No |
Page size, 1–100; omitted, nonpositive, or greater than 100 uses 50. |
|
string |
No |
Next-page token. Omit for the first request; then use |
Successful response¶
Returns HTTP 200 with aggregated usage line items.
{
"items": [
{
"line_item_id": "billline:2026-09:meter:meter_example",
"period": "2026-09",
"line_type": "usage",
"dimension": "meter",
"group_key": "meter_example",
"group_label": "Example usage",
"meter_code": "meter_example",
"billing_item_code": "meter_example",
"billing_item_display_name": "Example usage",
"unit": "token",
"quantity": "1000",
"gross_credit": "1.000000000000",
"discount_credit": "0.100000000000",
"net_credit": "0.900000000000",
"credit_amount": "0.900000000000",
"source_record_ids": [
"rated_record_example"
],
"source_record_count": 1
}
],
"total": 1,
"next_page_token": ""
}
Field |
Type |
Description |
|---|---|---|
|
array of object |
Aggregated usage line items. |
|
string |
Bill usage line item ID. |
|
string |
Posting period in |
|
string |
Line type, usage. |
|
string |
Applied aggregation dimension. |
|
string |
Group identifier. |
|
string |
Group display label. |
|
string |
Meter code. |
|
string |
Billing item code. |
|
string |
Billing item display name. |
|
string |
Line item unit; grouping across meters uses the unit of the first record in the group. |
|
string |
Workspace ID for workspace grouping; may be omitted. |
|
string |
Service code for service grouping; may be omitted. |
|
string |
UTC day start for daily grouping; may be omitted. |
|
string |
Exclusive UTC day end for daily grouping; may be omitted. |
|
string |
Sum of usage quantities in the group. |
|
string |
Gross charge in Credit. |
|
string |
Discount in Credit. |
|
string |
Net charge in Credit. |
|
string |
Line charge, equal to |
|
array of string |
Rated usage record IDs included in the aggregate. |
|
integer |
Number of records included in the aggregate. |
|
integer |
Total matching aggregated line items. |
|
string |
Next-page token; empty means the last page. |
In field paths, [] denotes each array item. For example, items[].line_item_id refers to the corresponding field in each item.
Set $NEXT_PAGE_TOKEN to next_page_token from the previous 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/monthly-bills/$PERIOD/line-items?dimension=meter&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 |
|---|---|---|
|
string |
Error code. |
|
string |
Error message. |
|
string |
Compatibility error message, with the same content as message. |