Skip to main content
POST
/
v1
/
contracts
/
customerCommits
/
list
List commits
curl --request POST \
  --url https://api.metronome.com/v1/contracts/customerCommits/list \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "customer_id": "13117714-3f05-48e5-a6e9-a66093f13b4d",
  "commit_id": "6162d87b-e5db-4a33-b7f2-76ce6ead4e85",
  "include_ledgers": true
}
'
import requests

url = "https://api.metronome.com/v1/contracts/customerCommits/list"

payload = {
    "customer_id": "13117714-3f05-48e5-a6e9-a66093f13b4d",
    "commit_id": "6162d87b-e5db-4a33-b7f2-76ce6ead4e85",
    "include_ledgers": True
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
    commit_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
    include_ledgers: true
  })
};

fetch('https://api.metronome.com/v1/contracts/customerCommits/list', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.metronome.com/v1/contracts/customerCommits/list",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'customer_id' => '13117714-3f05-48e5-a6e9-a66093f13b4d',
    'commit_id' => '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
    'include_ledgers' => true
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.metronome.com/v1/contracts/customerCommits/list"

	payload := strings.NewReader("{\n  \"customer_id\": \"13117714-3f05-48e5-a6e9-a66093f13b4d\",\n  \"commit_id\": \"6162d87b-e5db-4a33-b7f2-76ce6ead4e85\",\n  \"include_ledgers\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.metronome.com/v1/contracts/customerCommits/list")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"customer_id\": \"13117714-3f05-48e5-a6e9-a66093f13b4d\",\n  \"commit_id\": \"6162d87b-e5db-4a33-b7f2-76ce6ead4e85\",\n  \"include_ledgers\": true\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.metronome.com/v1/contracts/customerCommits/list")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"customer_id\": \"13117714-3f05-48e5-a6e9-a66093f13b4d\",\n  \"commit_id\": \"6162d87b-e5db-4a33-b7f2-76ce6ead4e85\",\n  \"include_ledgers\": true\n}"

response = http.request(request)
puts response.read_body
{
  "data": [
    {
      "id": "62c0cb84-bf3f-48b9-9bcf-a8ddf8c1cf35",
      "type": "PREPAID",
      "rate_type": "LIST_RATE",
      "name": "My test commit",
      "description": "My test commit description",
      "priority": 100,
      "product": {
        "id": "2e30f074-d04c-412e-a134-851ebfa5ceb2",
        "name": "My product A"
      },
      "rollover_fraction": 0.1,
      "applicable_product_ids": [
        "13a2179b-f0cb-460b-85a1-cd42964ca533"
      ],
      "applicable_contract_ids": [
        "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc"
      ],
      "access_schedule": {
        "credit_type": {
          "id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2",
          "name": "USD (cents)"
        },
        "schedule_items": [
          {
            "id": "2d45952c-5a6e-43a9-8aab-f61ee21be81a",
            "amount": 10000000,
            "starting_at": "2020-02-01T00:00:00.000Z",
            "ending_before": "2021-02-01T00:00:00.000Z"
          }
        ]
      },
      "invoice_schedule": {
        "credit_type": {
          "id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2",
          "name": "USD (cents)"
        },
        "schedule_items": [
          {
            "id": "f15e4e23-f74e-4de4-9b3a-8b07434116c4",
            "invoice_id": "525b9759-7bbd-4a05-aab1-d7c43c976b57",
            "amount": 10000000,
            "unit_price": 10000000,
            "quantity": 1,
            "timestamp": "2020-03-01T00:00:00.000Z"
          }
        ],
        "do_not_invoice": false
      },
      "invoice_contract": {
        "id": "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc"
      },
      "ledger": [
        {
          "invoice_id": "525b9759-7bbd-4a05-aab1-d7c43c976b57",
          "amount": 10000000,
          "timestamp": "2020-03-01T00:00:00.000Z",
          "type": "PREPAID_COMMIT_AUTOMATED_INVOICE_DEDUCTION",
          "segment_id": "2d45952c-5a6e-43a9-8aab-f61ee21be81a"
        }
      ],
      "uniqueness_key": "946g9bepi1-uniqueness-key",
      "created_at": "2020-01-01T00:00:00.000Z"
    }
  ],
  "next_page": null
}

Authorizations

Authorization
string
header
required

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

Body

application/json

List all commits for a customer

customer_id
string<uuid>
required
commit_id
string<uuid>
covering_date
string<date-time>

Include only commits that have access schedules that "cover" the provided date

starting_at
string<date-time>

Include only commits that have any access on or after the provided date

effective_before
string<date-time>

Include only commits that have any access before the provided date (exclusive)

include_contract_commits
boolean

Include commits on the contract level.

include_archived
boolean

Include archived commits and commits from archived contracts.

include_ledgers
boolean

Include commit ledgers in the response. Setting this flag may cause the query to be slower.

include_balance
boolean

Include the balance in the response. Setting this flag may cause the query to be slower.

next_page
string

The next page token from a previous response.

limit
integer
default:25

The maximum number of commits to return. Defaults to 25.

Required range: 1 <= x <= 25

Response

200 - application/json

Success

data
object[]
required
next_page
string | null
required