Skip to main content

Create an API token

  1. Log into the Metronome App here.
  2. Navigate to Connections → API tokens & webhooks → Add.
  3. Create a new token and give it a descriptive name.
  4. Make sure to copy the token to a secure location before clicking Done.
Learn more about Metronome API authentication here.

Install the Metronome SDK

  1. Install the SDK in your environment.
pip install --pre metronome-sdk
npm install @metronome/sdk
gem install metronome-sdk
go get -u 'github.com/Metronome-Industries/metronome-go'
  1. Configure the SDK by passing in your API key . By default, the SDK looks for the API key under the environment variable METRONOME_BEARER_TOKEN.
from metronome import Metronome

client = Metronome(
  # Defaults to os.environ.get("METRONOME_BEARER_TOKEN") if omitted
  bearer_token="My bearer token",
)
import Metronome from "@metronome/sdk";

const client = new Metronome({
  // Defaults to os.environ.get("METRONOME_BEARER_TOKEN") if omitted
  bearerToken: "My bearer token",
});
require "bundler/setup"
require "metronome_sdk"

metronome = MetronomeSDK::Client.new(
    bearer_token: "My Bearer Token" # defaults to ENV["METRONOME_BEARER_TOKEN"]
)
package main

import (
  "context"
  "fmt"
  "github.com/Metronome-Industries/metronome-go"
  "github.com/Metronome-Industries/metronome-go/option"
)

func main() {
  client := metronome.NewClient(
    option.WithBearerToken("My bearer token"), // defaults to os.LookupEnv("METRONOME_BEARER_TOKEN") if omitted
  )
}
Learn more about the Metronome SDK here.

Test the API

  1. Make a test API call - for example, list the customers in your Metronome account. This will work even if your customer list is empty.
response = client.v1.customers.list()
print("✓ Connected to Metronome!")
if response.data:
    customer = response.data[0]
    print(f"  First customer: {customer.name}")
else:
    print("  No customers found.")
const resp = await client.v1.customers.list();
console.log('✓ Connected to Metronome!');
if (resp.data && resp.data.length > 0) {
  console.log(`  First customer: ${resp.data[0].name}`);
} else {
  console.log('  No customers found.');
}
resp = client.v1.customers.list
puts '✓ Connected to Metronome!'
if resp.data && !resp.data.empty?
  puts "  First customer: #{resp.data.first.name}"
else
  puts '  No customers found.'
end
resp, err := client.V1.Customers.List(context.TODO(), metronome.V1CustomerListParams{})
if err != nil {
  return fmt.Errorf("failed to list customers: %w", err)
}
fmt.Println("✓ Connected to Metronome!")
if len(resp.Data) > 0 {
  fmt.Printf("  First customer: %s\n", resp.Data[0].Name)
} else {
  fmt.Println("  No customers found.")
}
Success! You’re now connected to Metronome. Once connected, you can track usage, set pricing, and automate invoicing.

Next Steps