Skip to main content

Create Plan (v1)

Create a new subscription plan.

Method & Path

POST /v1/admin/plans

Description

Creates a new subscription plan with specified features and pricing.

Authentication

Required: Admin authentication with plans.manage permission.

Request Body

{
"name": "Pro Plan",
"slug": "pro-plan",
"description": "Professional plan with advanced features",
"isActive": true,
"sortOrder": 1,
"trialPeriodDays": 14,
"pricePeriods": [
{
"period": "monthly",
"amountCents": 9900,
"currencyCode": "USD"
},
{
"period": "quarterly",
"amountCents": 27000,
"currencyCode": "USD"
},
{
"period": "annual",
"amountCents": 99000,
"currencyCode": "USD"
}
],
"features": [
{
"key": "unlimited-clients",
"translations": [
{
"locale": "en",
"label": "Unlimited Clients",
"description": "Add as many clients as you need"
}
]
}
],
"flags": [],
"translations": [
{
"locale": "en",
"name": "Pro Plan",
"description": "Professional plan with advanced features"
}
]
}

Request Body Fields

FieldTypeRequiredDescription
namestringYesPlan name (1-120 characters)
slugstringYesUnique plan identifier (2-50 characters, lowercase, alphanumeric with hyphens)
descriptionstringNoPlan description (max 500 characters)
isActivebooleanNoWhether plan is active (default: true)
sortOrdernumberNoSort order for display (default: 0)
trialPeriodDaysnumber|nullNoTrial period in days (0 or more, null for no trial)
pricePeriodsarrayYesArray of price periods (minimum 1 required)
pricePeriods[].periodenumYesBilling period: "monthly", "quarterly", "semiannual", or "annual"
pricePeriods[].amountCentsnumberYesPrice in cents (0 to 1,000,000,000)
pricePeriods[].currencyCodestringYesISO 4217 currency code (3 uppercase letters, e.g., "USD", "ILS", "JOD", "EUR")
featuresarrayNoPlan features array (max 50)
flagsarrayNoPlan flags array (max 50)
translationsarrayYesLocalized plan names and descriptions (minimum 1 required)

Note: Each billing period can only be defined once per plan. All periods must have the same currency code.

Response 201 Created

{
"plan": {
"id": "507f1f77bcf86cd799439011",
"name": "Pro Plan",
"slug": "pro-plan",
"description": "Professional plan with advanced features",
"isActive": true,
"sortOrder": 1,
"trialPeriodDays": 14,
"pricePeriods": [
{
"period": "monthly",
"amountCents": 9900,
"currencyCode": "USD"
},
{
"period": "quarterly",
"amountCents": 27000,
"currencyCode": "USD"
},
{
"period": "annual",
"amountCents": 99000,
"currencyCode": "USD"
}
],
"features": [
{
"key": "unlimited-clients",
"translations": [
{
"locale": "en",
"label": "Unlimited Clients",
"description": "Add as many clients as you need"
}
]
}
],
"flags": [],
"translations": [
{
"locale": "en",
"name": "Pro Plan",
"description": "Professional plan with advanced features"
}
],
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z"
}
}

Common Errors

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