Skip to main content
POST
/
credits
/
listGrants
List credit grants
curl --request POST \
  --url https://api.metronome.com/v1/credits/listGrants \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "credit_type_ids": [
    "2714e483-4ff1-48e4-9e25-ac732e8f24f2"
  ],
  "customer_ids": [
    "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc",
    "0e5b8609-d901-4992-b394-c3c2e3f37b1c"
  ],
  "not_expiring_before": "2022-02-01T00:00:00Z",
  "effective_before": "2022-02-01T00:00:00Z"
}'
{
  "data": [
    {
      "id": "9acbc1d0-2044-44c4-8577-f6078a1d8cd2",
      "name": "Initial credit purchase",
      "customer_id": "b310b282-d5cf-4e4f-915f-d8c3c4971e45",
      "uniqueness_key": "823j7fqzo1",
      "reason": "Prepayment",
      "effective_at": "2022-01-01T00:00:00.000Z",
      "expires_at": "2022-04-01T00:00:00.000Z",
      "priority": 0.5,
      "grant_amount": {
        "amount": 100,
        "credit_type": {
          "id": "fa2f1b3d-9d52-4951-a099-25991fd394d6",
          "name": "cloud consumption units"
        }
      },
      "paid_amount": {
        "amount": 10,
        "credit_type": {
          "id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2",
          "name": "USD (cents)"
        }
      },
      "balance": {
        "including_pending": 80,
        "excluding_pending": 80,
        "effective_at": "2022-02-01T00:00:00.000Z"
      },
      "deductions": [
        {
          "amount": 20,
          "reason": "Automated invoice deduction",
          "running_balance": 80,
          "effective_at": "2022-02-01T00:00:00.000Z",
          "created_by": "Metronome System",
          "credit_grant_id": "9acbc1d0-2044-44c4-8577-f6078a1d8cd2",
          "invoice_id": "b6a60e95-15f4-403c-be40-f1c1d58cee20"
        }
      ],
      "pending_deductions": [],
      "custom_fields": {
        "x_account_id": "KyVnHhSBWl7eY2bl"
      },
      "credit_grant_type": "enterprise"
    }
  ],
  "next_page": null
}

Authorizations

Authorization
string
header
required

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

Query Parameters

limit
integer

Max number of results that should be returned

Required range: 1 <= x <= 100
next_page
string

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

Body

application/json

Filters specifying which credit grants should be included

credit_type_ids
string<uuid>[]

An array of credit type IDs. This must not be specified if credit_grant_ids is specified.

Example:

"d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc, 0e5b8609-d901-4992-b394-c3c2e3f37b1c"

customer_ids
string<uuid>[]

An array of Metronome customer IDs. This must not be specified if credit_grant_ids is specified.

Example:

"d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc, 0e5b8609-d901-4992-b394-c3c2e3f37b1c"

credit_grant_ids
string<uuid>[]

An array of credit grant IDs. If this is specified, neither credit_type_ids nor customer_ids may be specified.

Example:

"d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc, 0e5b8609-d901-4992-b394-c3c2e3f37b1c"

not_expiring_before
string<date-time>

Only return credit grants that expire at or after this timestamp.

Example:

"2022-02-01T00:00:00Z"

effective_before
string<date-time>

Only return credit grants that are effective before this timestamp (exclusive).

Example:

"2022-02-01T00:00:00Z"

Response

200 - application/json

Success

data
object[]
required
next_page
string | null
required
I