import Stigg from '@stigg/typescript';
const client = new Stigg({
apiKey: process.env['STIGG_API_KEY'], // This is the default and can be omitted
});
const plan = await client.v1.plans.createDraft('x');
console.log(plan.data);{
"data": {
"id": "plan-professional",
"displayName": "Professional",
"description": "Professional plan with advanced features",
"productId": "product-starter",
"status": "PUBLISHED",
"pricingType": "PAID",
"billingId": "price_1234567890",
"versionNumber": 1,
"isLatest": true,
"entitlements": [
{
"type": "FEATURE",
"id": "feature-advanced-analytics"
},
{
"type": "CREDIT",
"id": "api-calls"
}
],
"metadata": {},
"createdAt": "2025-12-29T00:10:51.935Z",
"updatedAt": "2026-12-24T00:12:33.634Z",
"parentPlanId": null,
"defaultTrialConfig": {
"duration": 14,
"units": "DAY",
"budget": null,
"trialEndBehavior": null
},
"compatibleAddonIds": []
}
}Creates a draft version of an existing plan for modification before publishing.
import Stigg from '@stigg/typescript';
const client = new Stigg({
apiKey: process.env['STIGG_API_KEY'], // This is the default and can be omitted
});
const plan = await client.v1.plans.createDraft('x');
console.log(plan.data);{
"data": {
"id": "plan-professional",
"displayName": "Professional",
"description": "Professional plan with advanced features",
"productId": "product-starter",
"status": "PUBLISHED",
"pricingType": "PAID",
"billingId": "price_1234567890",
"versionNumber": 1,
"isLatest": true,
"entitlements": [
{
"type": "FEATURE",
"id": "feature-advanced-analytics"
},
{
"type": "CREDIT",
"id": "api-calls"
}
],
"metadata": {},
"createdAt": "2025-12-29T00:10:51.935Z",
"updatedAt": "2026-12-24T00:12:33.634Z",
"parentPlanId": null,
"defaultTrialConfig": {
"duration": 14,
"units": "DAY",
"budget": null,
"trialEndBehavior": null
},
"compatibleAddonIds": []
}
}