createPlan
createPlanCreate a reusable contract template with phased pricing. Define name, schedule, and phases with per-phase currency and pricing.
Instructions
Create a new plan — a reusable contract template with phased pricing. Hits POST /plans (same Plan table the Zenskar app's PlansV2 page reads). The request body shape is NESTED, not flat: top-level fields are name, status, schedule, optional description, optional phases[]. Currency is set per-pricing inside phase.pricings[].pricing.pricing_data.currency, NOT at the top level. A plan with no phases is unusable in the UI — always include at least one phase. Plan starts as 'draft'; the user must publish it to make it active.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the plan (required). | |
| status | Yes | Plan status (required). Valid values: 'draft', 'active', 'archived'. New plans almost always start as 'draft' — the user publishes via the UI to activate. | |
| schedule | Yes | Plan-level schedule (required). Object: {duration: ISO-8601 e.g. 'P1Y'|'P1M', start_offset?: ISO-8601 e.g. 'P0D', trigger_type?: 'time_based'}. Example: {"duration":"P1Y","start_offset":"P0D"}. | |
| description | No | Optional plan description. | |
| phases | Yes | Array of plan phases (REQUIRED — must be non-empty). Each phase: {name: string (required), schedule: {duration, start_offset?, trigger_type?} (required), order: int (required, 0-indexed), description?: string, features?: CreateProductPricingRequestSchema (one-off phase-level pricing/features), pricings?: [{schedule, pricing_id?, product_id?, pricing?: CreateProductPricingRequestSchema, product?: CreateProductRequestSchema}] (per-product pricings)}. Each phase must have features OR a non-empty pricings array. Minimal example: [{"name":"Phase 1","schedule":{"duration":"P1Y"},"order":0,"features":{"pricing_data":{"pricing_type":"features","currency":"USD"}}}]. | |
| __userContext | No | Internal user context for multi-tenant authentication and approval workflow |