List transactions¶
List ledger transactions for recharges, usage, Credit grants, refunds, and other account activity.
GET https://billing.moi.matrixorigin.cn/api/v1/billing/accounts/$ACCOUNT_ID/transactions
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/transactions?page_size=2" \
-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. |
|
string |
No |
IANA time zone for date-only values; defaults to UTC. |
|
string |
No |
Use income for income or expense for expenses. |
|
string |
No |
Filter by source type: recharge, grant, consume, refund, or reservation; corresponding source type codes are also accepted. |
|
string |
No |
Filter by payment channel or Credit grant source channel. |
|
string |
No |
Filter by source payment order, grant approval, or rated usage record status. |
|
string |
No |
Case-insensitive search over ledger transaction ID, source ID, payment order number, provider transaction number, or grant reason. |
|
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 the account’s transaction records.
{
"items": [
{
"transaction_id": "transaction_example",
"ledger_txn_id": "ledger_example",
"billing_account_id": "billing_account_example",
"billing_account_owner_id": "owner_example",
"billing_account_display_name": "Example account",
"created_at": 1788739200,
"entry_type": "consume",
"source_type": "rated_usage_record",
"source_id": "rated_record_example",
"description": "Example usage",
"amount": "0.900000000000",
"balance_delta": "-0.900000000000",
"currency": "CREDIT",
"after_balance": "99.100000000000",
"detail_available": true
}
],
"total": 1,
"next_page_token": ""
}
Field |
Type |
Description |
|---|---|---|
|
array of object |
Records returned by this request. |
|
string |
Transaction ID. |
|
string |
Ledger transaction ID. |
|
string |
Billing account ID. |
|
string |
Account owner ID; may be omitted. |
|
string |
Account display name; may be omitted. |
|
integer |
Creation time in Unix seconds. |
|
string |
Ledger entry type. |
|
string |
Transaction source type. |
|
string |
Transaction source object ID. |
|
string |
Transaction source channel, when available. |
|
string |
Transaction description. |
|
string |
Transaction amount as a decimal string, in currency units. |
|
string |
Balance change; positive for income and negative for expenses. |
|
string |
Transaction unit; Credit transactions use |
|
string |
Post-change balance recorded in the ledger entry. |
|
string |
Related recharge order number, when available. |
|
boolean |
Whether source transaction details are available. |
|
integer |
Total records matching the filters. |
|
string |
Next-page token; an empty string marks the last page. |
In field paths, [] denotes each array item. For example, items[].transaction_id 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/transactions?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. |