PUT
/
subscriptions
/
{external_id}
Authorization
Path
Body
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"

curl --location --request PUT "$LAGO_URL/api/v1/subscriptions/:id" \
  --header "Authorization: Bearer $API_KEY" \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "subscription": {
    "name": "Repository B",
    "ending_at": "2022-10-08T00:00:00Z",
    "subscription_at": "2022-08-08T00:00:00Z",
    "plan_overrides": {
      "amount_cents": 10000,
      "amount_currency": "USD",
      "description": "Plan for early stage startups.",
      "invoice_display_name": "Startup plan",
      "name": "Startup",
      "tax_codes": [
        "french_standard_vat"
      ],
      "trial_period": 5,
      "charges": [
        {
          "id": "cha_12345",
          "billable_metric_id": "bm_12345",
          "invoice_display_name": "Setup",
          "min_amount_cents": 0,
          "tax_codes": [
            "standard_vat"
          ],
          "properties": {
            "graduated_ranges": [
              {
                "from_value": 0,
                "to_value": 10,
                "flat_amount": "10",
                "per_unit_amount": "0.5"
              }
            ]
          }
        },
        {
          "id": "cha_67890",
          "billable_metric_id": "bm_67890",
          "invoice_display_name": "FX Transfer",
          "min_amount_cents": 0,
          "properties": {
            "graduated_percentage_ranges": [
              {
                "from_value": 0,
                "to_value": 10,
                "rate": "1",
                "flat_amount": "10"
              }
            ]
          }
        },
        {
          "id": "cha_111213",
          "billable_metric_id": "bm_111213",
          "invoice_display_name": "API calls",
          "min_amount_cents": 0,
          "properties": {
            "amount": "30",
            "free_units": 100,
            "package_size": 1000
          }
        },
        {
          "id": "cha_141516",
          "billable_metric_id": "bm_141516",
          "invoice_display_name": "Interchange",
          "min_amount_cents": 0,
          "properties": {
            "rate": "1",
            "fixed_amount": "0.5",
            "free_units_per_events": 5,
            "free_units_per_total_aggregation": "500",
            "per_transaction_max_amount": "3.75",
            "per_transaction_min_amount": "1.75"
          }
        },
        {
          "id": "cha_171819",
          "billable_metric_id": "bm_171819",
          "invoice_display_name": "Seats",
          "min_amount_cents": 0,
          "properties": {
            "volume_ranges": [
              {
                "from_value": 0,
                "to_value": 10,
                "flat_amount": "10",
                "per_unit_amount": "0.5"
              }
            ]
          }
        },
        {
          "id": "cha_202122",
          "billable_metric_id": "bm_202122",
          "invoice_display_name": "Interchange",
          "min_amount_cents": 0,
          "group_properties": [
            {
              "group_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
              "values": {
                "graduated_ranges": [
                  {
                    "from_value": 0,
                    "to_value": 10,
                    "flat_amount": "10",
                    "per_unit_amount": "0.5"
                  }
                ]
              }
            }
          ]
        }
      ]
    }
  }
}'
{
  "subscription": {
    "billing_time": "anniversary",
    "canceled_at": "2022-09-14T16:35:31Z",
    "created_at": "2022-08-08T00:00:00Z",
    "downgrade_plan_date": "null",
    "ending_at": "2022-10-08T00:00:00Z",
    "external_customer_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
    "external_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
    "lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
    "lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
    "name": "Repository A",
    "next_plan_code": "null",
    "plan_code": "premium",
    "previous_plan_code": "null",
    "started_at": "2022-08-08T00:00:00Z",
    "status": "active",
    "subscription_at": "2022-08-08T00:00:00Z",
    "terminated_at": "2022-09-14T16:35:31Z",
    "plan": {
      "active_subscriptions_count": 123,
      "amount_cents": 10000,
      "amount_currency": "USD",
      "code": "startup",
      "created_at": "2023-06-27T19:43:42Z",
      "draft_invoices_count": 123,
      "interval": "monthly",
      "lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
      "name": "Startup"
    }
  }
}

Authorizations

Authorization
string
headerrequired

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

Path Parameters

external_id
string
required

External ID of the existing subscription

Body

application/json
subscription
object
required

Response

200 - application/json
subscription
object
required