Update a plan
curl --request PUT \
--url https://api.getlago.com/api/v1/plans/{code} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"plan": {
"name": "Startup",
"invoice_display_name": "Startup plan",
"code": "startup",
"interval": "monthly",
"description": "Plan for early stage startups.",
"amount_cents": 10000,
"amount_currency": "USD",
"trial_period": 5,
"pay_in_advance": true,
"bill_charges_monthly": null,
"bill_fixed_charges_monthly": null,
"tax_codes": [
"french_standard_vat"
],
"minimum_commitment": {
"amount_cents": 100000,
"invoice_display_name": "Minimum Commitment (C1)",
"tax_codes": [
"french_standard_vat"
]
},
"charges": [
{
"billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a91",
"charge_model": "package",
"invoiceable": true,
"invoice_display_name": "Setup",
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 3000,
"properties": {
"amount": "30",
"free_units": 100,
"package_size": 1000
},
"tax_codes": [
"french_standard_vat"
]
},
{
"billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a92",
"charge_model": "graduated",
"invoiceable": true,
"invoice_display_name": "Setup",
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"graduated_ranges": [
{
"to_value": 10,
"from_value": 0,
"flat_amount": "10",
"per_unit_amount": "0.5"
},
{
"to_value": null,
"from_value": 11,
"flat_amount": "0",
"per_unit_amount": "0.4"
}
]
}
},
{
"billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a93",
"charge_model": "standard",
"invoiceable": true,
"invoice_display_name": "Setup",
"pay_in_advance": true,
"regroup_paid_fees": null,
"prorated": false,
"min_amount_cents": 0,
"properties": {}
},
{
"billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a94",
"charge_model": "volume",
"invoiceable": true,
"invoice_display_name": "Setup",
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"volume_ranges": [
{
"from_value": 0,
"to_value": 100,
"flat_amount": "0",
"per_unit_amount": "0"
},
{
"from_value": 101,
"to_value": null,
"flat_amount": "0",
"per_unit_amount": "0.5"
}
]
}
},
{
"billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a95",
"charge_model": "percentage",
"invoiceable": false,
"invoice_display_name": "Setup",
"pay_in_advance": true,
"regroup_paid_fees": "invoice",
"prorated": false,
"min_amount_cents": 0,
"properties": {
"rate": "1",
"fixed_amount": "0.5",
"free_units_per_events": 5,
"free_units_per_total_aggregation": "500"
}
}
],
"fixed_charges": [
{
"id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"invoice_display_name": "New Setup Fee",
"charge_model": "standard",
"apply_units_immediately": true,
"units": 5
},
{
"add_on_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "setup_fee",
"invoice_display_name": "Setup Fee",
"charge_model": "standard",
"pay_in_advance": true,
"prorated": false,
"properties": {
"amount": "500"
},
"units": 1,
"apply_units_immediately": false,
"tax_codes": [
"french_standard_vat"
]
},
{
"add_on_id": "4d604d60-4d60-4d60-4d60-4d604d604d60",
"invoice_display_name": "Support Tier",
"charge_model": "graduated",
"pay_in_advance": false,
"prorated": true,
"properties": {
"graduated_ranges": [
{
"from_value": 0,
"to_value": 10,
"per_unit_amount": "5",
"flat_amount": "200"
},
{
"from_value": 11,
"to_value": null,
"per_unit_amount": "1",
"flat_amount": "300"
}
]
},
"units": 2
},
{
"add_on_id": "6f406f40-6f40-6f40-6f40-6f406f406f40",
"charge_model": "volume",
"properties": {
"volume_ranges": [
{
"from_value": 0,
"to_value": 100,
"per_unit_amount": "2",
"flat_amount": "1"
},
{
"from_value": 101,
"to_value": null,
"per_unit_amount": "1",
"flat_amount": "0"
}
]
},
"units": 50
}
],
"usage_thresholds": [
{
"amount_cents": 10000,
"threshold_display_name": "Threshold 1",
"recurring": true
}
],
"cascade_updates": true,
"metadata": {
"external_id": "ext-123",
"synced_at": "2024-01-15"
}
}
}
'import requests
url = "https://api.getlago.com/api/v1/plans/{code}"
payload = { "plan": {
"name": "Startup",
"invoice_display_name": "Startup plan",
"code": "startup",
"interval": "monthly",
"description": "Plan for early stage startups.",
"amount_cents": 10000,
"amount_currency": "USD",
"trial_period": 5,
"pay_in_advance": True,
"bill_charges_monthly": None,
"bill_fixed_charges_monthly": None,
"tax_codes": ["french_standard_vat"],
"minimum_commitment": {
"amount_cents": 100000,
"invoice_display_name": "Minimum Commitment (C1)",
"tax_codes": ["french_standard_vat"]
},
"charges": [
{
"billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a91",
"charge_model": "package",
"invoiceable": True,
"invoice_display_name": "Setup",
"pay_in_advance": False,
"prorated": False,
"min_amount_cents": 3000,
"properties": {
"amount": "30",
"free_units": 100,
"package_size": 1000
},
"tax_codes": ["french_standard_vat"]
},
{
"billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a92",
"charge_model": "graduated",
"invoiceable": True,
"invoice_display_name": "Setup",
"pay_in_advance": False,
"prorated": False,
"min_amount_cents": 0,
"properties": { "graduated_ranges": [
{
"to_value": 10,
"from_value": 0,
"flat_amount": "10",
"per_unit_amount": "0.5"
},
{
"to_value": None,
"from_value": 11,
"flat_amount": "0",
"per_unit_amount": "0.4"
}
] }
},
{
"billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a93",
"charge_model": "standard",
"invoiceable": True,
"invoice_display_name": "Setup",
"pay_in_advance": True,
"regroup_paid_fees": None,
"prorated": False,
"min_amount_cents": 0,
"properties": {}
},
{
"billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a94",
"charge_model": "volume",
"invoiceable": True,
"invoice_display_name": "Setup",
"pay_in_advance": False,
"prorated": False,
"min_amount_cents": 0,
"properties": { "volume_ranges": [
{
"from_value": 0,
"to_value": 100,
"flat_amount": "0",
"per_unit_amount": "0"
},
{
"from_value": 101,
"to_value": None,
"flat_amount": "0",
"per_unit_amount": "0.5"
}
] }
},
{
"billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a95",
"charge_model": "percentage",
"invoiceable": False,
"invoice_display_name": "Setup",
"pay_in_advance": True,
"regroup_paid_fees": "invoice",
"prorated": False,
"min_amount_cents": 0,
"properties": {
"rate": "1",
"fixed_amount": "0.5",
"free_units_per_events": 5,
"free_units_per_total_aggregation": "500"
}
}
],
"fixed_charges": [
{
"id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"invoice_display_name": "New Setup Fee",
"charge_model": "standard",
"apply_units_immediately": True,
"units": 5
},
{
"add_on_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "setup_fee",
"invoice_display_name": "Setup Fee",
"charge_model": "standard",
"pay_in_advance": True,
"prorated": False,
"properties": { "amount": "500" },
"units": 1,
"apply_units_immediately": False,
"tax_codes": ["french_standard_vat"]
},
{
"add_on_id": "4d604d60-4d60-4d60-4d60-4d604d604d60",
"invoice_display_name": "Support Tier",
"charge_model": "graduated",
"pay_in_advance": False,
"prorated": True,
"properties": { "graduated_ranges": [
{
"from_value": 0,
"to_value": 10,
"per_unit_amount": "5",
"flat_amount": "200"
},
{
"from_value": 11,
"to_value": None,
"per_unit_amount": "1",
"flat_amount": "300"
}
] },
"units": 2
},
{
"add_on_id": "6f406f40-6f40-6f40-6f40-6f406f406f40",
"charge_model": "volume",
"properties": { "volume_ranges": [
{
"from_value": 0,
"to_value": 100,
"per_unit_amount": "2",
"flat_amount": "1"
},
{
"from_value": 101,
"to_value": None,
"per_unit_amount": "1",
"flat_amount": "0"
}
] },
"units": 50
}
],
"usage_thresholds": [
{
"amount_cents": 10000,
"threshold_display_name": "Threshold 1",
"recurring": True
}
],
"cascade_updates": True,
"metadata": {
"external_id": "ext-123",
"synced_at": "2024-01-15"
}
} }
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({
plan: {
name: 'Startup',
invoice_display_name: 'Startup plan',
code: 'startup',
interval: 'monthly',
description: 'Plan for early stage startups.',
amount_cents: 10000,
amount_currency: 'USD',
trial_period: 5,
pay_in_advance: true,
bill_charges_monthly: null,
bill_fixed_charges_monthly: null,
tax_codes: ['french_standard_vat'],
minimum_commitment: {
amount_cents: 100000,
invoice_display_name: 'Minimum Commitment (C1)',
tax_codes: ['french_standard_vat']
},
charges: [
{
billable_metric_id: '1a901a90-1a90-1a90-1a90-1a901a901a91',
charge_model: 'package',
invoiceable: true,
invoice_display_name: 'Setup',
pay_in_advance: false,
prorated: false,
min_amount_cents: 3000,
properties: {amount: '30', free_units: 100, package_size: 1000},
tax_codes: ['french_standard_vat']
},
{
billable_metric_id: '1a901a90-1a90-1a90-1a90-1a901a901a92',
charge_model: 'graduated',
invoiceable: true,
invoice_display_name: 'Setup',
pay_in_advance: false,
prorated: false,
min_amount_cents: 0,
properties: {
graduated_ranges: [
{to_value: 10, from_value: 0, flat_amount: '10', per_unit_amount: '0.5'},
{to_value: null, from_value: 11, flat_amount: '0', per_unit_amount: '0.4'}
]
}
},
{
billable_metric_id: '1a901a90-1a90-1a90-1a90-1a901a901a93',
charge_model: 'standard',
invoiceable: true,
invoice_display_name: 'Setup',
pay_in_advance: true,
regroup_paid_fees: null,
prorated: false,
min_amount_cents: 0,
properties: {}
},
{
billable_metric_id: '1a901a90-1a90-1a90-1a90-1a901a901a94',
charge_model: 'volume',
invoiceable: true,
invoice_display_name: 'Setup',
pay_in_advance: false,
prorated: false,
min_amount_cents: 0,
properties: {
volume_ranges: [
{from_value: 0, to_value: 100, flat_amount: '0', per_unit_amount: '0'},
{from_value: 101, to_value: null, flat_amount: '0', per_unit_amount: '0.5'}
]
}
},
{
billable_metric_id: '1a901a90-1a90-1a90-1a90-1a901a901a95',
charge_model: 'percentage',
invoiceable: false,
invoice_display_name: 'Setup',
pay_in_advance: true,
regroup_paid_fees: 'invoice',
prorated: false,
min_amount_cents: 0,
properties: {
rate: '1',
fixed_amount: '0.5',
free_units_per_events: 5,
free_units_per_total_aggregation: '500'
}
}
],
fixed_charges: [
{
id: '1a901a90-1a90-1a90-1a90-1a901a901a90',
invoice_display_name: 'New Setup Fee',
charge_model: 'standard',
apply_units_immediately: true,
units: 5
},
{
add_on_id: '1a901a90-1a90-1a90-1a90-1a901a901a90',
code: 'setup_fee',
invoice_display_name: 'Setup Fee',
charge_model: 'standard',
pay_in_advance: true,
prorated: false,
properties: {amount: '500'},
units: 1,
apply_units_immediately: false,
tax_codes: ['french_standard_vat']
},
{
add_on_id: '4d604d60-4d60-4d60-4d60-4d604d604d60',
invoice_display_name: 'Support Tier',
charge_model: 'graduated',
pay_in_advance: false,
prorated: true,
properties: {
graduated_ranges: [
{from_value: 0, to_value: 10, per_unit_amount: '5', flat_amount: '200'},
{from_value: 11, to_value: null, per_unit_amount: '1', flat_amount: '300'}
]
},
units: 2
},
{
add_on_id: '6f406f40-6f40-6f40-6f40-6f406f406f40',
charge_model: 'volume',
properties: {
volume_ranges: [
{from_value: 0, to_value: 100, per_unit_amount: '2', flat_amount: '1'},
{from_value: 101, to_value: null, per_unit_amount: '1', flat_amount: '0'}
]
},
units: 50
}
],
usage_thresholds: [{amount_cents: 10000, threshold_display_name: 'Threshold 1', recurring: true}],
cascade_updates: true,
metadata: {external_id: 'ext-123', synced_at: '2024-01-15'}
}
})
};
fetch('https://api.getlago.com/api/v1/plans/{code}', 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.getlago.com/api/v1/plans/{code}",
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([
'plan' => [
'name' => 'Startup',
'invoice_display_name' => 'Startup plan',
'code' => 'startup',
'interval' => 'monthly',
'description' => 'Plan for early stage startups.',
'amount_cents' => 10000,
'amount_currency' => 'USD',
'trial_period' => 5,
'pay_in_advance' => true,
'bill_charges_monthly' => null,
'bill_fixed_charges_monthly' => null,
'tax_codes' => [
'french_standard_vat'
],
'minimum_commitment' => [
'amount_cents' => 100000,
'invoice_display_name' => 'Minimum Commitment (C1)',
'tax_codes' => [
'french_standard_vat'
]
],
'charges' => [
[
'billable_metric_id' => '1a901a90-1a90-1a90-1a90-1a901a901a91',
'charge_model' => 'package',
'invoiceable' => true,
'invoice_display_name' => 'Setup',
'pay_in_advance' => false,
'prorated' => false,
'min_amount_cents' => 3000,
'properties' => [
'amount' => '30',
'free_units' => 100,
'package_size' => 1000
],
'tax_codes' => [
'french_standard_vat'
]
],
[
'billable_metric_id' => '1a901a90-1a90-1a90-1a90-1a901a901a92',
'charge_model' => 'graduated',
'invoiceable' => true,
'invoice_display_name' => 'Setup',
'pay_in_advance' => false,
'prorated' => false,
'min_amount_cents' => 0,
'properties' => [
'graduated_ranges' => [
[
'to_value' => 10,
'from_value' => 0,
'flat_amount' => '10',
'per_unit_amount' => '0.5'
],
[
'to_value' => null,
'from_value' => 11,
'flat_amount' => '0',
'per_unit_amount' => '0.4'
]
]
]
],
[
'billable_metric_id' => '1a901a90-1a90-1a90-1a90-1a901a901a93',
'charge_model' => 'standard',
'invoiceable' => true,
'invoice_display_name' => 'Setup',
'pay_in_advance' => true,
'regroup_paid_fees' => null,
'prorated' => false,
'min_amount_cents' => 0,
'properties' => [
]
],
[
'billable_metric_id' => '1a901a90-1a90-1a90-1a90-1a901a901a94',
'charge_model' => 'volume',
'invoiceable' => true,
'invoice_display_name' => 'Setup',
'pay_in_advance' => false,
'prorated' => false,
'min_amount_cents' => 0,
'properties' => [
'volume_ranges' => [
[
'from_value' => 0,
'to_value' => 100,
'flat_amount' => '0',
'per_unit_amount' => '0'
],
[
'from_value' => 101,
'to_value' => null,
'flat_amount' => '0',
'per_unit_amount' => '0.5'
]
]
]
],
[
'billable_metric_id' => '1a901a90-1a90-1a90-1a90-1a901a901a95',
'charge_model' => 'percentage',
'invoiceable' => false,
'invoice_display_name' => 'Setup',
'pay_in_advance' => true,
'regroup_paid_fees' => 'invoice',
'prorated' => false,
'min_amount_cents' => 0,
'properties' => [
'rate' => '1',
'fixed_amount' => '0.5',
'free_units_per_events' => 5,
'free_units_per_total_aggregation' => '500'
]
]
],
'fixed_charges' => [
[
'id' => '1a901a90-1a90-1a90-1a90-1a901a901a90',
'invoice_display_name' => 'New Setup Fee',
'charge_model' => 'standard',
'apply_units_immediately' => true,
'units' => 5
],
[
'add_on_id' => '1a901a90-1a90-1a90-1a90-1a901a901a90',
'code' => 'setup_fee',
'invoice_display_name' => 'Setup Fee',
'charge_model' => 'standard',
'pay_in_advance' => true,
'prorated' => false,
'properties' => [
'amount' => '500'
],
'units' => 1,
'apply_units_immediately' => false,
'tax_codes' => [
'french_standard_vat'
]
],
[
'add_on_id' => '4d604d60-4d60-4d60-4d60-4d604d604d60',
'invoice_display_name' => 'Support Tier',
'charge_model' => 'graduated',
'pay_in_advance' => false,
'prorated' => true,
'properties' => [
'graduated_ranges' => [
[
'from_value' => 0,
'to_value' => 10,
'per_unit_amount' => '5',
'flat_amount' => '200'
],
[
'from_value' => 11,
'to_value' => null,
'per_unit_amount' => '1',
'flat_amount' => '300'
]
]
],
'units' => 2
],
[
'add_on_id' => '6f406f40-6f40-6f40-6f40-6f406f406f40',
'charge_model' => 'volume',
'properties' => [
'volume_ranges' => [
[
'from_value' => 0,
'to_value' => 100,
'per_unit_amount' => '2',
'flat_amount' => '1'
],
[
'from_value' => 101,
'to_value' => null,
'per_unit_amount' => '1',
'flat_amount' => '0'
]
]
],
'units' => 50
]
],
'usage_thresholds' => [
[
'amount_cents' => 10000,
'threshold_display_name' => 'Threshold 1',
'recurring' => true
]
],
'cascade_updates' => true,
'metadata' => [
'external_id' => 'ext-123',
'synced_at' => '2024-01-15'
]
]
]),
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.getlago.com/api/v1/plans/{code}"
payload := strings.NewReader("{\n \"plan\": {\n \"name\": \"Startup\",\n \"invoice_display_name\": \"Startup plan\",\n \"code\": \"startup\",\n \"interval\": \"monthly\",\n \"description\": \"Plan for early stage startups.\",\n \"amount_cents\": 10000,\n \"amount_currency\": \"USD\",\n \"trial_period\": 5,\n \"pay_in_advance\": true,\n \"bill_charges_monthly\": null,\n \"bill_fixed_charges_monthly\": null,\n \"tax_codes\": [\n \"french_standard_vat\"\n ],\n \"minimum_commitment\": {\n \"amount_cents\": 100000,\n \"invoice_display_name\": \"Minimum Commitment (C1)\",\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n },\n \"charges\": [\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a91\",\n \"charge_model\": \"package\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": false,\n \"prorated\": false,\n \"min_amount_cents\": 3000,\n \"properties\": {\n \"amount\": \"30\",\n \"free_units\": 100,\n \"package_size\": 1000\n },\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a92\",\n \"charge_model\": \"graduated\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": false,\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {\n \"graduated_ranges\": [\n {\n \"to_value\": 10,\n \"from_value\": 0,\n \"flat_amount\": \"10\",\n \"per_unit_amount\": \"0.5\"\n },\n {\n \"to_value\": null,\n \"from_value\": 11,\n \"flat_amount\": \"0\",\n \"per_unit_amount\": \"0.4\"\n }\n ]\n }\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a93\",\n \"charge_model\": \"standard\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": true,\n \"regroup_paid_fees\": null,\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {}\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a94\",\n \"charge_model\": \"volume\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": false,\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {\n \"volume_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 100,\n \"flat_amount\": \"0\",\n \"per_unit_amount\": \"0\"\n },\n {\n \"from_value\": 101,\n \"to_value\": null,\n \"flat_amount\": \"0\",\n \"per_unit_amount\": \"0.5\"\n }\n ]\n }\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a95\",\n \"charge_model\": \"percentage\",\n \"invoiceable\": false,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": true,\n \"regroup_paid_fees\": \"invoice\",\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {\n \"rate\": \"1\",\n \"fixed_amount\": \"0.5\",\n \"free_units_per_events\": 5,\n \"free_units_per_total_aggregation\": \"500\"\n }\n }\n ],\n \"fixed_charges\": [\n {\n \"id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"invoice_display_name\": \"New Setup Fee\",\n \"charge_model\": \"standard\",\n \"apply_units_immediately\": true,\n \"units\": 5\n },\n {\n \"add_on_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"code\": \"setup_fee\",\n \"invoice_display_name\": \"Setup Fee\",\n \"charge_model\": \"standard\",\n \"pay_in_advance\": true,\n \"prorated\": false,\n \"properties\": {\n \"amount\": \"500\"\n },\n \"units\": 1,\n \"apply_units_immediately\": false,\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n },\n {\n \"add_on_id\": \"4d604d60-4d60-4d60-4d60-4d604d604d60\",\n \"invoice_display_name\": \"Support Tier\",\n \"charge_model\": \"graduated\",\n \"pay_in_advance\": false,\n \"prorated\": true,\n \"properties\": {\n \"graduated_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 10,\n \"per_unit_amount\": \"5\",\n \"flat_amount\": \"200\"\n },\n {\n \"from_value\": 11,\n \"to_value\": null,\n \"per_unit_amount\": \"1\",\n \"flat_amount\": \"300\"\n }\n ]\n },\n \"units\": 2\n },\n {\n \"add_on_id\": \"6f406f40-6f40-6f40-6f40-6f406f406f40\",\n \"charge_model\": \"volume\",\n \"properties\": {\n \"volume_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 100,\n \"per_unit_amount\": \"2\",\n \"flat_amount\": \"1\"\n },\n {\n \"from_value\": 101,\n \"to_value\": null,\n \"per_unit_amount\": \"1\",\n \"flat_amount\": \"0\"\n }\n ]\n },\n \"units\": 50\n }\n ],\n \"usage_thresholds\": [\n {\n \"amount_cents\": 10000,\n \"threshold_display_name\": \"Threshold 1\",\n \"recurring\": true\n }\n ],\n \"cascade_updates\": true,\n \"metadata\": {\n \"external_id\": \"ext-123\",\n \"synced_at\": \"2024-01-15\"\n }\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.getlago.com/api/v1/plans/{code}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"plan\": {\n \"name\": \"Startup\",\n \"invoice_display_name\": \"Startup plan\",\n \"code\": \"startup\",\n \"interval\": \"monthly\",\n \"description\": \"Plan for early stage startups.\",\n \"amount_cents\": 10000,\n \"amount_currency\": \"USD\",\n \"trial_period\": 5,\n \"pay_in_advance\": true,\n \"bill_charges_monthly\": null,\n \"bill_fixed_charges_monthly\": null,\n \"tax_codes\": [\n \"french_standard_vat\"\n ],\n \"minimum_commitment\": {\n \"amount_cents\": 100000,\n \"invoice_display_name\": \"Minimum Commitment (C1)\",\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n },\n \"charges\": [\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a91\",\n \"charge_model\": \"package\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": false,\n \"prorated\": false,\n \"min_amount_cents\": 3000,\n \"properties\": {\n \"amount\": \"30\",\n \"free_units\": 100,\n \"package_size\": 1000\n },\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a92\",\n \"charge_model\": \"graduated\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": false,\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {\n \"graduated_ranges\": [\n {\n \"to_value\": 10,\n \"from_value\": 0,\n \"flat_amount\": \"10\",\n \"per_unit_amount\": \"0.5\"\n },\n {\n \"to_value\": null,\n \"from_value\": 11,\n \"flat_amount\": \"0\",\n \"per_unit_amount\": \"0.4\"\n }\n ]\n }\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a93\",\n \"charge_model\": \"standard\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": true,\n \"regroup_paid_fees\": null,\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {}\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a94\",\n \"charge_model\": \"volume\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": false,\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {\n \"volume_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 100,\n \"flat_amount\": \"0\",\n \"per_unit_amount\": \"0\"\n },\n {\n \"from_value\": 101,\n \"to_value\": null,\n \"flat_amount\": \"0\",\n \"per_unit_amount\": \"0.5\"\n }\n ]\n }\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a95\",\n \"charge_model\": \"percentage\",\n \"invoiceable\": false,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": true,\n \"regroup_paid_fees\": \"invoice\",\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {\n \"rate\": \"1\",\n \"fixed_amount\": \"0.5\",\n \"free_units_per_events\": 5,\n \"free_units_per_total_aggregation\": \"500\"\n }\n }\n ],\n \"fixed_charges\": [\n {\n \"id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"invoice_display_name\": \"New Setup Fee\",\n \"charge_model\": \"standard\",\n \"apply_units_immediately\": true,\n \"units\": 5\n },\n {\n \"add_on_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"code\": \"setup_fee\",\n \"invoice_display_name\": \"Setup Fee\",\n \"charge_model\": \"standard\",\n \"pay_in_advance\": true,\n \"prorated\": false,\n \"properties\": {\n \"amount\": \"500\"\n },\n \"units\": 1,\n \"apply_units_immediately\": false,\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n },\n {\n \"add_on_id\": \"4d604d60-4d60-4d60-4d60-4d604d604d60\",\n \"invoice_display_name\": \"Support Tier\",\n \"charge_model\": \"graduated\",\n \"pay_in_advance\": false,\n \"prorated\": true,\n \"properties\": {\n \"graduated_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 10,\n \"per_unit_amount\": \"5\",\n \"flat_amount\": \"200\"\n },\n {\n \"from_value\": 11,\n \"to_value\": null,\n \"per_unit_amount\": \"1\",\n \"flat_amount\": \"300\"\n }\n ]\n },\n \"units\": 2\n },\n {\n \"add_on_id\": \"6f406f40-6f40-6f40-6f40-6f406f406f40\",\n \"charge_model\": \"volume\",\n \"properties\": {\n \"volume_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 100,\n \"per_unit_amount\": \"2\",\n \"flat_amount\": \"1\"\n },\n {\n \"from_value\": 101,\n \"to_value\": null,\n \"per_unit_amount\": \"1\",\n \"flat_amount\": \"0\"\n }\n ]\n },\n \"units\": 50\n }\n ],\n \"usage_thresholds\": [\n {\n \"amount_cents\": 10000,\n \"threshold_display_name\": \"Threshold 1\",\n \"recurring\": true\n }\n ],\n \"cascade_updates\": true,\n \"metadata\": {\n \"external_id\": \"ext-123\",\n \"synced_at\": \"2024-01-15\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v1/plans/{code}")
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 \"plan\": {\n \"name\": \"Startup\",\n \"invoice_display_name\": \"Startup plan\",\n \"code\": \"startup\",\n \"interval\": \"monthly\",\n \"description\": \"Plan for early stage startups.\",\n \"amount_cents\": 10000,\n \"amount_currency\": \"USD\",\n \"trial_period\": 5,\n \"pay_in_advance\": true,\n \"bill_charges_monthly\": null,\n \"bill_fixed_charges_monthly\": null,\n \"tax_codes\": [\n \"french_standard_vat\"\n ],\n \"minimum_commitment\": {\n \"amount_cents\": 100000,\n \"invoice_display_name\": \"Minimum Commitment (C1)\",\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n },\n \"charges\": [\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a91\",\n \"charge_model\": \"package\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": false,\n \"prorated\": false,\n \"min_amount_cents\": 3000,\n \"properties\": {\n \"amount\": \"30\",\n \"free_units\": 100,\n \"package_size\": 1000\n },\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a92\",\n \"charge_model\": \"graduated\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": false,\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {\n \"graduated_ranges\": [\n {\n \"to_value\": 10,\n \"from_value\": 0,\n \"flat_amount\": \"10\",\n \"per_unit_amount\": \"0.5\"\n },\n {\n \"to_value\": null,\n \"from_value\": 11,\n \"flat_amount\": \"0\",\n \"per_unit_amount\": \"0.4\"\n }\n ]\n }\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a93\",\n \"charge_model\": \"standard\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": true,\n \"regroup_paid_fees\": null,\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {}\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a94\",\n \"charge_model\": \"volume\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": false,\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {\n \"volume_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 100,\n \"flat_amount\": \"0\",\n \"per_unit_amount\": \"0\"\n },\n {\n \"from_value\": 101,\n \"to_value\": null,\n \"flat_amount\": \"0\",\n \"per_unit_amount\": \"0.5\"\n }\n ]\n }\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a95\",\n \"charge_model\": \"percentage\",\n \"invoiceable\": false,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": true,\n \"regroup_paid_fees\": \"invoice\",\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {\n \"rate\": \"1\",\n \"fixed_amount\": \"0.5\",\n \"free_units_per_events\": 5,\n \"free_units_per_total_aggregation\": \"500\"\n }\n }\n ],\n \"fixed_charges\": [\n {\n \"id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"invoice_display_name\": \"New Setup Fee\",\n \"charge_model\": \"standard\",\n \"apply_units_immediately\": true,\n \"units\": 5\n },\n {\n \"add_on_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"code\": \"setup_fee\",\n \"invoice_display_name\": \"Setup Fee\",\n \"charge_model\": \"standard\",\n \"pay_in_advance\": true,\n \"prorated\": false,\n \"properties\": {\n \"amount\": \"500\"\n },\n \"units\": 1,\n \"apply_units_immediately\": false,\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n },\n {\n \"add_on_id\": \"4d604d60-4d60-4d60-4d60-4d604d604d60\",\n \"invoice_display_name\": \"Support Tier\",\n \"charge_model\": \"graduated\",\n \"pay_in_advance\": false,\n \"prorated\": true,\n \"properties\": {\n \"graduated_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 10,\n \"per_unit_amount\": \"5\",\n \"flat_amount\": \"200\"\n },\n {\n \"from_value\": 11,\n \"to_value\": null,\n \"per_unit_amount\": \"1\",\n \"flat_amount\": \"300\"\n }\n ]\n },\n \"units\": 2\n },\n {\n \"add_on_id\": \"6f406f40-6f40-6f40-6f40-6f406f406f40\",\n \"charge_model\": \"volume\",\n \"properties\": {\n \"volume_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 100,\n \"per_unit_amount\": \"2\",\n \"flat_amount\": \"1\"\n },\n {\n \"from_value\": 101,\n \"to_value\": null,\n \"per_unit_amount\": \"1\",\n \"flat_amount\": \"0\"\n }\n ]\n },\n \"units\": 50\n }\n ],\n \"usage_thresholds\": [\n {\n \"amount_cents\": 10000,\n \"threshold_display_name\": \"Threshold 1\",\n \"recurring\": true\n }\n ],\n \"cascade_updates\": true,\n \"metadata\": {\n \"external_id\": \"ext-123\",\n \"synced_at\": \"2024-01-15\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"plan": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "Startup",
"created_at": "2023-06-27T19:43:42Z",
"code": "startup",
"interval": "monthly",
"amount_cents": 10000,
"amount_currency": "USD",
"invoice_display_name": "Startup plan",
"description": "",
"trial_period": 5,
"pay_in_advance": true,
"bill_charges_monthly": null,
"bill_fixed_charges_monthly": null,
"minimum_commitment": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"amount_cents": 100000,
"created_at": "2022-04-29T08:59:51Z",
"plan_code": "premium",
"invoice_display_name": "Minimum Commitment (C1)",
"interval": "monthly",
"updated_at": "2022-04-29T08:59:51Z",
"taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "TVA",
"code": "french_standard_vat",
"rate": 20,
"applied_to_organization": true,
"created_at": "2023-07-06T14:35:58Z",
"description": "French standard VAT"
}
]
},
"charges": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a91",
"lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a91",
"billable_metric_code": "requests",
"created_at": "2023-06-27T19:43:42Z",
"charge_model": "package",
"invoiceable": true,
"invoice_display_name": "Setup",
"pay_in_advance": false,
"regroup_paid_fees": null,
"prorated": false,
"min_amount_cents": 3000,
"properties": {
"amount": "30",
"free_units": 100,
"package_size": 1000
},
"filters": []
},
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a92",
"lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a92",
"billable_metric_code": "cpu",
"created_at": "2023-06-27T19:43:42Z",
"charge_model": "graduated",
"invoiceable": true,
"invoice_display_name": "Setup",
"pay_in_advance": false,
"regroup_paid_fees": null,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"graduated_ranges": [
{
"from_value": 0,
"to_value": 10,
"flat_amount": "10",
"per_unit_amount": "0.5"
},
{
"from_value": 11,
"to_value": null,
"flat_amount": "0",
"per_unit_amount": "0.4"
}
]
},
"filters": []
},
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a93",
"lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a93",
"billable_metric_code": "seats",
"created_at": "2023-06-27T19:43:42Z",
"charge_model": "standard",
"invoiceable": true,
"invoice_display_name": "Setup",
"pay_in_advance": true,
"regroup_paid_fees": null,
"prorated": false,
"min_amount_cents": 0,
"properties": {},
"filters": [
{
"invoice_display_name": "Europe",
"properties": {
"amount": "10"
},
"values": {
"region": [
"Europe"
]
}
},
{
"invoice_display_name": "USA",
"properties": {
"amount": "5"
},
"values": {
"region": [
"USA"
]
}
},
{
"invoice_display_name": "Africa",
"properties": {
"amount": "8"
},
"values": {
"region": [
"Africa"
]
}
}
]
},
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a94",
"lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a94",
"billable_metric_code": "storage",
"created_at": "2023-06-27T19:43:42Z",
"charge_model": "volume",
"invoiceable": true,
"invoice_display_name": "Setup",
"pay_in_advance": false,
"regroup_paid_fees": null,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"volume_ranges": [
{
"from_value": 0,
"to_value": 100,
"flat_amount": "0",
"per_unit_amount": "0"
},
{
"from_value": 101,
"to_value": null,
"flat_amount": "0",
"per_unit_amount": "0.5"
}
]
},
"filters": []
},
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a95",
"lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a95",
"billable_metric_code": "payments",
"created_at": "2023-06-27T19:43:42Z",
"charge_model": "percentage",
"invoiceable": false,
"invoice_display_name": "Setup",
"pay_in_advance": true,
"regroup_paid_fees": "invoice",
"prorated": false,
"min_amount_cents": 0,
"properties": {
"rate": "1",
"fixed_amount": "0.5",
"free_units_per_events": 5,
"free_units_per_total_aggregation": "500"
},
"filters": []
}
],
"fixed_charges": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_add_on_id": "2b802b80-2b80-2b80-2b80-2b802b802b80",
"code": "setup_fee",
"invoice_display_name": "Setup Fee",
"add_on_code": "setup",
"created_at": "2026-01-15T10:30:00Z",
"charge_model": "standard",
"pay_in_advance": true,
"prorated": false,
"properties": {
"amount": "500"
},
"units": 1,
"lago_parent_id": null,
"taxes": [
{
"lago_id": "3c703c70-3c70-3c70-3c70-3c703c703c70",
"name": "VAT",
"code": "vat_20",
"rate": 20,
"description": "Standard VAT rate",
"applied_to_organization": true,
"created_at": "2026-01-01T00:00:00Z"
}
]
},
{
"lago_id": "4d604d60-4d60-4d60-4d60-4d604d604d60",
"lago_add_on_id": "5e505e50-5e50-5e50-5e50-5e505e505e50",
"code": "support_tier",
"invoice_display_name": "Support Tier",
"add_on_code": "premium_support",
"created_at": "2026-01-15T10:30:00Z",
"charge_model": "graduated",
"pay_in_advance": false,
"prorated": true,
"properties": {
"graduated_ranges": [
{
"from_value": 0,
"to_value": 10,
"per_unit_amount": "5",
"flat_amount": "200"
},
{
"from_value": 11,
"to_value": null,
"per_unit_amount": "1",
"flat_amount": "300"
}
]
},
"units": 1,
"lago_parent_id": null,
"taxes": []
},
{
"lago_id": "6f406f40-6f40-6f40-6f40-6f406f406f40",
"lago_add_on_id": "7a307a30-7a30-7a30-7a30-7a307a307a30",
"code": "storage",
"invoice_display_name": "Storage Allocation",
"add_on_code": "cloud_storage",
"created_at": "2026-01-15T10:30:00Z",
"charge_model": "volume",
"pay_in_advance": false,
"prorated": false,
"properties": {
"volume_ranges": [
{
"from_value": 0,
"to_value": 100,
"per_unit_amount": "2",
"flat_amount": "1"
},
{
"from_value": 101,
"to_value": null,
"per_unit_amount": "1",
"flat_amount": "0"
}
]
},
"units": 50,
"lago_parent_id": null,
"taxes": []
}
],
"taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "TVA",
"code": "french_standard_vat",
"rate": 20,
"applied_to_organization": true,
"created_at": "2023-07-06T14:35:58Z",
"description": "French standard VAT"
}
],
"usage_thresholds": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"threshold_display_name": "Threshold 1",
"amount_cents": 10000,
"recurring": true,
"created_at": "2023-06-27T19:43:42Z",
"updated_at": "2023-06-27T19:43:42Z"
}
],
"entitlements": [
{
"entitlement": {
"code": "seats",
"name": "Number of seats",
"description": "Number of users of the account",
"privileges": [
{
"code": "max",
"name": "Maximum",
"value_type": "integer",
"config": {},
"value": 10
},
{
"code": "max_admins",
"name": "Max Admins",
"value_type": "integer",
"config": {},
"value": 5
},
{
"code": "root",
"name": "Allow root user",
"value_type": "boolean",
"config": {},
"value": true
},
{
"code": "provider",
"name": "SSO Provider",
"value_type": "select",
"value": "google",
"config": {
"select_options": [
"google",
"okta"
]
}
}
]
}
}
],
"metadata": {
"external_id": "ext-123",
"synced_at": "2024-01-15",
"source": null
}
}
}{
"status": 400,
"error": "Bad request"
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}{
"status": 422,
"error": "Unprocessable entity",
"code": "validation_errors",
"error_details": {}
}Plans
Update a plan
This endpoint updates a specific plan with subscription and usage-based charges. It supports flexible billing cadence (in-advance or in-arrears) and allows for both recurring and metered charges.
PUT
/
plans
/
{code}
Update a plan
curl --request PUT \
--url https://api.getlago.com/api/v1/plans/{code} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"plan": {
"name": "Startup",
"invoice_display_name": "Startup plan",
"code": "startup",
"interval": "monthly",
"description": "Plan for early stage startups.",
"amount_cents": 10000,
"amount_currency": "USD",
"trial_period": 5,
"pay_in_advance": true,
"bill_charges_monthly": null,
"bill_fixed_charges_monthly": null,
"tax_codes": [
"french_standard_vat"
],
"minimum_commitment": {
"amount_cents": 100000,
"invoice_display_name": "Minimum Commitment (C1)",
"tax_codes": [
"french_standard_vat"
]
},
"charges": [
{
"billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a91",
"charge_model": "package",
"invoiceable": true,
"invoice_display_name": "Setup",
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 3000,
"properties": {
"amount": "30",
"free_units": 100,
"package_size": 1000
},
"tax_codes": [
"french_standard_vat"
]
},
{
"billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a92",
"charge_model": "graduated",
"invoiceable": true,
"invoice_display_name": "Setup",
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"graduated_ranges": [
{
"to_value": 10,
"from_value": 0,
"flat_amount": "10",
"per_unit_amount": "0.5"
},
{
"to_value": null,
"from_value": 11,
"flat_amount": "0",
"per_unit_amount": "0.4"
}
]
}
},
{
"billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a93",
"charge_model": "standard",
"invoiceable": true,
"invoice_display_name": "Setup",
"pay_in_advance": true,
"regroup_paid_fees": null,
"prorated": false,
"min_amount_cents": 0,
"properties": {}
},
{
"billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a94",
"charge_model": "volume",
"invoiceable": true,
"invoice_display_name": "Setup",
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"volume_ranges": [
{
"from_value": 0,
"to_value": 100,
"flat_amount": "0",
"per_unit_amount": "0"
},
{
"from_value": 101,
"to_value": null,
"flat_amount": "0",
"per_unit_amount": "0.5"
}
]
}
},
{
"billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a95",
"charge_model": "percentage",
"invoiceable": false,
"invoice_display_name": "Setup",
"pay_in_advance": true,
"regroup_paid_fees": "invoice",
"prorated": false,
"min_amount_cents": 0,
"properties": {
"rate": "1",
"fixed_amount": "0.5",
"free_units_per_events": 5,
"free_units_per_total_aggregation": "500"
}
}
],
"fixed_charges": [
{
"id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"invoice_display_name": "New Setup Fee",
"charge_model": "standard",
"apply_units_immediately": true,
"units": 5
},
{
"add_on_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "setup_fee",
"invoice_display_name": "Setup Fee",
"charge_model": "standard",
"pay_in_advance": true,
"prorated": false,
"properties": {
"amount": "500"
},
"units": 1,
"apply_units_immediately": false,
"tax_codes": [
"french_standard_vat"
]
},
{
"add_on_id": "4d604d60-4d60-4d60-4d60-4d604d604d60",
"invoice_display_name": "Support Tier",
"charge_model": "graduated",
"pay_in_advance": false,
"prorated": true,
"properties": {
"graduated_ranges": [
{
"from_value": 0,
"to_value": 10,
"per_unit_amount": "5",
"flat_amount": "200"
},
{
"from_value": 11,
"to_value": null,
"per_unit_amount": "1",
"flat_amount": "300"
}
]
},
"units": 2
},
{
"add_on_id": "6f406f40-6f40-6f40-6f40-6f406f406f40",
"charge_model": "volume",
"properties": {
"volume_ranges": [
{
"from_value": 0,
"to_value": 100,
"per_unit_amount": "2",
"flat_amount": "1"
},
{
"from_value": 101,
"to_value": null,
"per_unit_amount": "1",
"flat_amount": "0"
}
]
},
"units": 50
}
],
"usage_thresholds": [
{
"amount_cents": 10000,
"threshold_display_name": "Threshold 1",
"recurring": true
}
],
"cascade_updates": true,
"metadata": {
"external_id": "ext-123",
"synced_at": "2024-01-15"
}
}
}
'import requests
url = "https://api.getlago.com/api/v1/plans/{code}"
payload = { "plan": {
"name": "Startup",
"invoice_display_name": "Startup plan",
"code": "startup",
"interval": "monthly",
"description": "Plan for early stage startups.",
"amount_cents": 10000,
"amount_currency": "USD",
"trial_period": 5,
"pay_in_advance": True,
"bill_charges_monthly": None,
"bill_fixed_charges_monthly": None,
"tax_codes": ["french_standard_vat"],
"minimum_commitment": {
"amount_cents": 100000,
"invoice_display_name": "Minimum Commitment (C1)",
"tax_codes": ["french_standard_vat"]
},
"charges": [
{
"billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a91",
"charge_model": "package",
"invoiceable": True,
"invoice_display_name": "Setup",
"pay_in_advance": False,
"prorated": False,
"min_amount_cents": 3000,
"properties": {
"amount": "30",
"free_units": 100,
"package_size": 1000
},
"tax_codes": ["french_standard_vat"]
},
{
"billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a92",
"charge_model": "graduated",
"invoiceable": True,
"invoice_display_name": "Setup",
"pay_in_advance": False,
"prorated": False,
"min_amount_cents": 0,
"properties": { "graduated_ranges": [
{
"to_value": 10,
"from_value": 0,
"flat_amount": "10",
"per_unit_amount": "0.5"
},
{
"to_value": None,
"from_value": 11,
"flat_amount": "0",
"per_unit_amount": "0.4"
}
] }
},
{
"billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a93",
"charge_model": "standard",
"invoiceable": True,
"invoice_display_name": "Setup",
"pay_in_advance": True,
"regroup_paid_fees": None,
"prorated": False,
"min_amount_cents": 0,
"properties": {}
},
{
"billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a94",
"charge_model": "volume",
"invoiceable": True,
"invoice_display_name": "Setup",
"pay_in_advance": False,
"prorated": False,
"min_amount_cents": 0,
"properties": { "volume_ranges": [
{
"from_value": 0,
"to_value": 100,
"flat_amount": "0",
"per_unit_amount": "0"
},
{
"from_value": 101,
"to_value": None,
"flat_amount": "0",
"per_unit_amount": "0.5"
}
] }
},
{
"billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a95",
"charge_model": "percentage",
"invoiceable": False,
"invoice_display_name": "Setup",
"pay_in_advance": True,
"regroup_paid_fees": "invoice",
"prorated": False,
"min_amount_cents": 0,
"properties": {
"rate": "1",
"fixed_amount": "0.5",
"free_units_per_events": 5,
"free_units_per_total_aggregation": "500"
}
}
],
"fixed_charges": [
{
"id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"invoice_display_name": "New Setup Fee",
"charge_model": "standard",
"apply_units_immediately": True,
"units": 5
},
{
"add_on_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "setup_fee",
"invoice_display_name": "Setup Fee",
"charge_model": "standard",
"pay_in_advance": True,
"prorated": False,
"properties": { "amount": "500" },
"units": 1,
"apply_units_immediately": False,
"tax_codes": ["french_standard_vat"]
},
{
"add_on_id": "4d604d60-4d60-4d60-4d60-4d604d604d60",
"invoice_display_name": "Support Tier",
"charge_model": "graduated",
"pay_in_advance": False,
"prorated": True,
"properties": { "graduated_ranges": [
{
"from_value": 0,
"to_value": 10,
"per_unit_amount": "5",
"flat_amount": "200"
},
{
"from_value": 11,
"to_value": None,
"per_unit_amount": "1",
"flat_amount": "300"
}
] },
"units": 2
},
{
"add_on_id": "6f406f40-6f40-6f40-6f40-6f406f406f40",
"charge_model": "volume",
"properties": { "volume_ranges": [
{
"from_value": 0,
"to_value": 100,
"per_unit_amount": "2",
"flat_amount": "1"
},
{
"from_value": 101,
"to_value": None,
"per_unit_amount": "1",
"flat_amount": "0"
}
] },
"units": 50
}
],
"usage_thresholds": [
{
"amount_cents": 10000,
"threshold_display_name": "Threshold 1",
"recurring": True
}
],
"cascade_updates": True,
"metadata": {
"external_id": "ext-123",
"synced_at": "2024-01-15"
}
} }
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({
plan: {
name: 'Startup',
invoice_display_name: 'Startup plan',
code: 'startup',
interval: 'monthly',
description: 'Plan for early stage startups.',
amount_cents: 10000,
amount_currency: 'USD',
trial_period: 5,
pay_in_advance: true,
bill_charges_monthly: null,
bill_fixed_charges_monthly: null,
tax_codes: ['french_standard_vat'],
minimum_commitment: {
amount_cents: 100000,
invoice_display_name: 'Minimum Commitment (C1)',
tax_codes: ['french_standard_vat']
},
charges: [
{
billable_metric_id: '1a901a90-1a90-1a90-1a90-1a901a901a91',
charge_model: 'package',
invoiceable: true,
invoice_display_name: 'Setup',
pay_in_advance: false,
prorated: false,
min_amount_cents: 3000,
properties: {amount: '30', free_units: 100, package_size: 1000},
tax_codes: ['french_standard_vat']
},
{
billable_metric_id: '1a901a90-1a90-1a90-1a90-1a901a901a92',
charge_model: 'graduated',
invoiceable: true,
invoice_display_name: 'Setup',
pay_in_advance: false,
prorated: false,
min_amount_cents: 0,
properties: {
graduated_ranges: [
{to_value: 10, from_value: 0, flat_amount: '10', per_unit_amount: '0.5'},
{to_value: null, from_value: 11, flat_amount: '0', per_unit_amount: '0.4'}
]
}
},
{
billable_metric_id: '1a901a90-1a90-1a90-1a90-1a901a901a93',
charge_model: 'standard',
invoiceable: true,
invoice_display_name: 'Setup',
pay_in_advance: true,
regroup_paid_fees: null,
prorated: false,
min_amount_cents: 0,
properties: {}
},
{
billable_metric_id: '1a901a90-1a90-1a90-1a90-1a901a901a94',
charge_model: 'volume',
invoiceable: true,
invoice_display_name: 'Setup',
pay_in_advance: false,
prorated: false,
min_amount_cents: 0,
properties: {
volume_ranges: [
{from_value: 0, to_value: 100, flat_amount: '0', per_unit_amount: '0'},
{from_value: 101, to_value: null, flat_amount: '0', per_unit_amount: '0.5'}
]
}
},
{
billable_metric_id: '1a901a90-1a90-1a90-1a90-1a901a901a95',
charge_model: 'percentage',
invoiceable: false,
invoice_display_name: 'Setup',
pay_in_advance: true,
regroup_paid_fees: 'invoice',
prorated: false,
min_amount_cents: 0,
properties: {
rate: '1',
fixed_amount: '0.5',
free_units_per_events: 5,
free_units_per_total_aggregation: '500'
}
}
],
fixed_charges: [
{
id: '1a901a90-1a90-1a90-1a90-1a901a901a90',
invoice_display_name: 'New Setup Fee',
charge_model: 'standard',
apply_units_immediately: true,
units: 5
},
{
add_on_id: '1a901a90-1a90-1a90-1a90-1a901a901a90',
code: 'setup_fee',
invoice_display_name: 'Setup Fee',
charge_model: 'standard',
pay_in_advance: true,
prorated: false,
properties: {amount: '500'},
units: 1,
apply_units_immediately: false,
tax_codes: ['french_standard_vat']
},
{
add_on_id: '4d604d60-4d60-4d60-4d60-4d604d604d60',
invoice_display_name: 'Support Tier',
charge_model: 'graduated',
pay_in_advance: false,
prorated: true,
properties: {
graduated_ranges: [
{from_value: 0, to_value: 10, per_unit_amount: '5', flat_amount: '200'},
{from_value: 11, to_value: null, per_unit_amount: '1', flat_amount: '300'}
]
},
units: 2
},
{
add_on_id: '6f406f40-6f40-6f40-6f40-6f406f406f40',
charge_model: 'volume',
properties: {
volume_ranges: [
{from_value: 0, to_value: 100, per_unit_amount: '2', flat_amount: '1'},
{from_value: 101, to_value: null, per_unit_amount: '1', flat_amount: '0'}
]
},
units: 50
}
],
usage_thresholds: [{amount_cents: 10000, threshold_display_name: 'Threshold 1', recurring: true}],
cascade_updates: true,
metadata: {external_id: 'ext-123', synced_at: '2024-01-15'}
}
})
};
fetch('https://api.getlago.com/api/v1/plans/{code}', 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.getlago.com/api/v1/plans/{code}",
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([
'plan' => [
'name' => 'Startup',
'invoice_display_name' => 'Startup plan',
'code' => 'startup',
'interval' => 'monthly',
'description' => 'Plan for early stage startups.',
'amount_cents' => 10000,
'amount_currency' => 'USD',
'trial_period' => 5,
'pay_in_advance' => true,
'bill_charges_monthly' => null,
'bill_fixed_charges_monthly' => null,
'tax_codes' => [
'french_standard_vat'
],
'minimum_commitment' => [
'amount_cents' => 100000,
'invoice_display_name' => 'Minimum Commitment (C1)',
'tax_codes' => [
'french_standard_vat'
]
],
'charges' => [
[
'billable_metric_id' => '1a901a90-1a90-1a90-1a90-1a901a901a91',
'charge_model' => 'package',
'invoiceable' => true,
'invoice_display_name' => 'Setup',
'pay_in_advance' => false,
'prorated' => false,
'min_amount_cents' => 3000,
'properties' => [
'amount' => '30',
'free_units' => 100,
'package_size' => 1000
],
'tax_codes' => [
'french_standard_vat'
]
],
[
'billable_metric_id' => '1a901a90-1a90-1a90-1a90-1a901a901a92',
'charge_model' => 'graduated',
'invoiceable' => true,
'invoice_display_name' => 'Setup',
'pay_in_advance' => false,
'prorated' => false,
'min_amount_cents' => 0,
'properties' => [
'graduated_ranges' => [
[
'to_value' => 10,
'from_value' => 0,
'flat_amount' => '10',
'per_unit_amount' => '0.5'
],
[
'to_value' => null,
'from_value' => 11,
'flat_amount' => '0',
'per_unit_amount' => '0.4'
]
]
]
],
[
'billable_metric_id' => '1a901a90-1a90-1a90-1a90-1a901a901a93',
'charge_model' => 'standard',
'invoiceable' => true,
'invoice_display_name' => 'Setup',
'pay_in_advance' => true,
'regroup_paid_fees' => null,
'prorated' => false,
'min_amount_cents' => 0,
'properties' => [
]
],
[
'billable_metric_id' => '1a901a90-1a90-1a90-1a90-1a901a901a94',
'charge_model' => 'volume',
'invoiceable' => true,
'invoice_display_name' => 'Setup',
'pay_in_advance' => false,
'prorated' => false,
'min_amount_cents' => 0,
'properties' => [
'volume_ranges' => [
[
'from_value' => 0,
'to_value' => 100,
'flat_amount' => '0',
'per_unit_amount' => '0'
],
[
'from_value' => 101,
'to_value' => null,
'flat_amount' => '0',
'per_unit_amount' => '0.5'
]
]
]
],
[
'billable_metric_id' => '1a901a90-1a90-1a90-1a90-1a901a901a95',
'charge_model' => 'percentage',
'invoiceable' => false,
'invoice_display_name' => 'Setup',
'pay_in_advance' => true,
'regroup_paid_fees' => 'invoice',
'prorated' => false,
'min_amount_cents' => 0,
'properties' => [
'rate' => '1',
'fixed_amount' => '0.5',
'free_units_per_events' => 5,
'free_units_per_total_aggregation' => '500'
]
]
],
'fixed_charges' => [
[
'id' => '1a901a90-1a90-1a90-1a90-1a901a901a90',
'invoice_display_name' => 'New Setup Fee',
'charge_model' => 'standard',
'apply_units_immediately' => true,
'units' => 5
],
[
'add_on_id' => '1a901a90-1a90-1a90-1a90-1a901a901a90',
'code' => 'setup_fee',
'invoice_display_name' => 'Setup Fee',
'charge_model' => 'standard',
'pay_in_advance' => true,
'prorated' => false,
'properties' => [
'amount' => '500'
],
'units' => 1,
'apply_units_immediately' => false,
'tax_codes' => [
'french_standard_vat'
]
],
[
'add_on_id' => '4d604d60-4d60-4d60-4d60-4d604d604d60',
'invoice_display_name' => 'Support Tier',
'charge_model' => 'graduated',
'pay_in_advance' => false,
'prorated' => true,
'properties' => [
'graduated_ranges' => [
[
'from_value' => 0,
'to_value' => 10,
'per_unit_amount' => '5',
'flat_amount' => '200'
],
[
'from_value' => 11,
'to_value' => null,
'per_unit_amount' => '1',
'flat_amount' => '300'
]
]
],
'units' => 2
],
[
'add_on_id' => '6f406f40-6f40-6f40-6f40-6f406f406f40',
'charge_model' => 'volume',
'properties' => [
'volume_ranges' => [
[
'from_value' => 0,
'to_value' => 100,
'per_unit_amount' => '2',
'flat_amount' => '1'
],
[
'from_value' => 101,
'to_value' => null,
'per_unit_amount' => '1',
'flat_amount' => '0'
]
]
],
'units' => 50
]
],
'usage_thresholds' => [
[
'amount_cents' => 10000,
'threshold_display_name' => 'Threshold 1',
'recurring' => true
]
],
'cascade_updates' => true,
'metadata' => [
'external_id' => 'ext-123',
'synced_at' => '2024-01-15'
]
]
]),
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.getlago.com/api/v1/plans/{code}"
payload := strings.NewReader("{\n \"plan\": {\n \"name\": \"Startup\",\n \"invoice_display_name\": \"Startup plan\",\n \"code\": \"startup\",\n \"interval\": \"monthly\",\n \"description\": \"Plan for early stage startups.\",\n \"amount_cents\": 10000,\n \"amount_currency\": \"USD\",\n \"trial_period\": 5,\n \"pay_in_advance\": true,\n \"bill_charges_monthly\": null,\n \"bill_fixed_charges_monthly\": null,\n \"tax_codes\": [\n \"french_standard_vat\"\n ],\n \"minimum_commitment\": {\n \"amount_cents\": 100000,\n \"invoice_display_name\": \"Minimum Commitment (C1)\",\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n },\n \"charges\": [\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a91\",\n \"charge_model\": \"package\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": false,\n \"prorated\": false,\n \"min_amount_cents\": 3000,\n \"properties\": {\n \"amount\": \"30\",\n \"free_units\": 100,\n \"package_size\": 1000\n },\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a92\",\n \"charge_model\": \"graduated\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": false,\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {\n \"graduated_ranges\": [\n {\n \"to_value\": 10,\n \"from_value\": 0,\n \"flat_amount\": \"10\",\n \"per_unit_amount\": \"0.5\"\n },\n {\n \"to_value\": null,\n \"from_value\": 11,\n \"flat_amount\": \"0\",\n \"per_unit_amount\": \"0.4\"\n }\n ]\n }\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a93\",\n \"charge_model\": \"standard\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": true,\n \"regroup_paid_fees\": null,\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {}\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a94\",\n \"charge_model\": \"volume\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": false,\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {\n \"volume_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 100,\n \"flat_amount\": \"0\",\n \"per_unit_amount\": \"0\"\n },\n {\n \"from_value\": 101,\n \"to_value\": null,\n \"flat_amount\": \"0\",\n \"per_unit_amount\": \"0.5\"\n }\n ]\n }\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a95\",\n \"charge_model\": \"percentage\",\n \"invoiceable\": false,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": true,\n \"regroup_paid_fees\": \"invoice\",\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {\n \"rate\": \"1\",\n \"fixed_amount\": \"0.5\",\n \"free_units_per_events\": 5,\n \"free_units_per_total_aggregation\": \"500\"\n }\n }\n ],\n \"fixed_charges\": [\n {\n \"id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"invoice_display_name\": \"New Setup Fee\",\n \"charge_model\": \"standard\",\n \"apply_units_immediately\": true,\n \"units\": 5\n },\n {\n \"add_on_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"code\": \"setup_fee\",\n \"invoice_display_name\": \"Setup Fee\",\n \"charge_model\": \"standard\",\n \"pay_in_advance\": true,\n \"prorated\": false,\n \"properties\": {\n \"amount\": \"500\"\n },\n \"units\": 1,\n \"apply_units_immediately\": false,\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n },\n {\n \"add_on_id\": \"4d604d60-4d60-4d60-4d60-4d604d604d60\",\n \"invoice_display_name\": \"Support Tier\",\n \"charge_model\": \"graduated\",\n \"pay_in_advance\": false,\n \"prorated\": true,\n \"properties\": {\n \"graduated_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 10,\n \"per_unit_amount\": \"5\",\n \"flat_amount\": \"200\"\n },\n {\n \"from_value\": 11,\n \"to_value\": null,\n \"per_unit_amount\": \"1\",\n \"flat_amount\": \"300\"\n }\n ]\n },\n \"units\": 2\n },\n {\n \"add_on_id\": \"6f406f40-6f40-6f40-6f40-6f406f406f40\",\n \"charge_model\": \"volume\",\n \"properties\": {\n \"volume_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 100,\n \"per_unit_amount\": \"2\",\n \"flat_amount\": \"1\"\n },\n {\n \"from_value\": 101,\n \"to_value\": null,\n \"per_unit_amount\": \"1\",\n \"flat_amount\": \"0\"\n }\n ]\n },\n \"units\": 50\n }\n ],\n \"usage_thresholds\": [\n {\n \"amount_cents\": 10000,\n \"threshold_display_name\": \"Threshold 1\",\n \"recurring\": true\n }\n ],\n \"cascade_updates\": true,\n \"metadata\": {\n \"external_id\": \"ext-123\",\n \"synced_at\": \"2024-01-15\"\n }\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.getlago.com/api/v1/plans/{code}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"plan\": {\n \"name\": \"Startup\",\n \"invoice_display_name\": \"Startup plan\",\n \"code\": \"startup\",\n \"interval\": \"monthly\",\n \"description\": \"Plan for early stage startups.\",\n \"amount_cents\": 10000,\n \"amount_currency\": \"USD\",\n \"trial_period\": 5,\n \"pay_in_advance\": true,\n \"bill_charges_monthly\": null,\n \"bill_fixed_charges_monthly\": null,\n \"tax_codes\": [\n \"french_standard_vat\"\n ],\n \"minimum_commitment\": {\n \"amount_cents\": 100000,\n \"invoice_display_name\": \"Minimum Commitment (C1)\",\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n },\n \"charges\": [\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a91\",\n \"charge_model\": \"package\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": false,\n \"prorated\": false,\n \"min_amount_cents\": 3000,\n \"properties\": {\n \"amount\": \"30\",\n \"free_units\": 100,\n \"package_size\": 1000\n },\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a92\",\n \"charge_model\": \"graduated\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": false,\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {\n \"graduated_ranges\": [\n {\n \"to_value\": 10,\n \"from_value\": 0,\n \"flat_amount\": \"10\",\n \"per_unit_amount\": \"0.5\"\n },\n {\n \"to_value\": null,\n \"from_value\": 11,\n \"flat_amount\": \"0\",\n \"per_unit_amount\": \"0.4\"\n }\n ]\n }\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a93\",\n \"charge_model\": \"standard\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": true,\n \"regroup_paid_fees\": null,\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {}\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a94\",\n \"charge_model\": \"volume\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": false,\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {\n \"volume_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 100,\n \"flat_amount\": \"0\",\n \"per_unit_amount\": \"0\"\n },\n {\n \"from_value\": 101,\n \"to_value\": null,\n \"flat_amount\": \"0\",\n \"per_unit_amount\": \"0.5\"\n }\n ]\n }\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a95\",\n \"charge_model\": \"percentage\",\n \"invoiceable\": false,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": true,\n \"regroup_paid_fees\": \"invoice\",\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {\n \"rate\": \"1\",\n \"fixed_amount\": \"0.5\",\n \"free_units_per_events\": 5,\n \"free_units_per_total_aggregation\": \"500\"\n }\n }\n ],\n \"fixed_charges\": [\n {\n \"id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"invoice_display_name\": \"New Setup Fee\",\n \"charge_model\": \"standard\",\n \"apply_units_immediately\": true,\n \"units\": 5\n },\n {\n \"add_on_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"code\": \"setup_fee\",\n \"invoice_display_name\": \"Setup Fee\",\n \"charge_model\": \"standard\",\n \"pay_in_advance\": true,\n \"prorated\": false,\n \"properties\": {\n \"amount\": \"500\"\n },\n \"units\": 1,\n \"apply_units_immediately\": false,\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n },\n {\n \"add_on_id\": \"4d604d60-4d60-4d60-4d60-4d604d604d60\",\n \"invoice_display_name\": \"Support Tier\",\n \"charge_model\": \"graduated\",\n \"pay_in_advance\": false,\n \"prorated\": true,\n \"properties\": {\n \"graduated_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 10,\n \"per_unit_amount\": \"5\",\n \"flat_amount\": \"200\"\n },\n {\n \"from_value\": 11,\n \"to_value\": null,\n \"per_unit_amount\": \"1\",\n \"flat_amount\": \"300\"\n }\n ]\n },\n \"units\": 2\n },\n {\n \"add_on_id\": \"6f406f40-6f40-6f40-6f40-6f406f406f40\",\n \"charge_model\": \"volume\",\n \"properties\": {\n \"volume_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 100,\n \"per_unit_amount\": \"2\",\n \"flat_amount\": \"1\"\n },\n {\n \"from_value\": 101,\n \"to_value\": null,\n \"per_unit_amount\": \"1\",\n \"flat_amount\": \"0\"\n }\n ]\n },\n \"units\": 50\n }\n ],\n \"usage_thresholds\": [\n {\n \"amount_cents\": 10000,\n \"threshold_display_name\": \"Threshold 1\",\n \"recurring\": true\n }\n ],\n \"cascade_updates\": true,\n \"metadata\": {\n \"external_id\": \"ext-123\",\n \"synced_at\": \"2024-01-15\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v1/plans/{code}")
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 \"plan\": {\n \"name\": \"Startup\",\n \"invoice_display_name\": \"Startup plan\",\n \"code\": \"startup\",\n \"interval\": \"monthly\",\n \"description\": \"Plan for early stage startups.\",\n \"amount_cents\": 10000,\n \"amount_currency\": \"USD\",\n \"trial_period\": 5,\n \"pay_in_advance\": true,\n \"bill_charges_monthly\": null,\n \"bill_fixed_charges_monthly\": null,\n \"tax_codes\": [\n \"french_standard_vat\"\n ],\n \"minimum_commitment\": {\n \"amount_cents\": 100000,\n \"invoice_display_name\": \"Minimum Commitment (C1)\",\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n },\n \"charges\": [\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a91\",\n \"charge_model\": \"package\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": false,\n \"prorated\": false,\n \"min_amount_cents\": 3000,\n \"properties\": {\n \"amount\": \"30\",\n \"free_units\": 100,\n \"package_size\": 1000\n },\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a92\",\n \"charge_model\": \"graduated\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": false,\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {\n \"graduated_ranges\": [\n {\n \"to_value\": 10,\n \"from_value\": 0,\n \"flat_amount\": \"10\",\n \"per_unit_amount\": \"0.5\"\n },\n {\n \"to_value\": null,\n \"from_value\": 11,\n \"flat_amount\": \"0\",\n \"per_unit_amount\": \"0.4\"\n }\n ]\n }\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a93\",\n \"charge_model\": \"standard\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": true,\n \"regroup_paid_fees\": null,\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {}\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a94\",\n \"charge_model\": \"volume\",\n \"invoiceable\": true,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": false,\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {\n \"volume_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 100,\n \"flat_amount\": \"0\",\n \"per_unit_amount\": \"0\"\n },\n {\n \"from_value\": 101,\n \"to_value\": null,\n \"flat_amount\": \"0\",\n \"per_unit_amount\": \"0.5\"\n }\n ]\n }\n },\n {\n \"billable_metric_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a95\",\n \"charge_model\": \"percentage\",\n \"invoiceable\": false,\n \"invoice_display_name\": \"Setup\",\n \"pay_in_advance\": true,\n \"regroup_paid_fees\": \"invoice\",\n \"prorated\": false,\n \"min_amount_cents\": 0,\n \"properties\": {\n \"rate\": \"1\",\n \"fixed_amount\": \"0.5\",\n \"free_units_per_events\": 5,\n \"free_units_per_total_aggregation\": \"500\"\n }\n }\n ],\n \"fixed_charges\": [\n {\n \"id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"invoice_display_name\": \"New Setup Fee\",\n \"charge_model\": \"standard\",\n \"apply_units_immediately\": true,\n \"units\": 5\n },\n {\n \"add_on_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"code\": \"setup_fee\",\n \"invoice_display_name\": \"Setup Fee\",\n \"charge_model\": \"standard\",\n \"pay_in_advance\": true,\n \"prorated\": false,\n \"properties\": {\n \"amount\": \"500\"\n },\n \"units\": 1,\n \"apply_units_immediately\": false,\n \"tax_codes\": [\n \"french_standard_vat\"\n ]\n },\n {\n \"add_on_id\": \"4d604d60-4d60-4d60-4d60-4d604d604d60\",\n \"invoice_display_name\": \"Support Tier\",\n \"charge_model\": \"graduated\",\n \"pay_in_advance\": false,\n \"prorated\": true,\n \"properties\": {\n \"graduated_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 10,\n \"per_unit_amount\": \"5\",\n \"flat_amount\": \"200\"\n },\n {\n \"from_value\": 11,\n \"to_value\": null,\n \"per_unit_amount\": \"1\",\n \"flat_amount\": \"300\"\n }\n ]\n },\n \"units\": 2\n },\n {\n \"add_on_id\": \"6f406f40-6f40-6f40-6f40-6f406f406f40\",\n \"charge_model\": \"volume\",\n \"properties\": {\n \"volume_ranges\": [\n {\n \"from_value\": 0,\n \"to_value\": 100,\n \"per_unit_amount\": \"2\",\n \"flat_amount\": \"1\"\n },\n {\n \"from_value\": 101,\n \"to_value\": null,\n \"per_unit_amount\": \"1\",\n \"flat_amount\": \"0\"\n }\n ]\n },\n \"units\": 50\n }\n ],\n \"usage_thresholds\": [\n {\n \"amount_cents\": 10000,\n \"threshold_display_name\": \"Threshold 1\",\n \"recurring\": true\n }\n ],\n \"cascade_updates\": true,\n \"metadata\": {\n \"external_id\": \"ext-123\",\n \"synced_at\": \"2024-01-15\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"plan": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "Startup",
"created_at": "2023-06-27T19:43:42Z",
"code": "startup",
"interval": "monthly",
"amount_cents": 10000,
"amount_currency": "USD",
"invoice_display_name": "Startup plan",
"description": "",
"trial_period": 5,
"pay_in_advance": true,
"bill_charges_monthly": null,
"bill_fixed_charges_monthly": null,
"minimum_commitment": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"amount_cents": 100000,
"created_at": "2022-04-29T08:59:51Z",
"plan_code": "premium",
"invoice_display_name": "Minimum Commitment (C1)",
"interval": "monthly",
"updated_at": "2022-04-29T08:59:51Z",
"taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "TVA",
"code": "french_standard_vat",
"rate": 20,
"applied_to_organization": true,
"created_at": "2023-07-06T14:35:58Z",
"description": "French standard VAT"
}
]
},
"charges": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a91",
"lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a91",
"billable_metric_code": "requests",
"created_at": "2023-06-27T19:43:42Z",
"charge_model": "package",
"invoiceable": true,
"invoice_display_name": "Setup",
"pay_in_advance": false,
"regroup_paid_fees": null,
"prorated": false,
"min_amount_cents": 3000,
"properties": {
"amount": "30",
"free_units": 100,
"package_size": 1000
},
"filters": []
},
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a92",
"lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a92",
"billable_metric_code": "cpu",
"created_at": "2023-06-27T19:43:42Z",
"charge_model": "graduated",
"invoiceable": true,
"invoice_display_name": "Setup",
"pay_in_advance": false,
"regroup_paid_fees": null,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"graduated_ranges": [
{
"from_value": 0,
"to_value": 10,
"flat_amount": "10",
"per_unit_amount": "0.5"
},
{
"from_value": 11,
"to_value": null,
"flat_amount": "0",
"per_unit_amount": "0.4"
}
]
},
"filters": []
},
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a93",
"lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a93",
"billable_metric_code": "seats",
"created_at": "2023-06-27T19:43:42Z",
"charge_model": "standard",
"invoiceable": true,
"invoice_display_name": "Setup",
"pay_in_advance": true,
"regroup_paid_fees": null,
"prorated": false,
"min_amount_cents": 0,
"properties": {},
"filters": [
{
"invoice_display_name": "Europe",
"properties": {
"amount": "10"
},
"values": {
"region": [
"Europe"
]
}
},
{
"invoice_display_name": "USA",
"properties": {
"amount": "5"
},
"values": {
"region": [
"USA"
]
}
},
{
"invoice_display_name": "Africa",
"properties": {
"amount": "8"
},
"values": {
"region": [
"Africa"
]
}
}
]
},
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a94",
"lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a94",
"billable_metric_code": "storage",
"created_at": "2023-06-27T19:43:42Z",
"charge_model": "volume",
"invoiceable": true,
"invoice_display_name": "Setup",
"pay_in_advance": false,
"regroup_paid_fees": null,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"volume_ranges": [
{
"from_value": 0,
"to_value": 100,
"flat_amount": "0",
"per_unit_amount": "0"
},
{
"from_value": 101,
"to_value": null,
"flat_amount": "0",
"per_unit_amount": "0.5"
}
]
},
"filters": []
},
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a95",
"lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a95",
"billable_metric_code": "payments",
"created_at": "2023-06-27T19:43:42Z",
"charge_model": "percentage",
"invoiceable": false,
"invoice_display_name": "Setup",
"pay_in_advance": true,
"regroup_paid_fees": "invoice",
"prorated": false,
"min_amount_cents": 0,
"properties": {
"rate": "1",
"fixed_amount": "0.5",
"free_units_per_events": 5,
"free_units_per_total_aggregation": "500"
},
"filters": []
}
],
"fixed_charges": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"lago_add_on_id": "2b802b80-2b80-2b80-2b80-2b802b802b80",
"code": "setup_fee",
"invoice_display_name": "Setup Fee",
"add_on_code": "setup",
"created_at": "2026-01-15T10:30:00Z",
"charge_model": "standard",
"pay_in_advance": true,
"prorated": false,
"properties": {
"amount": "500"
},
"units": 1,
"lago_parent_id": null,
"taxes": [
{
"lago_id": "3c703c70-3c70-3c70-3c70-3c703c703c70",
"name": "VAT",
"code": "vat_20",
"rate": 20,
"description": "Standard VAT rate",
"applied_to_organization": true,
"created_at": "2026-01-01T00:00:00Z"
}
]
},
{
"lago_id": "4d604d60-4d60-4d60-4d60-4d604d604d60",
"lago_add_on_id": "5e505e50-5e50-5e50-5e50-5e505e505e50",
"code": "support_tier",
"invoice_display_name": "Support Tier",
"add_on_code": "premium_support",
"created_at": "2026-01-15T10:30:00Z",
"charge_model": "graduated",
"pay_in_advance": false,
"prorated": true,
"properties": {
"graduated_ranges": [
{
"from_value": 0,
"to_value": 10,
"per_unit_amount": "5",
"flat_amount": "200"
},
{
"from_value": 11,
"to_value": null,
"per_unit_amount": "1",
"flat_amount": "300"
}
]
},
"units": 1,
"lago_parent_id": null,
"taxes": []
},
{
"lago_id": "6f406f40-6f40-6f40-6f40-6f406f406f40",
"lago_add_on_id": "7a307a30-7a30-7a30-7a30-7a307a307a30",
"code": "storage",
"invoice_display_name": "Storage Allocation",
"add_on_code": "cloud_storage",
"created_at": "2026-01-15T10:30:00Z",
"charge_model": "volume",
"pay_in_advance": false,
"prorated": false,
"properties": {
"volume_ranges": [
{
"from_value": 0,
"to_value": 100,
"per_unit_amount": "2",
"flat_amount": "1"
},
{
"from_value": 101,
"to_value": null,
"per_unit_amount": "1",
"flat_amount": "0"
}
]
},
"units": 50,
"lago_parent_id": null,
"taxes": []
}
],
"taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "TVA",
"code": "french_standard_vat",
"rate": 20,
"applied_to_organization": true,
"created_at": "2023-07-06T14:35:58Z",
"description": "French standard VAT"
}
],
"usage_thresholds": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"threshold_display_name": "Threshold 1",
"amount_cents": 10000,
"recurring": true,
"created_at": "2023-06-27T19:43:42Z",
"updated_at": "2023-06-27T19:43:42Z"
}
],
"entitlements": [
{
"entitlement": {
"code": "seats",
"name": "Number of seats",
"description": "Number of users of the account",
"privileges": [
{
"code": "max",
"name": "Maximum",
"value_type": "integer",
"config": {},
"value": 10
},
{
"code": "max_admins",
"name": "Max Admins",
"value_type": "integer",
"config": {},
"value": 5
},
{
"code": "root",
"name": "Allow root user",
"value_type": "boolean",
"config": {},
"value": true
},
{
"code": "provider",
"name": "SSO Provider",
"value_type": "select",
"value": "google",
"config": {
"select_options": [
"google",
"okta"
]
}
}
]
}
}
],
"metadata": {
"external_id": "ext-123",
"synced_at": "2024-01-15",
"source": null
}
}
}{
"status": 400,
"error": "Bad request"
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}{
"status": 422,
"error": "Unprocessable entity",
"code": "validation_errors",
"error_details": {}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The code of the plan. It serves as a unique identifier associated with a particular plan. The code is typically used for internal or system-level identification purposes, like assigning a subscription, for instance.
Example:
"startup"
Body
application/json
Plan payload
Show child attributes
Show child attributes
Response
Plan updated
Show child attributes
Show child attributes
⌘I