List monthly bills

List monthly bills for an account, from newest to oldest billing period.

GET https://billing.moi.matrixorigin.cn/api/v1/billing/accounts/$ACCOUNT_ID/monthly-bills

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/monthly-bills?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

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 the list of generated monthly bills; the list is empty when no bills exist.

{
  "items": [],
  "total": 0,
  "next_page_token": ""
}

Field

Type

Description

items

array of object

Records returned by this request.

items[].period

string

Billing period in YYYY-MM format.

items[].status

string

Monthly bill status.

items[].billing_date

string

First day of the billing period, in YYYY-MM-DD format.

items[].usage_credit

string

Usage charges in Credit, as a decimal string.

items[].subscription_credit

string

Subscription charges in Credit, as a decimal string.

items[].adjustment_credit

string

Adjustments in Credit, as a decimal string.

items[].total_credit

string

Bill total in Credit, as a decimal string.

items[].cleared_overdraft_credit

string

Cleared overdraft in Credit, as a decimal string.

items[].paid_credit

string

Paid charges in Credit, as a decimal string.

items[].outstanding_credit

string

Outstanding charges in Credit, as a decimal string.

items[].closed_at

string

Closing time as a Unix-seconds string; may be omitted before closing.

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[].period 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/monthly-bills?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