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": "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc, 0e5b8609-d901-4992-b394-c3c2e3f37b1c",
  "customer_ids": "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc, 0e5b8609-d901-4992-b394-c3c2e3f37b1c",
  "credit_grant_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": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "name": "<string>",
      "customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "effective_at": "2023-11-07T05:31:56Z",
      "expires_at": "2023-11-07T05:31:56Z",
      "priority": 123,
      "grant_amount": {
        "amount": 123,
        "credit_type": {
          "name": "<string>",
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
        }
      },
      "paid_amount": {
        "amount": 123,
        "credit_type": {
          "name": "<string>",
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
        }
      },
      "balance": {
        "excluding_pending": 123,
        "including_pending": 123,
        "effective_at": "2023-11-07T05:31:56Z"
      },
      "deductions": [
        {
          "amount": 123,
          "reason": "Automated invoice deduction",
          "running_balance": 123,
          "effective_at": "2023-11-07T05:31:56Z",
          "created_by": "<string>",
          "credit_grant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
        }
      ],
      "pending_deductions": [
        {
          "amount": 123,
          "reason": "Automated invoice deduction",
          "running_balance": 123,
          "effective_at": "2023-11-07T05:31:56Z",
          "created_by": "<string>",
          "credit_grant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
        }
      ],
      "custom_fields": {},
      "invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "uniqueness_key": "<string>",
      "reason": "<string>",
      "credit_grant_type": "<string>",
      "products": [
        {
          "id": "<string>",
          "name": "<string>"
        }
      ]
    }
  ],
  "next_page": "<string>"
}

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