Skip to content
  • Auto
  • Light
  • Dark
Talk to an expert

List Entries

List credit ledger entries
post/v1/credits/listEntries

Fetches a list of credit ledger entries. Returns lists of ledgers per customer. Ledger entries are returned in chronological order. Ledger entries associated with voided credit grants are not included.

Query Parameters
next_pagestring
optional

Cursor that indicates where the next page of results should start.

sortenum
optional
"asc" OR "desc"

Ledgers sort order by date, asc or desc. Defaults to asc.

Hide ParametersShow Parameters
"asc"
"desc"
Body Parameters
credit_type_idsarray of string
optional

A list of Metronome credit type IDs to fetch ledger entries for. If absent, ledger entries for all credit types will be returned.

customer_idsarray of string
optional

A list of Metronome customer IDs to fetch ledger entries for. If absent, ledger entries for all customers will be returned.

ending_beforestring
optional

If supplied, ledger entries will only be returned with an effective_at before this time. This timestamp must not be in the future. If no timestamp is supplied, all entries up to the start of the customer's next billing period will be returned.

formatdate-time
starting_onstring
optional

If supplied, only ledger entries effective at or after this time will be returned.

formatdate-time
Returns
dataarray of object
Hide ParametersShow Parameters
customer_idstring
formatuuid
ledgersarray of object
Hide ParametersShow Parameters
credit_typeidstringnamestringCreditTypeData
ending_balanceobject

the effective balances at the end of the specified time window

Hide ParametersShow Parameters
effective_atstring

the ending_before request parameter (if supplied) or the current billing period's end date

formatdate-time
excluding_pendingnumber

the ending balance, including the balance of all grants that have not expired before the effective_at date and deductions that happened before the effective_at date

including_pendingnumber

the excluding_pending balance plus any pending invoice deductions and expirations that will happen by the effective_at date

entriesarray of amountnumbercreated_bystringcredit_grant_idstringeffective_atstringreasonstringrunning_balancenumberinvoice_idstringCreditLedgerEntry
pending_entriesarray of amountnumbercreated_bystringcredit_grant_idstringeffective_atstringreasonstringrunning_balancenumberinvoice_idstringCreditLedgerEntry
starting_balanceobject
Hide ParametersShow Parameters
effective_atstring

the starting_on request parameter (if supplied) or the first credit grant's effective_at date

formatdate-time
excluding_pendingnumber

the starting balance, including all posted grants, deductions, and expirations that happened at or before the effective_at timestamp

including_pendingnumber

the excluding_pending balance plus any pending activity that has not been posted at the time of the query

next_pagestring
curl https://api.metronome.com/v1/credits/listEntries \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $METRONOME_BEARER_TOKEN"
200 Example
{
  "data": [
    {
      "customer_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "ledgers": [
        {
          "credit_type": {
            "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            "name": "name"
          },
          "ending_balance": {
            "effective_at": "2019-12-27T18:11:19.117Z",
            "excluding_pending": 0,
            "including_pending": 0
          },
          "entries": [
            {
              "amount": 0,
              "created_by": "created_by",
              "credit_grant_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
              "effective_at": "2019-12-27T18:11:19.117Z",
              "reason": "Automated invoice deduction",
              "running_balance": 0,
              "invoice_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
            }
          ],
          "pending_entries": [
            {
              "amount": 0,
              "created_by": "created_by",
              "credit_grant_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
              "effective_at": "2019-12-27T18:11:19.117Z",
              "reason": "Automated invoice deduction",
              "running_balance": 0,
              "invoice_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
            }
          ],
          "starting_balance": {
            "effective_at": "2019-12-27T18:11:19.117Z",
            "excluding_pending": 0,
            "including_pending": 0
          }
        }
      ]
    }
  ],
  "next_page": "next_page"
}