Plans API

The Plans API allows you to create, manage, and configure subscription plans for your application. Plans can include features, pricing, and integration with pricing tables.

Overview

Plans represent subscription tiers that customers can subscribe to. Each plan can have:

  • Features: Specific capabilities or limits
  • Pricing: Monthly/yearly pricing with usage-based components
  • Versioning: Plans support versioning for changes over time
  • Pricing Table Integration: Automatic display in pricing tables

Authentication

All API requests require authentication via merchant credentials.

Endpoints

Get All Plans

Get all plans for the authenticated merchant.

GET https://api.getlumen.dev/v1/plans

Query Parameters

ParameterTypeDescription
includeFeaturesbooleanInclude associated features in response
includePricesbooleanInclude pricing information in response
includeTrialsbooleanInclude trial plans in response

Response

{
  "plans": [
    {
      "id": "plan_123",
      "stablePlanId": "starter_plan",
      "versionNumber": 1,
      "planName": "Starter Plan",
      "planDescription": "Perfect for getting started",
      "merchantId": "merchant_123",
      "isVisibleInPricingTable": true,
      "isEnterprisePlan": false,
      "buttonText": "Get Started",
      "enterpriseRedirectUrl": null,
      "createdAt": "2024-01-01T00:00:00Z",
      "features": [
        {
          "id": "feature_123",
          "slug": "api_calls",
          "displayName": "API Calls",
          "featureType": "number",
          "featureValue": "1000"
        }
      ]
    }
  ]
}

Get Plan by ID

Get a specific plan by its ID or stable ID.

GET https://api.getlumen.dev/v1/plans/{id}

Parameters

ParameterTypeDescription
idstringPlan ID or stable plan ID

Query Parameters

ParameterTypeDescription
includeFeaturesbooleanInclude associated features
isStableIdbooleanTreat ID parameter as stable ID

Response

Same structure as the plans array above, but returns a single plan.

Create Plan

Create a new subscription plan with optional features and pricing.

POST https://api.getlumen.dev/v1/plans

Request Body

{
  "planName": "Professional Plan",
  "planDescription": "For growing businesses",
  "currency": "USD",
  "monthlyPrice": 2900,
  "yearlyPrice": 2400,
  "hasYearlyPrice": true,
  "showInPricingTable": true,
  "isEnterprisePlan": false,
  "newFeatures": [
    {
      "featureName": "API Calls",
      "slug": "api_calls",
      "eventName": "api_call",
      "isUsageBased": true,
      "usagePricePerUnit": 10,
      "hasCreditAllowance": true,
      "creditAllowanceAmount": 10000,
      "creditAllowanceRenewal": "monthly"
    },
    {
      "featureName": "Premium Support",
      "slug": "premium_support",
      "isUsageBased": false
    }
  ],
  "featureIds": ["existing_feature_id"],
  "commitMessage": "Added professional plan with enhanced features"
}

Request Fields

FieldTypeRequiredDescription
planNamestringDisplay name of the plan
planDescriptionstringPlan description
currencystringCurrency code (defaults to merchant default)
monthlyPricenumberMonthly price in cents
yearlyPricenumberYearly price in cents
hasYearlyPricebooleanWhether plan offers yearly pricing
isSeatBasedbooleanEnable seat-based per-unit pricing
minSeatsnumberMinimum seats when billing immediately
billImmediatelybooleanBill fixed/per-seat components upfront
showInPricingTablebooleanAdd to pricing table automatically
isEnterprisePlanbooleanMark as enterprise plan
enterpriseButtonTextstringCustom button text for enterprise
enterpriseRedirectUrlstringRedirect URL for enterprise plans
newFeaturesarrayFeatures to create and associate
featureIdsarrayExisting feature IDs to associate
commitMessagestringVersion commit message
trialobjectFree trial configuration

New Features Schema

FieldTypeRequiredDescription
featureNamestringDisplay name
slugstringUnique identifier
eventNamestringEvent name for usage tracking
isUsageBasedbooleanWhether feature tracks usage
usagePricePerUnitnumberPrice per usage unit in cents
hasCreditAllowancebooleanInclude credit allowance
creditAllowanceAmountnumberCredit amount
creditAllowanceRenewalenummonthly, yearly, or none
existingFeatureIdstringID of existing feature to configure
trial.enabledbooleanEnable or disable free trial
trial.daysnumberTrial length in days (when enabled)
trial.creditOverridesarrayOptional per-feature trial credits

Response

{
  "plans": [
    {
      "id": "plan_456",
      "stablePlanId": "professional_plan",
      "versionNumber": 1,
      "planName": "Professional Plan",
      "planDescription": "For growing businesses",
      "merchantId": "merchant_123",
      "isVisibleInPricingTable": true,
      "isEnterprisePlan": false,
      "buttonText": "Get Started",
      "features": [
        {
          "id": "feature_456",
          "slug": "api_calls",
          "displayName": "API Calls",
          "featureType": "number",
          "featureValue": "usage_based"
        }
      ],
      "createdAt": "2024-01-01T00:00:00Z"
    }
  ]
}

Update Plan

Create a new version of an existing plan with updated configuration.

POST https://api.getlumen.dev/v1/plans/{id}

Parameters

ParameterTypeDescription
idstringPlan ID or stable plan ID

Query Parameters

ParameterTypeDescription
isStableIdbooleanTreat ID as stable plan ID

Request Body

{
  "planName": "Professional Plan v2",
  "planDescription": "Updated professional plan",
  "priceIds": ["price_123", "price_456"],
  "featureIds": ["feature_123", "feature_456"],
  "commitMessage": "Updated plan with new pricing"
}

Request Fields

FieldTypeDescription
planNamestringUpdated plan name
planDescriptionstringUpdated description
priceIdsarrayPrice IDs to associate with new version
featureIdsarrayFeature IDs to associate with new version
commitMessagestringVersion commit message

Note: If priceIds or featureIds are not provided, the existing associations will be cloned to the new version.

Response

Returns the new plan version with the same structure as the create response.

Intelligent Plan Edit

Performs an in-place edit when safe (metadata-only or feature rename-only), otherwise creates a new version of the plan.

POST https://api.getlumen.dev/v1/plans/{id}/edit

Request Body (subset)

{
  "planName": "Pro Plan",
  "planDescription": "Updated copy",
  "features": [
    { "featureName": "API Calls", "slug": "api_calls", "isUsageBased": true, "usagePricePerUnit": 10 }
  ],
  "monthlyPrice": 2900,
  "yearlyPrice": 2400,
  "hasYearlyPrice": true,
  "isSeatBased": false,
  "showInPricingTable": true,
  "trial": { "enabled": true, "days": 14 }
}

Response

Returns the updated plan. If a new version was required, the response includes the new version data.

Migrate Subscribers Between Plan Versions

Migrate or schedule migrations from one version of a plan to another, with explicit price mapping.

POST https://api.getlumen.dev/v1/plans/{stablePlanId}/migrate

Request Body

{
  "strategy": "next_billing_cycle",
  "fromVersion": 1,
  "toVersion": 2,
  "priceMapping": { "price_old": "price_new" }
}

Response

{ "success": true, "scheduledCount": 123, "message": "Scheduled migration..." }

Compare Plan Versions

Analyze differences between two versions and get a recommended migration strategy.

GET https://api.getlumen.dev/v1/plans/{stablePlanId}/compare?fromVersion=1&toVersion=2

Response

{
  "migrationAnalysis": {
    "hasPriceChanges": false,
    "hasFeatureChanges": true,
    "hasNumericFeatureChanges": false,
    "recommendedStrategy": "immediate"
  }
}

Get Scheduled Migrations (from a plan version)

GET https://api.getlumen.dev/v1/plans/{planId}/scheduled-migrations

Response

{ "scheduledMigrations": [ /* array of scheduled changes */ ] }

Get Incoming Migrations (to a plan version)

GET https://api.getlumen.dev/v1/plans/{planId}/incoming-migrations

Response

{ "incomingMigrations": [ /* array of incoming changes */ ] }

Delete Plan

Soft delete a plan and its associations.

DELETE https://api.getlumen.dev/v1/plans/{id}

Parameters

ParameterTypeDescription
idstringPlan ID to delete

Response

{
  "success": true,
  "message": "Plan and associated features and pricing table associations deleted successfully"
}

Toggle Pricing Table Visibility

Add or remove a plan from pricing tables.

POST https://api.getlumen.dev/v1/plans/{id}/toggle-pricing-table-visibility

Parameters

ParameterTypeDescription
idstringPlan ID

Request Body

{
  "isVisible": true
}

Response

{
  "success": true,
  "message": "Plan added to pricing table successfully",
  "plan": {
    "id": "plan_123",
    "isVisibleInPricingTable": true
    // ... full plan object
  }
}

Examples

Creating a Basic Plan

curl -X POST https://api.getlumen.dev/v1/plans \
  -H "Content-Type: application/json" \
  -d '{
    "planName": "Basic Plan",
    "planDescription": "Essential features for small teams",
    "monthlyPrice": 999,
    "showInPricingTable": true
  }'

Creating a Plan with Usage-Based Features

curl -X POST https://api.getlumen.dev/v1/plans \
  -H "Content-Type: application/json" \
  -d '{
    "planName": "Professional Plan",
    "planDescription": "Advanced features with usage tracking",
    "monthlyPrice": 2900,
    "yearlyPrice": 2400,
    "hasYearlyPrice": true,
    "showInPricingTable": true,
    "newFeatures": [
      {
        "featureName": "API Calls",
        "slug": "api_calls",
        "eventName": "api_call",
        "isUsageBased": true,
        "usagePricePerUnit": 10,
        "hasCreditAllowance": true,
        "creditAllowanceAmount": 10000,
        "creditAllowanceRenewal": "monthly"
      }
    ]
  }'

Creating an Enterprise Plan

curl -X POST https://api.getlumen.dev/v1/plans \
  -H "Content-Type: application/json" \
  -d '{
    "planName": "Enterprise Plan",
    "planDescription": "Custom solutions for large organizations",
    "isEnterprisePlan": true,
    "enterpriseButtonText": "Contact Sales",
    "enterpriseRedirectUrl": "https://example.com/contact",
    "showInPricingTable": true,
    "featureIds": ["feature_1", "feature_2", "feature_3"]
  }'

Updating a Plan

curl -X POST https://api.getlumen.dev/v1/plans/plan_123 \
  -H "Content-Type: application/json" \
  -d '{
    "planName": "Updated Basic Plan",
    "planDescription": "Enhanced basic plan with more features",
    "featureIds": ["feature_1", "feature_2", "feature_3"],
    "commitMessage": "Added additional features to basic plan"
  }'

Error Responses

All endpoints may return these error responses:

400 Bad Request

{
  "error": "One or more feature IDs are invalid or do not belong to this merchant"
}

404 Not Found

{
  "error": "Plan not found or access denied"
}

500 Internal Server Error

{
  "error": "Failed to create plan"
}
{
  "error": "Failed to process plan migration"
}

Important Notes

Plan Versioning

  • Plans support versioning for tracking changes over time
  • Each update creates a new version with an incremented versionNumber
  • The stablePlanId remains constant across versions
  • Use commitMessage to document changes between versions

Pricing Integration

  • Plans can automatically integrate with pricing tables
  • Set showInPricingTable: true to add to the default pricing table
  • Plans are ordered by price (lowest to highest) in pricing tables
  • Enterprise plans appear last regardless of pricing

Feature Management

  • Features can be created inline with newFeatures or referenced by ID with featureIds
  • Usage-based features support automatic credit allowances
  • Credit allowances can renew monthly, yearly, or be one-time grants

Currency Handling

  • Prices are specified in cents (e.g., 2900 = $29.00)
  • Currency defaults to merchant's default currency if not specified
  • Both monthly and yearly pricing can be configured

Enterprise Plans

  • Enterprise plans don't require pricing configuration
  • They can have custom button text and redirect URLs
  • Useful for custom pricing or sales-driven processes