Skip to main content
POST
/
credits
/
listEntries
List credit ledger entries
curl --request POST \
  --url https://api.metronome.com/v1/credits/listEntries \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "starting_on": "2021-01-01T00:00:00Z",
  "ending_before": "2021-02-01T00:00:00Z",
  "customer_ids": [
    "6a37bb88-8538-48c5-b37b-a41c836328bd"
  ],
  "credit_type_ids": [
    "2714e483-4ff1-48e4-9e25-ac732e8f24f2"
  ]
}'
{
  "data": [
    {
      "customer_id": "6a37bb88-8538-48c5-b37b-a41c836328bd",
      "ledgers": [
        {
          "credit_type": {
            "id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2",
            "name": "USD (cents)"
          },
          "starting_balance": {
            "including_pending": 400,
            "excluding_pending": 400,
            "effective_at": "2021-01-01T00:00:00Z"
          },
          "ending_balance": {
            "including_pending": 110,
            "excluding_pending": 400,
            "effective_at": "2021-02-01T00:00:00Z"
          },
          "entries": [],
          "pending_entries": [
            {
              "amount": 290,
              "reason": "Automated invoice deduction",
              "running_balance": 110,
              "effective_at": "2021-02-01T00:00:00Z",
              "created_by": "Metronome System",
              "credit_grant_id": "f06b3d1b-c724-4e0b-99d1-20c0526bf21b",
              "invoice_id": "92fb6de8-eb2f-47e5-ae1b-b1e0fb1f388d"
            }
          ]
        }
      ]
    }
  ],
  "next_page": null
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

next_page
string

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

sort
enum<string>

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

Available options:
asc,
desc

Body

application/json

Optional filters on the ledger entries to return

customer_ids
string<uuid>[]

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

credit_type_ids
string<uuid>[]

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

starting_on
string<date-time>

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

ending_before
string<date-time>

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.

Response

Success

data
object[]
required
next_page
string | null
required
I