跳转到内容
EN

Create a draft of a genre inside a work

Code Mode: praxis.studio.works.drafts.create

HTTP: POST /studio/v1/works/{work}/drafts

Create a draft: one way of delivering the work, written in one genre. The genre decides the unit kinds, the properties and the checks, so read it first with the genre call and pass its key. A template may seed the unit tree, an outline may be given instead, and derived_from records that this draft is built from the goal message or from another draft of the work. The work may hold several drafts, one per platform or per length.

签名

praxis.studio.works.drafts.create(args:{path:{/** e.g. "wu-gang" */ work:string};body:{/** Genre key the draft is written in, taken from the genre list; it decides the unit kinds, the properties and the checks. e.g. "novel_long" */ genre:string;/** Short name of the draft inside the work, used in every later path in place of its id; omit it and the genre gives one (novel, xiaohongshu, a numbered one when t pattern: ^[a-z0-9][a-z0-9-]{0,40}$ e.g. "xiaohongshu" */ key?:string;/** Page title of the new draft; omit it and one is derived from the genre and the work title. e.g. "乌江 · 长篇小说" */ title?:string;/** Structure mode to create the draft in; omit it and the genre default applies, which is skeleton for most genres. e.g. "skeleton" */ mode?:"skeleton"|"space";/** Template to seed the unit tree from, by template identifier or built-in key; when an outline is also given, the outline wins because the person's own structure e.g. "novel_three_act" */ template?:string;/** Unit tree to create the draft with, given by the caller instead of a template; children nest, and a unit without a kind takes the genre default for its position */ outline?:Array<{/** Structural kind of this unit, which must be one the genre allows at this position; omitted takes the genre default. e.g. "chapter" */ kind?:string;/** Structure name for people and agents to manage the tree by, such as 第二章 · 排字房; it is not the published heading. e.g. "第二章 · 排字房" */ name:string;/** Heading the finished piece shows for this unit, when the genre wants one and the structure name is not the right wording. e.g. "第二章 排字房" */ heading?:string;/** What this unit has to accomplish, written as the story so far for the units after it. e.g. "主角在排字房看到通缉令。" */ synopsis?:string;/** Points this unit hits, called beats, arguments or selling points depending on the genre. */ points?:Array<string>;/** Keys of the brief points this unit claims, which is how the coverage check knows the requirement will land here. */ brief_points?:Array<string>;/** Units nested under this one, in order; depth is limited by the genre, which refuses a kind that cannot sit here. */ children?:Array<unknown>}>;derived_from?:{/** What to derive from: the goal message of this work, or another draft of the same work. e.g. "message" */ kind:"message"|"draft";/** Source draft, by key or identifier, present only when the kind is draft. e.g. "novel" */ draft?:string};brief?:{/** The requirement in the person's own words, stored unchanged and handed to the writer in the context pack. e.g. "写一部民国背景的长篇,主角是报社排字工。" */ text?:string;/** Source files to keep with the brief, referenced by file identifiers from the file service. */ attachments?:Array<string>;/** Limits this draft is written under, one per line, such as a length (3000 字以内) or banned wording; the length check reads it. e.g. "全文 3000 字以内" */ constraints?:string;/** Requirements split out of the text, one string per point; splitting is the caller's job because software cannot read intent. */ points?:Array<string>};/** Initial values for the genre properties, keyed by property key; a value the genre does not define is refused rather than stored. e.g. {"title":"乌江"} */ props?:{[key:string]:unknown};/** Caller-chosen key that makes this create safe to repeat: the same value answers the first draft instead of creating a second one. e.g. "req_9c1f42" */ request_id?:string}}):Promise<({/** Draft identifier, stable when its in-work key is renamed. e.g. "drf_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** Resource kind marker, always studio.draft for this shape. e.g. "studio.draft" */ object:string;/** Creation time in RFC 3339 UTC. e.g. "2026-11-04T09:20:11Z" */ create_time?:string;/** Time of the last change to this draft in RFC 3339 UTC. e.g. "2026-11-04T10:44:52Z" */ update_time?:string;/** Console address of this draft, which opens the work page with the draft already selected. e.g. "https://console.deepraxis.com/studio/wu-gang?draft=novel" */ viewer_url:string;/** Work this draft belongs to; drafts never move between works. e.g. "wk_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ work:string;/** In-work key of this draft, such as novel or xiaohongshu; it is the value the draft path segment takes. e.g. "novel" */ key:string;brief:{/** The requirement exactly as the person gave it, never rewritten by software; it is handed to the writer in the context pack. e.g. "写一部民国背景的长篇,主角是报社排字工。" */ text?:string;/** Files the person attached as source material, referenced by their file identifiers. */ attachments?:Array<string>;/** Requirements split out of the brief, each with a stable key. */ points?:Array<{/** Stable key of the point inside this draft, assigned in order as p1, p2 and so on, so an outline in the same drafts create call can claim p1 and p2; keys are nev e.g. "p1" */ key:string;/** The requirement itself, short enough to be claimed by one unit and specific enough to be checked. e.g. "主角是报社排字工" */ text:string;/** unit (the default) is a requirement that must land in some unit: a plot beat, a selling point, a fact the piece has to state; a unit claims it and the coverage e.g. "unit" */ scope?:"unit"|"work"}>;/** Limits this draft is written under, one per line: a length such as 3000 字以内 or 2000 字左右, banned wording, a deadline. e.g. "全文 3000 字以内,不写血腥场面" */ constraints?:string;/** Brief revision, independent of the draft's own revision; pass it as expected_revision when changing the brief. e.g. 2 */ revision?:number};/** Genre this draft was created with, which decides the kinds, properties, checks and writing rules it obeys. e.g. "novel_long" */ genre:string;/** Genre configuration version this draft was created under, kept so later rule changes stay visible rather than silently applying. e.g. 1 */ genre_version:number;/** How much structure this draft requires: a skeleton draft needs an outline before writing, a space draft only enforces what publishing needs. */ mode:"skeleton"|"space";/** Page title of the draft, such as a platform note with its campaign name; the published title is a property instead. e.g. "乌江 · 长篇小说" */ title:string;/** Draft properties as the genre defines them, such as title, topics or an SEO description; the keys are the genre's own property keys, and a list-valued property e.g. {"title":"乌江","topics":["民国","长篇"]} */ props:{[key:string]:unknown};derived_from?:{/** What the draft was derived from: the goal message of the work, or another draft of the same work. */ kind:"message"|"draft";/** Identifier of the source draft, present only when the kind is draft. e.g. "drf_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ draft?:string;/** Source revision this draft was built on; when the source moves past it, stale becomes true until a rebase confirms the catch-up. e.g. 96 */ revision:number};/** Template that seeded this draft, recorded for reference only; changing the template later does not rewrite the draft. e.g. "tmpl_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ template?:string;/** Style attached to this draft, which overrides the work style for it; null means it inherits the work style. e.g. "sty_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ style?:string;/** Draft structure and property revision; pass it as expected_revision when changing the draft itself or its units in bulk. e.g. 9 */ revision:number;/** Content revision of this draft, moved by any unit or property write; renditions and drafts derived from it compare against it. e.g. 96 */ content_revision:number;/** Keys this draft answered to before it was renamed, kept so an old link or an old reference still resolves. */ previous_keys:Array<string>;/** Whether what this draft derives from moved past the revision recorded here, which a rebase clears after the text is brought up to date. */ stale:boolean;/** Whether the thing this draft derives from is itself out of date; it is a note for the reader and does not make this draft stale. */ upstream_pending:boolean})&({/** Unit tree of this draft without bodies, in draft order, present when the unit expand was asked for. */ units?:Array<{/** Unit identifier, stable when units are moved or renamed. e.g. "unt_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** Work this unit belongs to; it is the same value the work path segment carries. e.g. "wk_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ work?:string;/** Draft this unit belongs to; units never move between drafts. e.g. "drf_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ draft?:string;/** In-work number assigned in creation order, never reused and unchanged by a move; it is what the unit path segment takes. e.g. 12 */ number:number;/** Unit this one sits under, or null at the top level of the tree. e.g. "unt_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ parent?:string;/** Sort key among siblings; it is opaque, and moving a unit rewrites only its own row. e.g. "0|hzzzzz:" */ position?:string;/** Structural kind of this unit, which must be one the genre allows at this position of the tree. e.g. "chapter" */ kind:string;/** Structure name used by people and agents to manage the tree, such as the second scene of a chapter; it is not the published heading. e.g. "第二章 · 排字房" */ name:string;/** Heading the finished piece shows for this unit, or null when it shows none; a genre may require it or forbid it. e.g. "第二章 排字房" */ heading?:string;intent:{/** What this unit has to accomplish, written as the story so far for later units; it is what a reader of the outline sees. e.g. "主角在排字房看到通缉令,第一次动摇了立场。" */ synopsis:string;/** Points this unit hits, called beats, arguments or selling points depending on the genre. */ points:Array<string>;/** Keys of the brief points this unit claims, which is how the requirement coverage check knows a point landed. */ brief_points:Array<string>;/** Intent revision, moved whenever the synopsis or the points change; a body written against an older value is behind. e.g. 4 */ revision:number;/** Whether the writer confirmed the synopsis matches what the body actually says, rather than what was planned. */ synopsis_from_body:boolean};/** How far this unit has come, moving forward as intent and body are written; a unit marked final refuses changes without confirmation. */ status:"idea"|"outlined"|"writing"|"drafted"|"revised"|"final";/** Intent revision the current body was written against, or null when there is no body; an older value means the intent moved on. e.g. 4 */ body_from_intent?:number;/** Unit of the upstream draft this one was written from, present when the draft derives from another; a serial of a novel records it per section. e.g. "unt_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ source_unit?:string;/** Reference entries this unit is tied to, including the mentions detected in its text. */ links?:Array<{/** Identifier of the reference entry this unit is tied to. e.g. "ent_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ entry?:string;/** How the tie came about, which decides whether the entry reaches the context pack for this unit. */ kind?:"mention"|"attached"|"excluded";/** Role of the entry inside this genre, such as point-of-view character or main product; it lifts the entry's priority in the pack. e.g. "视角人物" */ role?:string}>;/** Characters in the body with whitespace removed, which is what the length checks measure. e.g. 2680 */ chars:number;/** Duration in seconds for units of a video genre, or null for a written unit. e.g. 42 */ seconds?:number;/** Unit revision, moved by any change to the unit; pass it as expected_revision when writing the body. e.g. 6 */ revision:number;last_editor?:{/** Whether the change came from a person, an agent or the platform itself; an agent session through the API is recorded as an agent. */ kind?:"user"|"agent"|"system";/** Identifier of that actor, such as a user identifier or an agent session identifier. e.g. "usr_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id?:string;/** Display name of the actor when one is known, shown beside the change. e.g. "张三" */ label?:string};/** Body blocks, present only when the unit was read with its content; writing block by block needs their identifiers. */ blocks?:Array<{/** Block identifier, carried inline in Markdown as an anchor comment so an edit can address one block without rewriting the body. e.g. "blk_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** Unit revision at which this block was last changed; it decides whether an older precondition still allows a block edit. e.g. 6 */ revision:number;/** Element kind of this block, from the set the genre allows; it decides how the block is rendered in a rendition. */ type:"paragraph"|"heading"|"list"|"quote"|"code"|"image"|"video"|"divider"|"scene_break"|"callout"|"hashtags"|"link"|"cut"|"canvas";/** Markdown text of this block, empty for blocks that carry a reference instead of words. e.g. "排字房的铅字盘上,压着一张通缉令。" */ text:string;/** File this block shows, for image and video blocks, referenced by its file identifier. e.g. "file_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ file?:string;/** Caption shown with a media block and carried into renditions that keep captions. e.g. "1935 年的排字房" */ caption?:string;/** Heading depth for a heading block, one to four, which decides the outline level in the finished piece. e.g. 2 */ level?:number}>}>;status?:{/** Draft the todo list was computed for. e.g. "drf_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ draft:string;/** Content revision of the draft when the list was computed; a later write makes the list worth recomputing. e.g. 96 */ revision:number;/** Outstanding items in layer order, each naming the call that would resolve it. */ todos:Array<{/** What is outstanding, chosen from a closed set so a caller can branch on it instead of reading the text. */ kind:"goal_incomplete"|"brief_points_unplaced"|"no_structure"|"intent_missing"|"intent_ahead_of_body"|"body_missing"|"draft_stale"|"work_adaptation_stale"|"prop_missing"|"check_failed"|"review_unresolved"|"rendition_stale"|"rendition_missing"|"publish_blocked";/** Which of the seven layers this item belongs to, used to order the list; the layers are always in the same order. */ layer:"goal"|"frame"|"task"|"reference"|"body"|"coherence"|"rendition";/** Unit this item is about, present when the item points at one unit rather than the whole draft. e.g. "unt_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ unit?:string;/** In-work number of that unit, which is what the unit path segment of a call takes. e.g. 12 */ number?:number;/** The item in words, written to be shown to a person as is. e.g. "第 12 节还没有正文" */ text:string;/** For a check_failed item, the key of the failing check, so a program can act on it without parsing the text; a unit that already has an item for it gets no separ e.g. "body_total_chars" */ check?:string;/** Suggested next call for this item, offered as guidance rather than a fixed script. e.g. "praxis.studio.works.units.retrieveContext" */ call?:string}>;/** The same items rendered as a Markdown checklist, ready to hand to a writer or to paste into a plan. e.g. "- [ ] 第 12 节还没有正文" */ markdown:string}})>;

参数

名称位置类型必填说明
workpathstring是The work being addressed, either its organization-unique slug or its wk_ identifier; a slug case is what a person would say, and a renamed slug still resolves through its old value.

请求体

必填内容类型说明
是application/jsonThe draft to create: its genre, and optionally a title, a template, an outline and what it derives from.

响应

状态码内容类型说明
201application/jsonThe new draft with its unit tree, its properties and its revisions; keep the draft key for the calls inside it.
400application/jsonINVALID_PARAMS means a field is missing, malformed or not allowed for this resource; correct the named field and repeat the call.
401application/jsonThe API key is missing, invalid or carries no organization; send a valid organization key in the Authorization header.
404application/jsonWORK_NOT_FOUND or DRAFT_NOT_FOUND means the work or the draft inside it is not reachable; use the slug and the draft key from the lists, or resolve a loose name first. A draft renamed earlier still answers under its previous key.
409application/jsonDRAFT_KEY_TAKEN means another draft of this work already answers to that key; pick a different key or leave it out and let one be derived from the genre.
500application/jsonINTERNAL means the request could not complete; re-read the resource before retrying a write, because the write may already have landed.