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

  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/transactions?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.

to

string

No

Exclusive end by record creation time. A date-only value expands to midnight after that date.

timezone

string

No

IANA time zone for date-only values; defaults to UTC.

direction

string

No

Use income for income or expense for expenses.

transaction_type

string

No

Filter by source type: recharge, grant, consume, refund, or reservation; corresponding source type codes are also accepted.

channel

string

No

Filter by payment channel or Credit grant source channel.

status

string

No

Filter by source payment order, grant approval, or rated usage record status.

q

string

No

Case-insensitive search over ledger transaction ID, source ID, payment order number, provider transaction number, or grant reason.

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 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

items

array of object

Records returned by this request.

items[].transaction_id

string

Transaction ID.

items[].ledger_txn_id

string

Ledger transaction ID.

items[].billing_account_id

string

Billing account ID.

items[].billing_account_owner_id

string

Account owner ID; may be omitted.

items[].billing_account_display_name

string

Account display name; may be omitted.

items[].created_at

integer

Creation time in Unix seconds.

items[].entry_type

string

Ledger entry type.

items[].source_type

string

Transaction source type.

items[].source_id

string

Transaction source object ID.

items[].source_channel

string

Transaction source channel, when available.

items[].description

string

Transaction description.

items[].amount

string

Transaction amount as a decimal string, in currency units.

items[].balance_delta

string

Balance change; positive for income and negative for expenses.

items[].currency

string

Transaction unit; Credit transactions use CREDIT.

items[].after_balance

string

Post-change balance recorded in the ledger entry.

items[].related_order_no

string

Related recharge order number, when available.

items[].detail_available

boolean

Whether source transaction details are available.

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[].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

code

string

Error code.

message

string

Error message.

error

string

Compatibility error message, with the same content as message.

Last updated on