Skip to main content

Update Plan (v1)

Update a subscription plan.

Method & Path

PATCH /v1/admin/plans/:planId

Description

Updates an existing subscription plan. At least one field must be provided.

Authentication

Required: Admin authentication with plans.manage permission.

Path Parameters

ParameterTypeRequiredDescription
planIdstringYesThe plan ID

Request Body

At least one field must be provided. All fields are optional.

{
"name": "Updated Pro Plan",
"slug": "updated-pro-plan",
"description": "Updated description",
"isActive": true,
"sortOrder": 2,
"trialPeriodDays": 30,
"pricePeriods": [
{
"period": "monthly",
"amountCents": 14900,
"currencyCode": "USD"
},
{
"period": "annual",
"amountCents": 149000,
"currencyCode": "USD"
}
],
"features": [
{
"key": "new-feature",
"translations": [
{
"locale": "en",
"label": "New Feature",
"description": "Description of new feature"
}
]
}
],
"flags": [
{
"key": "max-staff",
"value": "100"
}
],
"translations": [
{
"locale": "en",
"name": "Updated Pro Plan",
"description": "Updated description"
}
]
}

Request Body Fields

All fields are optional, but at least one must be provided:

FieldTypeDescription
namestringPlan name (1-120 characters)
slugstringUnique plan identifier (2-50 characters)
descriptionstring|nullPlan description (max 500 characters, null to clear)
isActivebooleanWhether plan is active
sortOrdernumberSort order for display
trialPeriodDaysnumber|nullTrial period in days (null for no trial)
pricePeriodsarrayArray of price periods (minimum 1 if provided)
featuresarrayPlan features array (max 50)
flagsarrayPlan flags array (max 50)
translationsarrayLocalized plan information (minimum 1 if provided)

Note: When updating pricePeriods, all periods must be provided (cannot partially update). Each billing period can only be defined once.

Response 200 OK

{
"plan": {
"id": "507f1f77bcf86cd799439011",
"name": "Updated Pro Plan",
"slug": "updated-pro-plan",
"description": "Updated description",
"isActive": true,
"sortOrder": 2,
"trialPeriodDays": 30,
"pricePeriods": [
{
"period": "monthly",
"amountCents": 14900,
"currencyCode": "USD"
},
{
"period": "annual",
"amountCents": 149000,
"currencyCode": "USD"
}
],
"features": [
{
"key": "new-feature",
"translations": [
{
"locale": "en",
"label": "New Feature",
"description": "Description of new feature"
}
]
}
],
"flags": [
{
"key": "max-staff",
"value": "100"
}
],
"translations": [
{
"locale": "en",
"name": "Updated Pro Plan",
"description": "Updated description"
}
],
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-20T14:45:00.000Z"
}
}

Common Errors

  • 401 Unauthorized: Missing or invalid admin authentication token
  • 403 Forbidden: Insufficient permissions
  • 404 Not Found: Plan not found
  • 400 Bad Request: Invalid request body
  • 500 Internal Server Error: Server error