POST
/
plans
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"

curl --location --request POST "$LAGO_URL/api/v1/plans" \
--header "Authorization: Bearer $API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
  "plan": {
    "name": "Startup",
    "code": "startup",
    "interval": "monthly",
    "description": null,
    "amount_cents": 1000,
    "amount_currency": "USD",
    "invoice_display_name": "",
    "trial_period": 10,
    "pay_in_advance": true,
    "bill_charges_monthly": null,
    "tax_codes": ["french_standard_vat"],
    "charges": [
      {
        "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,
        "invoice_display_name": "New name on invoice 1",
        "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": []
      },
      {
        "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,
        "invoice_display_name": "",
        "properties": {
          "amount": "30",
          "free_units": 1000,
          "package_size": 10000
        },
        "tax_codes": []
      },
      {
        "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,
        "invoice_display_name": "New name on invoice 2",
        "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": []
      },
      {
        "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,
        "invoice_display_name": "",
        "properties": {
          "amount": "10"
        },
        "tax_codes": []
      },
      {
        "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,
        "invoice_display_name": "",
        "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": []
      },
      {
        "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,
        "invoice_display_name": "",
        "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": []
      },
      {
        "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": []
      },
      {
        "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": []
      },
      {
        "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": []
      },
      {
        "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": 123,
    "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": [],
        "invoice_display_name": "Setup",
        "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": [],
        "invoice_display_name": "Setup",
        "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",
            "invoice_display_name": "Europe",
            "values": {
              "amount": "10"
            }
          },
          {
            "group_id": "1a901a90-1a90-1a90-1a90-1a901a901a02",
            "invoice_display_name": "USA",
            "values": {
              "amount": "5"
            }
          },
          {
            "group_id": "1a901a90-1a90-1a90-1a90-1a901a901a03",
            "invoice_display_name": "Africa",
            "values": {
              "amount": "8"
            }
          }
        ],
        "invoice_display_name": "Setup",
        "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": [],
        "invoice_display_name": "Setup",
        "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": [],
        "invoice_display_name": "Setup",
        "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": 123,
    "interval": "monthly",
    "invoice_display_name": "Startup plan",
    "lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
    "name": "Startup",
    "pay_in_advance": true,
    "taxes": [
      {
        "add_ons_count": 123,
        "applied_to_organization": true,
        "charges_count": 123,
        "code": "french_standard_vat",
        "created_at": "2023-07-06T14:35:58Z",
        "customers_count": 123,
        "description": "French standard VAT",
        "lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
        "name": "TVA",
        "plans_count": 123,
        "rate": 20
      }
    ],
    "trial_period": 5
  }
}

Authorizations

Authorization
string
headerrequired

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

Body

application/json
plan
object
required

Response

200 - application/json
plan
object
required