Save a starting structure as a template
Code Mode: praxis.studio.templates.create
HTTP: POST /studio/v1/templates
Save a unit tree as a reusable template for one genre, so the same structure can seed later drafts. Give the genre, a name, the outline of units with their intents, and optionally the writing guidance a writer should follow. Creating a template from an existing draft is a separate milestone and answers NOT_IMPLEMENTED, so build the outline here instead.
Signature
praxis.studio.templates.create(args:{body:{/** Genre the template belongs to; a draft of another genre cannot use it. e.g. "novel_long" */ genre:string;/** Name of the template, shown where a draft chooses its starting structure. e.g. "双线民国长篇" */ name:string;/** Writing guidance that reaches the first context pack of a draft created from this template. e.g. "明线写排字房,暗线写通缉令的来历,两条线在第三章交汇。" */ guide?:string;/** Unit tree the template creates, in draft order, with children nested inside their parent. */ outline:Array<{/** Unit kind from the genre, which must be allowed at that position of the tree. e.g. "chapter" */ kind?:string;/** Structure name of the created unit, used for management rather than as a rendition heading. e.g. "第一章 · 排字房" */ name:string;/** Heading the finished piece shows for the created unit; leave it out when the structure name should stay out of the output. e.g. "第一章 排字房" */ heading?:string;/** Starting synopsis of the unit intent, describing what that part has to accomplish. e.g. "主角在排字房看到通缉令,第一次动摇。" */ synopsis?:string;/** Starting intent points for the created unit, called beats, arguments or selling points depending on the genre. */ points?:Array<string>;/** Nodes created beneath this unit, in the order they appear in the draft. */ children?:Array<unknown>}>}}):Promise<{/** Template id for a saved template, or the built-in key when builtin is true. e.g. "three-act" */ id?:string;/** Genre key whose drafts this template may seed; a template of another genre is refused. e.g. "novel_long" */ genre?:string;/** Display name of the template, shown where a draft chooses its starting structure. e.g. "三幕式" */ name?:string;/** Writing guidance the template adds to the first context pack of the draft it seeded. e.g. "第一幕建立人物与目标,第二幕升级阻碍,第三幕兑现冲突。" */ guide?:string;/** Starting node tree in draft order, each node naming the unit kind and intent it creates. */ outline?:Array<{/** Unit kind key from the genre, which must be allowed at that position of the tree. e.g. "chapter" */ kind?:string;/** Structure name for the created unit, used for management rather than as a rendition heading. e.g. "第一幕 · 建立" */ name?:string;/** Starting synopsis of the unit intent, describing what this part has to accomplish. e.g. "主角的日常被打破,目标浮出水面。" */ synopsis?:string;/** Starting intent points for the unit, called beats, arguments or selling points depending on the genre. */ points?:Array<string>;/** Nested nodes created beneath this unit, in the order they appear in the draft. */ children?:Array<unknown>}>;/** Whether this template ships with the genre instead of being saved from a work; built-in ones cannot be deleted. */ builtin?:boolean}>;Request body
| Required | Content types | Description |
|---|---|---|
| yes | application/json | The template to save: its genre, its name, its outline and the writing guidance that goes with it. |
Responses
| Status | Content types | Description |
|---|---|---|
| 201 | application/json | The saved template with its outline; keep its identifier to pass when creating a draft. |
| 400 | application/json | INVALID_PARAMS means a field is missing, malformed or not allowed for this resource; correct the named field and repeat the call. |
| 401 | application/json | The API key is missing, invalid or carries no organization; send a valid organization key in the Authorization header. |
| 404 | application/json | GENRE_NOT_FOUND means the key names no genre in the catalog; read the genre list and pass one of its keys exactly. |
| 500 | application/json | INTERNAL means the request could not complete; re-read the resource before retrying a write, because the write may already have landed. |