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
/api/v1/plans/{code}
Bearer*
{
"plan": {
"active_subscriptions_count": "integer",
"amount_cents": "10000",
"amount_currency": "USD",
"bill_charges_monthly": "null",
"charges": [
{
"billable_metric_code": "requests",
"charge_model": "package",
"created_at": "2023-06-27T19:43:42Z",
"group_properties": [],
"invoiceable": true,
"lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a91",
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a91",
"min_amount_cents": 3000,
"pay_in_advance": false,
"properties": {
"amount": "30",
"free_units": 100,
"package_size": 1000
},
"prorated": false
},
{
"billable_metric_code": "cpu",
"charge_model": "graduated",
"created_at": "2023-06-27T19:43:42Z",
"group_properties": [],
"invoiceable": true,
"lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a92",
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a92",
"min_amount_cents": 0,
"pay_in_advance": false,
"properties": {
"graduated_ranges": [
{
"flat_amount": "10",
"from_value": 0,
"per_unit_amount": "0.5",
"to_value": 10
},
{
"flat_amount": "0",
"from_value": 11,
"per_unit_amount": "0.4",
"to_value": null
}
]
},
"prorated": false
},
{
"billable_metric_code": "seats",
"charge_model": "standard",
"created_at": "2023-06-27T19:43:42Z",
"group_properties": [
{
"group_id": "1a901a90-1a90-1a90-1a90-1a901a901a01",
"values": {
"amount": "10"
}
},
{
"group_id": "1a901a90-1a90-1a90-1a90-1a901a901a02",
"values": {
"amount": "5"
}
},
{
"group_id": "1a901a90-1a90-1a90-1a90-1a901a901a03",
"values": {
"amount": "8"
}
}
],
"invoiceable": true,
"lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a93",
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a93",
"min_amount_cents": 0,
"pay_in_advance": true,
"properties": {},
"prorated": false
},
{
"billable_metric_code": "storage",
"charge_model": "volume",
"created_at": "2023-06-27T19:43:42Z",
"group_properties": [],
"invoiceable": true,
"lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a94",
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a94",
"min_amount_cents": 0,
"pay_in_advance": false,
"properties": {
"volume_ranges": [
{
"flat_amount": "0",
"from_value": 0,
"per_unit_amount": "0",
"to_value": 100
},
{
"flat_amount": "0",
"from_value": 101,
"per_unit_amount": "0.5",
"to_value": null
}
]
},
"prorated": false
},
{
"billable_metric_code": "payments",
"charge_model": "percentage",
"created_at": "2023-06-27T19:43:42Z",
"group_properties": [],
"invoiceable": false,
"lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a95",
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a95",
"min_amount_cents": 0,
"pay_in_advance": true,
"properties": {
"fixed_amount": "0.5",
"free_units_per_events": 5,
"free_units_per_total_aggregation": "500",
"rate": "1"
},
"prorated": false
}
],
"code": "startup",
"created_at": "2023-06-27T19:43:42Z",
"description": "string",
"draft_invoices_count": "integer",
"interval": "monthly",
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "Startup",
"pay_in_advance": true,
"taxes": [
{
"add_ons_count": "integer",
"applied_to_organization": true,
"charges_count": "integer",
"code": "french_standard_vat",
"created_at": "2023-07-06T14:35:58Z",
"customers_count": "integer",
"description": "French standard VAT",
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "TVA",
"plans_count": "integer",
"rate": "20"
}
],
"trial_period": "5"
}
}
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request PUT "$LAGO_URL/api/v1/plans/__plan_code__" \
--header "Authorization: Bearer $API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"plan": {
"name": "Startup Premium",
"code": "startup",
"interval": "monthly",
"description": null,
"amount_cents": 1000,
"amount_currency": "USD",
"trial_period": 10,
"pay_in_advance": true,
"bill_charges_monthly": null,
"tax_codes": ["french_standard_vat"],
"charges": [
{
"lago_billable_metric_id": "__BILLABLE_METRIC_ID__",
"billable_metric_code": "api_request",
"charge_model": "graduated",
"invoiceable": true,
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"graduated_ranges": [
{
"from_value": 0,
"to_value": 10000,
"per_unit_amount": "0.02",
"flat_amount": "50"
},
{
"from_value": 10001,
"to_value": null,
"per_unit_amount": "0.01",
"flat_amount": "100"
}
]
},
"tax_codes": []
},
{
"lago_billable_metric_id": "__BILLABLE_METRIC_ID__",
"billable_metric_code": "requests",
"charge_model": "package",
"invoiceable": true,
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"amount": "30",
"free_units": 1000,
"package_size": 10000
},
"tax_codes": []
},
{
"lago_billable_metric_id": "__BILLABLE_METRIC_ID__",
"billable_metric_code": "payments",
"charge_model": "percentage",
"invoiceable": true,
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"rate": "0.15",
"fixed_amount": "0.5",
"free_units_per_events": 5,
"free_units_per_total_aggregation": "500",
"per_transaction_min_amount": "1.75",
"per_transaction_max_amount": "2"
},
"tax_codes": []
},
{
"lago_billable_metric_id": "__BILLABLE_METRIC_ID__",
"billable_metric_code": "seat",
"charge_model": "standard",
"invoiceable": true,
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"amount": "10"
},
"tax_codes": []
},
{
"lago_billable_metric_id": "__BILLABLE_METRIC_ID__",
"billable_metric_code": "sms_sent",
"charge_model": "volume",
"invoiceable": true,
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"volume_ranges": [
{
"from_value": 0,
"to_value": 1000,
"per_unit_amount": "0.75",
"flat_amount": "0"
},
{
"from_value": 1001,
"to_value": null,
"per_unit_amount": "0.50",
"flat_amount": "0"
}
]
},
"tax_codes": []
},
{
"lago_billable_metric_id": "__BILLABLE_METRIC_ID__",
"billable_metric_code": "api_request_groups",
"charge_model": "graduated",
"invoiceable": true,
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"graduated_ranges": [
{
"from_value": 0,
"to_value": null,
"per_unit_amount": "0",
"flat_amount": "0"
}
]
},
"group_properties": [
{
"group_id": "__GROUP_ID__",
"values": {
"graduated_ranges": [
{
"from_value": 0,
"to_value": 20000,
"per_unit_amount": "0.02",
"flat_amount": "50"
},
{
"from_value": 20001,
"to_value": null,
"per_unit_amount": "0.01",
"flat_amount": "100"
}
]
}
}
],
"tax_codes": []
},
{
"lago_billable_metric_id": "__BILLABLE_METRIC_ID__",
"billable_metric_code": "request_groups",
"charge_model": "package",
"invoiceable": true,
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"amount": "0",
"free_units": 0,
"package_size": 1
},
"group_properties": [
{
"group_id": "__GROUP_ID__",
"values": {
"amount": "30",
"free_units": 1000,
"package_size": 10000
}
}
],
"tax_codes": []
},
{
"lago_billable_metric_id": "__BILLABLE_METRIC_ID__",
"billable_metric_code": "payment_groups",
"charge_model": "percentage",
"invoiceable": true,
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"rate": "0"
},
"group_properties": [
{
"group_id": "__GROUP_ID__",
"values": {
"rate": "0.15",
"fixed_amount": "0.5",
"free_units_per_events": 5,
"free_units_per_total_aggregation": "500",
"per_transaction_min_amount": "1.75",
"per_transaction_max_amount": "2"
}
}
],
"tax_codes": []
},
{
"lago_billable_metric_id": "__BILLABLE_METRIC_ID__",
"billable_metric_code": "seats_groups",
"charge_model": "standard",
"invoiceable": true,
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"amount": "0"
},
"group_properties": [
{
"group_id": "__GROUP_ID__",
"values": {
"amount": "15"
}
}
],
"tax_codes": []
},
{
"lago_billable_metric_id": "__BILLABLE_METRIC_ID__",
"billable_metric_code": "sms_sent_groups",
"charge_model": "volume",
"invoiceable": true,
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"volume_ranges": [
{
"from_value": 0,
"to_value": null,
"per_unit_amount": "0",
"flat_amount": "0"
}
]
},
"group_properties": [
{
"group_id": "__GROUP_ID__",
"values": {
"volume_ranges": [
{
"from_value": 0,
"to_value": 2000,
"per_unit_amount": "0.75",
"flat_amount": "0"
},
{
"from_value": 2001,
"to_value": null,
"per_unit_amount": "0.50",
"flat_amount": "0"
}
]
}
}
],
"tax_codes": []
}
]
}
}
'
Authorizations
Authorizationheaderrequired
string
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Path Parameters
coderequired
string
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.
Body
application/json
planrequired
object
Response
200 - application/json
planrequired
object
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request PUT "$LAGO_URL/api/v1/plans/__plan_code__" \
--header "Authorization: Bearer $API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"plan": {
"name": "Startup Premium",
"code": "startup",
"interval": "monthly",
"description": null,
"amount_cents": 1000,
"amount_currency": "USD",
"trial_period": 10,
"pay_in_advance": true,
"bill_charges_monthly": null,
"tax_codes": ["french_standard_vat"],
"charges": [
{
"lago_billable_metric_id": "__BILLABLE_METRIC_ID__",
"billable_metric_code": "api_request",
"charge_model": "graduated",
"invoiceable": true,
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"graduated_ranges": [
{
"from_value": 0,
"to_value": 10000,
"per_unit_amount": "0.02",
"flat_amount": "50"
},
{
"from_value": 10001,
"to_value": null,
"per_unit_amount": "0.01",
"flat_amount": "100"
}
]
},
"tax_codes": []
},
{
"lago_billable_metric_id": "__BILLABLE_METRIC_ID__",
"billable_metric_code": "requests",
"charge_model": "package",
"invoiceable": true,
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"amount": "30",
"free_units": 1000,
"package_size": 10000
},
"tax_codes": []
},
{
"lago_billable_metric_id": "__BILLABLE_METRIC_ID__",
"billable_metric_code": "payments",
"charge_model": "percentage",
"invoiceable": true,
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"rate": "0.15",
"fixed_amount": "0.5",
"free_units_per_events": 5,
"free_units_per_total_aggregation": "500",
"per_transaction_min_amount": "1.75",
"per_transaction_max_amount": "2"
},
"tax_codes": []
},
{
"lago_billable_metric_id": "__BILLABLE_METRIC_ID__",
"billable_metric_code": "seat",
"charge_model": "standard",
"invoiceable": true,
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"amount": "10"
},
"tax_codes": []
},
{
"lago_billable_metric_id": "__BILLABLE_METRIC_ID__",
"billable_metric_code": "sms_sent",
"charge_model": "volume",
"invoiceable": true,
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"volume_ranges": [
{
"from_value": 0,
"to_value": 1000,
"per_unit_amount": "0.75",
"flat_amount": "0"
},
{
"from_value": 1001,
"to_value": null,
"per_unit_amount": "0.50",
"flat_amount": "0"
}
]
},
"tax_codes": []
},
{
"lago_billable_metric_id": "__BILLABLE_METRIC_ID__",
"billable_metric_code": "api_request_groups",
"charge_model": "graduated",
"invoiceable": true,
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"graduated_ranges": [
{
"from_value": 0,
"to_value": null,
"per_unit_amount": "0",
"flat_amount": "0"
}
]
},
"group_properties": [
{
"group_id": "__GROUP_ID__",
"values": {
"graduated_ranges": [
{
"from_value": 0,
"to_value": 20000,
"per_unit_amount": "0.02",
"flat_amount": "50"
},
{
"from_value": 20001,
"to_value": null,
"per_unit_amount": "0.01",
"flat_amount": "100"
}
]
}
}
],
"tax_codes": []
},
{
"lago_billable_metric_id": "__BILLABLE_METRIC_ID__",
"billable_metric_code": "request_groups",
"charge_model": "package",
"invoiceable": true,
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"amount": "0",
"free_units": 0,
"package_size": 1
},
"group_properties": [
{
"group_id": "__GROUP_ID__",
"values": {
"amount": "30",
"free_units": 1000,
"package_size": 10000
}
}
],
"tax_codes": []
},
{
"lago_billable_metric_id": "__BILLABLE_METRIC_ID__",
"billable_metric_code": "payment_groups",
"charge_model": "percentage",
"invoiceable": true,
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"rate": "0"
},
"group_properties": [
{
"group_id": "__GROUP_ID__",
"values": {
"rate": "0.15",
"fixed_amount": "0.5",
"free_units_per_events": 5,
"free_units_per_total_aggregation": "500",
"per_transaction_min_amount": "1.75",
"per_transaction_max_amount": "2"
}
}
],
"tax_codes": []
},
{
"lago_billable_metric_id": "__BILLABLE_METRIC_ID__",
"billable_metric_code": "seats_groups",
"charge_model": "standard",
"invoiceable": true,
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"amount": "0"
},
"group_properties": [
{
"group_id": "__GROUP_ID__",
"values": {
"amount": "15"
}
}
],
"tax_codes": []
},
{
"lago_billable_metric_id": "__BILLABLE_METRIC_ID__",
"billable_metric_code": "sms_sent_groups",
"charge_model": "volume",
"invoiceable": true,
"pay_in_advance": false,
"prorated": false,
"min_amount_cents": 0,
"properties": {
"volume_ranges": [
{
"from_value": 0,
"to_value": null,
"per_unit_amount": "0",
"flat_amount": "0"
}
]
},
"group_properties": [
{
"group_id": "__GROUP_ID__",
"values": {
"volume_ranges": [
{
"from_value": 0,
"to_value": 2000,
"per_unit_amount": "0.75",
"flat_amount": "0"
},
{
"from_value": 2001,
"to_value": null,
"per_unit_amount": "0.50",
"flat_amount": "0"
}
]
}
}
],
"tax_codes": []
}
]
}
}
'
{
"plan": {
"active_subscriptions_count": "integer",
"amount_cents": "10000",
"amount_currency": "USD",
"bill_charges_monthly": "null",
"charges": [
{
"billable_metric_code": "requests",
"charge_model": "package",
"created_at": "2023-06-27T19:43:42Z",
"group_properties": [],
"invoiceable": true,
"lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a91",
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a91",
"min_amount_cents": 3000,
"pay_in_advance": false,
"properties": {
"amount": "30",
"free_units": 100,
"package_size": 1000
},
"prorated": false
},
{
"billable_metric_code": "cpu",
"charge_model": "graduated",
"created_at": "2023-06-27T19:43:42Z",
"group_properties": [],
"invoiceable": true,
"lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a92",
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a92",
"min_amount_cents": 0,
"pay_in_advance": false,
"properties": {
"graduated_ranges": [
{
"flat_amount": "10",
"from_value": 0,
"per_unit_amount": "0.5",
"to_value": 10
},
{
"flat_amount": "0",
"from_value": 11,
"per_unit_amount": "0.4",
"to_value": null
}
]
},
"prorated": false
},
{
"billable_metric_code": "seats",
"charge_model": "standard",
"created_at": "2023-06-27T19:43:42Z",
"group_properties": [
{
"group_id": "1a901a90-1a90-1a90-1a90-1a901a901a01",
"values": {
"amount": "10"
}
},
{
"group_id": "1a901a90-1a90-1a90-1a90-1a901a901a02",
"values": {
"amount": "5"
}
},
{
"group_id": "1a901a90-1a90-1a90-1a90-1a901a901a03",
"values": {
"amount": "8"
}
}
],
"invoiceable": true,
"lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a93",
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a93",
"min_amount_cents": 0,
"pay_in_advance": true,
"properties": {},
"prorated": false
},
{
"billable_metric_code": "storage",
"charge_model": "volume",
"created_at": "2023-06-27T19:43:42Z",
"group_properties": [],
"invoiceable": true,
"lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a94",
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a94",
"min_amount_cents": 0,
"pay_in_advance": false,
"properties": {
"volume_ranges": [
{
"flat_amount": "0",
"from_value": 0,
"per_unit_amount": "0",
"to_value": 100
},
{
"flat_amount": "0",
"from_value": 101,
"per_unit_amount": "0.5",
"to_value": null
}
]
},
"prorated": false
},
{
"billable_metric_code": "payments",
"charge_model": "percentage",
"created_at": "2023-06-27T19:43:42Z",
"group_properties": [],
"invoiceable": false,
"lago_billable_metric_id": "1a901a90-1a90-1a90-1a90-1a901a901a95",
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a95",
"min_amount_cents": 0,
"pay_in_advance": true,
"properties": {
"fixed_amount": "0.5",
"free_units_per_events": 5,
"free_units_per_total_aggregation": "500",
"rate": "1"
},
"prorated": false
}
],
"code": "startup",
"created_at": "2023-06-27T19:43:42Z",
"description": "string",
"draft_invoices_count": "integer",
"interval": "monthly",
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "Startup",
"pay_in_advance": true,
"taxes": [
{
"add_ons_count": "integer",
"applied_to_organization": true,
"charges_count": "integer",
"code": "french_standard_vat",
"created_at": "2023-07-06T14:35:58Z",
"customers_count": "integer",
"description": "French standard VAT",
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "TVA",
"plans_count": "integer",
"rate": "20"
}
],
"trial_period": "5"
}
}