# Plans

## Create Plan from Template

> Create a new plan from a template, associated with a deal. Requires the 'plans:write' scope.

```json
{"openapi":"3.0.1","info":{"title":"Opine API","version":"1.0.0"},"servers":[{"url":"https://api.tryopine.com","description":"Production server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key","description":"API key for authentication"}},"schemas":{"CreatePlanRequestBody":{"type":"object","properties":{"templateId":{"description":"The template's public ID (UUID) to create the plan from","type":"string"},"dealId":{"description":"The deal to associate with the plan — internal ID (number) or public ID (UUID)","anyOf":[{"type":"number"},{"type":"string"}]},"title":{"description":"Optional title override — uses template title if not provided","type":"string"}},"required":["templateId","dealId"]},"CreatePlan201ResponseBody":{"type":"object","properties":{"id":{"description":"The plan's unique identifier (UUID)","type":"string"},"title":{"type":"string"},"description":{"nullable":true,"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"startDate":{"nullable":true,"type":"string","format":"date-time"},"targetEndDate":{"nullable":true,"type":"string","format":"date-time"},"dealId":{"description":"The deal's public ID (UUID)","nullable":true,"type":"string"},"templateId":{"description":"The template's public ID this plan was created from","nullable":true,"type":"string"}},"required":["id","title","description","createdAt","updatedAt","startDate","targetEndDate","dealId","templateId"],"additionalProperties":false},"ErrorMessage":{"type":"object","properties":{"message":{"type":"string"}},"additionalProperties":false}}},"paths":{"/v1/plans":{"post":{"operationId":"createPlan","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePlanRequestBody"}}}},"responses":{"201":{"description":"Response for status 201","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePlan201ResponseBody"}}}},"500":{"description":"An unknown error occurred, trying again might help.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}}},"summary":"Create Plan from Template","description":"Create a new plan from a template, associated with a deal. Requires the 'plans:write' scope.","tags":["plans"]}}}}
```
