curl --request PUT \
--url https://api.example.com/api/v1/plans/{plan_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"components": [
{
"fee": {
"rates": [
{
"price": "<string>"
}
]
},
"name": "<string>",
"product_id": "prd_7n42DGM5Tflk9n8mt7Fhc7"
}
],
"currency": "<string>",
"name": "<string>",
"add_ons": [
{
"add_on_id": "<string>",
"max_instances": 123,
"price_id": "pri_7n42DGM5Tflk9n8mt7Fhc7",
"self_serviceable": true
}
],
"billing": {
"billing_cycles": 123,
"net_terms": 123,
"period_start_day": 123
},
"description": "<string>",
"minimum_commitment": {
"amount": "<string>",
"scope": {}
},
"trial": {
"duration_days": 1,
"is_free": true,
"trialing_plan_id": "plan_7n42DGM5Tflk9n8mt7Fhc7"
}
}
'import requests
url = "https://api.example.com/api/v1/plans/{plan_id}"
payload = {
"components": [
{
"fee": { "rates": [{ "price": "<string>" }] },
"name": "<string>",
"product_id": "prd_7n42DGM5Tflk9n8mt7Fhc7"
}
],
"currency": "<string>",
"name": "<string>",
"add_ons": [
{
"add_on_id": "<string>",
"max_instances": 123,
"price_id": "pri_7n42DGM5Tflk9n8mt7Fhc7",
"self_serviceable": True
}
],
"billing": {
"billing_cycles": 123,
"net_terms": 123,
"period_start_day": 123
},
"description": "<string>",
"minimum_commitment": {
"amount": "<string>",
"scope": {}
},
"trial": {
"duration_days": 1,
"is_free": True,
"trialing_plan_id": "plan_7n42DGM5Tflk9n8mt7Fhc7"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
components: [
{
fee: {rates: [{price: '<string>'}]},
name: '<string>',
product_id: 'prd_7n42DGM5Tflk9n8mt7Fhc7'
}
],
currency: '<string>',
name: '<string>',
add_ons: [
{
add_on_id: '<string>',
max_instances: 123,
price_id: 'pri_7n42DGM5Tflk9n8mt7Fhc7',
self_serviceable: true
}
],
billing: {billing_cycles: 123, net_terms: 123, period_start_day: 123},
description: '<string>',
minimum_commitment: {amount: '<string>', scope: {}},
trial: {
duration_days: 1,
is_free: true,
trialing_plan_id: 'plan_7n42DGM5Tflk9n8mt7Fhc7'
}
})
};
fetch('https://api.example.com/api/v1/plans/{plan_id}', 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.example.com/api/v1/plans/{plan_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'components' => [
[
'fee' => [
'rates' => [
[
'price' => '<string>'
]
]
],
'name' => '<string>',
'product_id' => 'prd_7n42DGM5Tflk9n8mt7Fhc7'
]
],
'currency' => '<string>',
'name' => '<string>',
'add_ons' => [
[
'add_on_id' => '<string>',
'max_instances' => 123,
'price_id' => 'pri_7n42DGM5Tflk9n8mt7Fhc7',
'self_serviceable' => true
]
],
'billing' => [
'billing_cycles' => 123,
'net_terms' => 123,
'period_start_day' => 123
],
'description' => '<string>',
'minimum_commitment' => [
'amount' => '<string>',
'scope' => [
]
],
'trial' => [
'duration_days' => 1,
'is_free' => true,
'trialing_plan_id' => 'plan_7n42DGM5Tflk9n8mt7Fhc7'
]
]),
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.example.com/api/v1/plans/{plan_id}"
payload := strings.NewReader("{\n \"components\": [\n {\n \"fee\": {\n \"rates\": [\n {\n \"price\": \"<string>\"\n }\n ]\n },\n \"name\": \"<string>\",\n \"product_id\": \"prd_7n42DGM5Tflk9n8mt7Fhc7\"\n }\n ],\n \"currency\": \"<string>\",\n \"name\": \"<string>\",\n \"add_ons\": [\n {\n \"add_on_id\": \"<string>\",\n \"max_instances\": 123,\n \"price_id\": \"pri_7n42DGM5Tflk9n8mt7Fhc7\",\n \"self_serviceable\": true\n }\n ],\n \"billing\": {\n \"billing_cycles\": 123,\n \"net_terms\": 123,\n \"period_start_day\": 123\n },\n \"description\": \"<string>\",\n \"minimum_commitment\": {\n \"amount\": \"<string>\",\n \"scope\": {}\n },\n \"trial\": {\n \"duration_days\": 1,\n \"is_free\": true,\n \"trialing_plan_id\": \"plan_7n42DGM5Tflk9n8mt7Fhc7\"\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.example.com/api/v1/plans/{plan_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"components\": [\n {\n \"fee\": {\n \"rates\": [\n {\n \"price\": \"<string>\"\n }\n ]\n },\n \"name\": \"<string>\",\n \"product_id\": \"prd_7n42DGM5Tflk9n8mt7Fhc7\"\n }\n ],\n \"currency\": \"<string>\",\n \"name\": \"<string>\",\n \"add_ons\": [\n {\n \"add_on_id\": \"<string>\",\n \"max_instances\": 123,\n \"price_id\": \"pri_7n42DGM5Tflk9n8mt7Fhc7\",\n \"self_serviceable\": true\n }\n ],\n \"billing\": {\n \"billing_cycles\": 123,\n \"net_terms\": 123,\n \"period_start_day\": 123\n },\n \"description\": \"<string>\",\n \"minimum_commitment\": {\n \"amount\": \"<string>\",\n \"scope\": {}\n },\n \"trial\": {\n \"duration_days\": 1,\n \"is_free\": true,\n \"trialing_plan_id\": \"plan_7n42DGM5Tflk9n8mt7Fhc7\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/plans/{plan_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"components\": [\n {\n \"fee\": {\n \"rates\": [\n {\n \"price\": \"<string>\"\n }\n ]\n },\n \"name\": \"<string>\",\n \"product_id\": \"prd_7n42DGM5Tflk9n8mt7Fhc7\"\n }\n ],\n \"currency\": \"<string>\",\n \"name\": \"<string>\",\n \"add_ons\": [\n {\n \"add_on_id\": \"<string>\",\n \"max_instances\": 123,\n \"price_id\": \"pri_7n42DGM5Tflk9n8mt7Fhc7\",\n \"self_serviceable\": true\n }\n ],\n \"billing\": {\n \"billing_cycles\": 123,\n \"net_terms\": 123,\n \"period_start_day\": 123\n },\n \"description\": \"<string>\",\n \"minimum_commitment\": {\n \"amount\": \"<string>\",\n \"scope\": {}\n },\n \"trial\": {\n \"duration_days\": 1,\n \"is_free\": true,\n \"trialing_plan_id\": \"plan_7n42DGM5Tflk9n8mt7Fhc7\"\n }\n}"
response = http.request(request)
puts response.read_body{
"available_parameters": {
"billing_periods": {},
"capacity_thresholds": {},
"slot_components": [
"<string>"
]
},
"created_at": "2023-11-07T05:31:56Z",
"currency": "<string>",
"id": "<string>",
"name": "<string>",
"net_terms": 123,
"price_components": [
{
"id": "<string>",
"name": "<string>",
"fee": {
"rates": [
{
"price": "<string>"
}
]
},
"product_id": "prd_7n42DGM5Tflk9n8mt7Fhc7"
}
],
"product_family": {
"id": "<string>",
"name": "<string>"
},
"version": 123,
"version_id": "<string>",
"billing_cycles": 123,
"description": "<string>",
"entitlements": [
{
"created_at": "2023-11-07T05:31:56Z",
"feature_id": "<string>",
"id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"value": {
"enabled": true
}
}
],
"minimum_commitment": {
"amount": "<string>",
"scope": {}
},
"period_start_day": 123,
"self_service_rank": 123,
"trial": {
"duration_days": 1,
"is_free": true,
"trialing_plan_id": "plan_7n42DGM5Tflk9n8mt7Fhc7"
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}Replace a plan
Full replacement of a plan’s version. On a draft plan, updates in-place.
On a published plan, creates a new version. Set status to DRAFT to
stage as a new draft without publishing.
curl --request PUT \
--url https://api.example.com/api/v1/plans/{plan_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"components": [
{
"fee": {
"rates": [
{
"price": "<string>"
}
]
},
"name": "<string>",
"product_id": "prd_7n42DGM5Tflk9n8mt7Fhc7"
}
],
"currency": "<string>",
"name": "<string>",
"add_ons": [
{
"add_on_id": "<string>",
"max_instances": 123,
"price_id": "pri_7n42DGM5Tflk9n8mt7Fhc7",
"self_serviceable": true
}
],
"billing": {
"billing_cycles": 123,
"net_terms": 123,
"period_start_day": 123
},
"description": "<string>",
"minimum_commitment": {
"amount": "<string>",
"scope": {}
},
"trial": {
"duration_days": 1,
"is_free": true,
"trialing_plan_id": "plan_7n42DGM5Tflk9n8mt7Fhc7"
}
}
'import requests
url = "https://api.example.com/api/v1/plans/{plan_id}"
payload = {
"components": [
{
"fee": { "rates": [{ "price": "<string>" }] },
"name": "<string>",
"product_id": "prd_7n42DGM5Tflk9n8mt7Fhc7"
}
],
"currency": "<string>",
"name": "<string>",
"add_ons": [
{
"add_on_id": "<string>",
"max_instances": 123,
"price_id": "pri_7n42DGM5Tflk9n8mt7Fhc7",
"self_serviceable": True
}
],
"billing": {
"billing_cycles": 123,
"net_terms": 123,
"period_start_day": 123
},
"description": "<string>",
"minimum_commitment": {
"amount": "<string>",
"scope": {}
},
"trial": {
"duration_days": 1,
"is_free": True,
"trialing_plan_id": "plan_7n42DGM5Tflk9n8mt7Fhc7"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
components: [
{
fee: {rates: [{price: '<string>'}]},
name: '<string>',
product_id: 'prd_7n42DGM5Tflk9n8mt7Fhc7'
}
],
currency: '<string>',
name: '<string>',
add_ons: [
{
add_on_id: '<string>',
max_instances: 123,
price_id: 'pri_7n42DGM5Tflk9n8mt7Fhc7',
self_serviceable: true
}
],
billing: {billing_cycles: 123, net_terms: 123, period_start_day: 123},
description: '<string>',
minimum_commitment: {amount: '<string>', scope: {}},
trial: {
duration_days: 1,
is_free: true,
trialing_plan_id: 'plan_7n42DGM5Tflk9n8mt7Fhc7'
}
})
};
fetch('https://api.example.com/api/v1/plans/{plan_id}', 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.example.com/api/v1/plans/{plan_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'components' => [
[
'fee' => [
'rates' => [
[
'price' => '<string>'
]
]
],
'name' => '<string>',
'product_id' => 'prd_7n42DGM5Tflk9n8mt7Fhc7'
]
],
'currency' => '<string>',
'name' => '<string>',
'add_ons' => [
[
'add_on_id' => '<string>',
'max_instances' => 123,
'price_id' => 'pri_7n42DGM5Tflk9n8mt7Fhc7',
'self_serviceable' => true
]
],
'billing' => [
'billing_cycles' => 123,
'net_terms' => 123,
'period_start_day' => 123
],
'description' => '<string>',
'minimum_commitment' => [
'amount' => '<string>',
'scope' => [
]
],
'trial' => [
'duration_days' => 1,
'is_free' => true,
'trialing_plan_id' => 'plan_7n42DGM5Tflk9n8mt7Fhc7'
]
]),
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.example.com/api/v1/plans/{plan_id}"
payload := strings.NewReader("{\n \"components\": [\n {\n \"fee\": {\n \"rates\": [\n {\n \"price\": \"<string>\"\n }\n ]\n },\n \"name\": \"<string>\",\n \"product_id\": \"prd_7n42DGM5Tflk9n8mt7Fhc7\"\n }\n ],\n \"currency\": \"<string>\",\n \"name\": \"<string>\",\n \"add_ons\": [\n {\n \"add_on_id\": \"<string>\",\n \"max_instances\": 123,\n \"price_id\": \"pri_7n42DGM5Tflk9n8mt7Fhc7\",\n \"self_serviceable\": true\n }\n ],\n \"billing\": {\n \"billing_cycles\": 123,\n \"net_terms\": 123,\n \"period_start_day\": 123\n },\n \"description\": \"<string>\",\n \"minimum_commitment\": {\n \"amount\": \"<string>\",\n \"scope\": {}\n },\n \"trial\": {\n \"duration_days\": 1,\n \"is_free\": true,\n \"trialing_plan_id\": \"plan_7n42DGM5Tflk9n8mt7Fhc7\"\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.example.com/api/v1/plans/{plan_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"components\": [\n {\n \"fee\": {\n \"rates\": [\n {\n \"price\": \"<string>\"\n }\n ]\n },\n \"name\": \"<string>\",\n \"product_id\": \"prd_7n42DGM5Tflk9n8mt7Fhc7\"\n }\n ],\n \"currency\": \"<string>\",\n \"name\": \"<string>\",\n \"add_ons\": [\n {\n \"add_on_id\": \"<string>\",\n \"max_instances\": 123,\n \"price_id\": \"pri_7n42DGM5Tflk9n8mt7Fhc7\",\n \"self_serviceable\": true\n }\n ],\n \"billing\": {\n \"billing_cycles\": 123,\n \"net_terms\": 123,\n \"period_start_day\": 123\n },\n \"description\": \"<string>\",\n \"minimum_commitment\": {\n \"amount\": \"<string>\",\n \"scope\": {}\n },\n \"trial\": {\n \"duration_days\": 1,\n \"is_free\": true,\n \"trialing_plan_id\": \"plan_7n42DGM5Tflk9n8mt7Fhc7\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/plans/{plan_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"components\": [\n {\n \"fee\": {\n \"rates\": [\n {\n \"price\": \"<string>\"\n }\n ]\n },\n \"name\": \"<string>\",\n \"product_id\": \"prd_7n42DGM5Tflk9n8mt7Fhc7\"\n }\n ],\n \"currency\": \"<string>\",\n \"name\": \"<string>\",\n \"add_ons\": [\n {\n \"add_on_id\": \"<string>\",\n \"max_instances\": 123,\n \"price_id\": \"pri_7n42DGM5Tflk9n8mt7Fhc7\",\n \"self_serviceable\": true\n }\n ],\n \"billing\": {\n \"billing_cycles\": 123,\n \"net_terms\": 123,\n \"period_start_day\": 123\n },\n \"description\": \"<string>\",\n \"minimum_commitment\": {\n \"amount\": \"<string>\",\n \"scope\": {}\n },\n \"trial\": {\n \"duration_days\": 1,\n \"is_free\": true,\n \"trialing_plan_id\": \"plan_7n42DGM5Tflk9n8mt7Fhc7\"\n }\n}"
response = http.request(request)
puts response.read_body{
"available_parameters": {
"billing_periods": {},
"capacity_thresholds": {},
"slot_components": [
"<string>"
]
},
"created_at": "2023-11-07T05:31:56Z",
"currency": "<string>",
"id": "<string>",
"name": "<string>",
"net_terms": 123,
"price_components": [
{
"id": "<string>",
"name": "<string>",
"fee": {
"rates": [
{
"price": "<string>"
}
]
},
"product_id": "prd_7n42DGM5Tflk9n8mt7Fhc7"
}
],
"product_family": {
"id": "<string>",
"name": "<string>"
},
"version": 123,
"version_id": "<string>",
"billing_cycles": 123,
"description": "<string>",
"entitlements": [
{
"created_at": "2023-11-07T05:31:56Z",
"feature_id": "<string>",
"id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"value": {
"enabled": true
}
}
],
"minimum_commitment": {
"amount": "<string>",
"scope": {}
},
"period_start_day": 123,
"self_service_rank": 123,
"trial": {
"duration_days": 1,
"is_free": true,
"trialing_plan_id": "plan_7n42DGM5Tflk9n8mt7Fhc7"
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Plan ID
"plan_7n42DGM5Tflk9n8mt7Fhc7"
Body
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Optional plan-level period minimum commitment. Component scope must reference names
that exist in components (matched by name, not by ID, since component IDs are
assigned by the server). Use MinimumCommitmentInput so the client can express
scope by component name.
Show child attributes
Show child attributes
DRAFT, ACTIVE, INACTIVE, ARCHIVED Show child attributes
Show child attributes
Response
Plan updated
Show child attributes
Show child attributes
"plan_7n42DGM5Tflk9n8mt7Fhc7"
STANDARD, FREE, CUSTOM Show child attributes
Show child attributes
Show child attributes
Show child attributes
DRAFT, ACTIVE, INACTIVE, ARCHIVED "plv_7n42DGM5Tflk9n8mt7Fhc7"
Show child attributes
Show child attributes
Plan-level minimum commitment (period true-up floor). When set, every billing-period
invoice for this plan is guaranteed to be at least minimum_commitment.amount after
discounts, with a "Minimum commitment" line filling any shortfall.
Show child attributes
Show child attributes
Show child attributes
Show child attributes