Skip to main content
POST
/
v1
/
contract-pricing
/
rate-cards
/
addRate
Add a rate
curl --request POST \
  --url https://api.metronome.com/v1/contract-pricing/rate-cards/addRate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "rate_card_id": "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc",
  "product_id": "13117714-3f05-48e5-a6e9-a66093f13b4d",
  "starting_at": "2020-01-01T00:00:00.000Z",
  "entitled": true,
  "rate_type": "FLAT",
  "price": 100,
  "credit_type_id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2"
}
'
import requests

url = "https://api.metronome.com/v1/contract-pricing/rate-cards/addRate"

payload = {
"rate_card_id": "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc",
"product_id": "13117714-3f05-48e5-a6e9-a66093f13b4d",
"starting_at": "2020-01-01T00:00:00.000Z",
"entitled": True,
"rate_type": "FLAT",
"price": 100,
"credit_type_id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2"
}
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({
rate_card_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
product_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
starting_at: '2020-01-01T00:00:00.000Z',
entitled: true,
rate_type: 'FLAT',
price: 100,
credit_type_id: '2714e483-4ff1-48e4-9e25-ac732e8f24f2'
})
};

fetch('https://api.metronome.com/v1/contract-pricing/rate-cards/addRate', 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/contract-pricing/rate-cards/addRate",
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([
'rate_card_id' => 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
'product_id' => '13117714-3f05-48e5-a6e9-a66093f13b4d',
'starting_at' => '2020-01-01T00:00:00.000Z',
'entitled' => true,
'rate_type' => 'FLAT',
'price' => 100,
'credit_type_id' => '2714e483-4ff1-48e4-9e25-ac732e8f24f2'
]),
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/contract-pricing/rate-cards/addRate"

payload := strings.NewReader("{\n \"rate_card_id\": \"d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc\",\n \"product_id\": \"13117714-3f05-48e5-a6e9-a66093f13b4d\",\n \"starting_at\": \"2020-01-01T00:00:00.000Z\",\n \"entitled\": true,\n \"rate_type\": \"FLAT\",\n \"price\": 100,\n \"credit_type_id\": \"2714e483-4ff1-48e4-9e25-ac732e8f24f2\"\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/contract-pricing/rate-cards/addRate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rate_card_id\": \"d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc\",\n \"product_id\": \"13117714-3f05-48e5-a6e9-a66093f13b4d\",\n \"starting_at\": \"2020-01-01T00:00:00.000Z\",\n \"entitled\": true,\n \"rate_type\": \"FLAT\",\n \"price\": 100,\n \"credit_type_id\": \"2714e483-4ff1-48e4-9e25-ac732e8f24f2\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.metronome.com/v1/contract-pricing/rate-cards/addRate")

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 \"rate_card_id\": \"d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc\",\n \"product_id\": \"13117714-3f05-48e5-a6e9-a66093f13b4d\",\n \"starting_at\": \"2020-01-01T00:00:00.000Z\",\n \"entitled\": true,\n \"rate_type\": \"FLAT\",\n \"price\": 100,\n \"credit_type_id\": \"2714e483-4ff1-48e4-9e25-ac732e8f24f2\"\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "rate_type": "FLAT",
    "price": 100
  }
}
{
"message": "<string>"
}
{
"message": "<string>"
}

Authorizations

Authorization
string
header
required

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

Body

application/json

Add a new rate

rate_card_id
string<uuid>
required

ID of the rate card to update

product_id
string<uuid>
required

ID of the product to add a rate for

starting_at
string<date-time>
required

inclusive effective date

entitled
boolean
required
rate_type
enum<string>
required
Available options:
FLAT,
flat,
PERCENTAGE,
percentage,
TIERED,
tiered
pricing_group_values
object

Optional. List of pricing group key value pairs which will be used to calculate the price.

billing_frequency
enum<string>

Optional. Frequency to bill subscriptions with. Required for subscription type products with Flat rate.

Available options:
MONTHLY,
QUARTERLY,
ANNUAL,
WEEKLY,
monthly,
quarterly,
annual,
weekly
ending_before
string<date-time>

exclusive end date

price
number

Default price. For FLAT and SUBSCRIPTION rate_type, this must be >=0. For PERCENTAGE rate_type, this is a decimal fraction, e.g. use 0.1 for 10%; this must be >=0 and <=1.

credit_type_id
string<uuid>

The Metronome ID of the credit type to associate with price, defaults to USD (cents) if not passed. Used by all rate_types except type PERCENTAGE. PERCENTAGE rates use the credit type of associated rates.

Example:

"2714e483-4ff1-48e4-9e25-ac732e8f24f2"

tiers
object[]

Only set for TIERED rate_type.

commit_rate
object

A distinct rate on the rate card. You can choose to use this rate rather than list rate when consuming a credit or commit.

Response

Success

data
object
required