Skip to main content
GET
/
v1
/
customers
/
{customer_id}
/
invoices
List invoices
curl --request GET \
  --url https://api.metronome.com/v1/customers/{customer_id}/invoices \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.metronome.com/v1/customers/{customer_id}/invoices"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.metronome.com/v1/customers/{customer_id}/invoices', 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/customers/{customer_id}/invoices",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>"
  ],
]);

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

curl_close($curl);

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

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

func main() {

	url := "https://api.metronome.com/v1/customers/{customer_id}/invoices"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

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

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

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.metronome.com/v1/customers/{customer_id}/invoices")
  .header("Authorization", "Bearer <token>")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.metronome.com/v1/customers/{customer_id}/invoices")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "data": [
    {
      "id": "6a37bb88-8538-48c5-b37b-a41c836328bd",
      "customer_id": "617e39d8-68f4-4592-b8d2-c2bf26a76989",
      "type": "USAGE",
      "start_timestamp": "2021-01-01T00:00:00Z",
      "end_timestamp": "2021-02-01T00:00:00Z",
      "credit_type": {
        "id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2",
        "name": "USD (cents)"
      },
      "contract_id": "9de042a1-b955-43ce-9ab4-e3c2004570d1",
      "line_items": [
        {
          "credit_type": {
            "id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2",
            "name": "USD (cents)"
          },
          "name": "CPU hours",
          "type": "usage",
          "quantity": 1488,
          "total": 14392,
          "product_id": "5c1f40cd-9ff8-4e90-ae53-5f81b0e9d1e8"
        }
      ],
      "total": 14392,
      "status": "FINALIZED"
    }
  ],
  "next_page": null
}
{
  "message": "<string>"
}

Authorizations

Authorization
string
header
required

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

Path Parameters

customer_id
string<uuid>
required

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.

status
string

Invoice status, e.g. DRAFT, FINALIZED, or VOID

type
enum<string>

Filter invoices by type. Defaults to returning all invoice types.

Available options:
USAGE,
USAGE_CONSOLIDATED,
SCHEDULED
skip_zero_qty_line_items
boolean

If set, all zero quantity line items will be filtered out of the response

sort
enum<string>

Invoice sort order by issued_at, e.g. date_asc or date_desc. Defaults to date_asc.

Available options:
date_asc,
date_desc
credit_type_id
string

Only return invoices for the specified credit type

contract_id
string<uuid>

Only return invoices for the specified contract

starting_on
string<date-time>

RFC 3339 timestamp (inclusive). Invoices will only be returned for billing periods that start at or after this time.

ending_before
string<date-time>

RFC 3339 timestamp (exclusive). Invoices will only be returned for billing periods that end before this time.

webhook_notification_id
string

Indicates that this API request was triggered by a webhook notification with the provided ID.

Response

Success

data
object[]
required
next_page
string | null
required