Create a rendition of a draft for a platform
Code Mode: praxis.studio.works.drafts.renditions.create
HTTP: POST /studio/v1/works/{work}/drafts/{draft}/renditions
Create a rendition: the form of one draft that a platform receives, such as a Xiaohongshu card set, a DOCX file or a Markdown file. Read the platform first with the platform call and pass its versioned key; pass a theme only to override the platform’s default layout. Pass render true to render in the same call and read render_state and issues in the answer; without it the rendition starts as pending and the render call produces it. Rendering a Xiaohongshu card set is billed by Browser Rendering time (meter browser_ms, product studio-render); DOCX and Markdown renditions are not billed. A draft with no body renders as invalid with a draft_empty issue, and an unavailable render service leaves render_state failed with a render_unavailable issue, so repeat the render call later. Send a request_id to make a repeated call return the first rendition instead of creating another. Next, publish the rendition to export it.
签名
praxis.studio.works.drafts.renditions.create(args:{path:{/** e.g. "wu-gang" */ work:string;/** e.g. "novel" */ draft:string};body:{/** Versioned platform key from the platform list. e.g. "xiaohongshu@1" */ platform:string;/** Theme to render with, a thm_ identifier or a built-in key from the theme list; omit it to use the platform default. e.g. "warm-card" */ theme?:string;settings?:{/** Whether external links become footnotes at the end of the article, for platforms that do not allow links in the text. e.g. true */ footnote_links?:boolean;/** How the posts of a thread are numbered. e.g. "n/m" */ thread_numbering?:"none"|"n/"|"n/m";/** How a card rendition arranges its text cards and photos. */ cards?:{/** Order of text cards and photos. e.g. "text_then_photos" */ layout:"text_then_photos"|"interleave"|"photos_only";/** Name of the draft property whose image becomes the cover card. e.g. "images" */ cover_from_prop?:string};/** For a book format, the chapters to include. */ chapter_range?:{/** First chapter number to include. e.g. 1 */ from:number;/** Last chapter number to include. e.g. 10 */ to:number}};/** Whether to render in the same call. e.g. true */ render?:boolean;/** Caller-chosen key that makes a repeated create return the first rendition instead of making another; use a new value for each distinct rendition. e.g. "xhs-note-1" */ request_id?:string}}):Promise<{/** Rendition identifier, the value the rendition path segment takes. e.g. "rnd_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** Resource kind marker, always studio.rendition for this shape. e.g. "studio.rendition" */ object:string;/** Creation time in RFC 3339 UTC. e.g. "2026-11-06T09:20:11Z" */ create_time?:string;/** Time of the last change to this rendition in RFC 3339 UTC. e.g. "2026-11-06T09:21:40Z" */ update_time?:string;/** Console address of this rendition, which opens the work page on it. e.g. "https://console.deepraxis.com/studio/wu-gang?draft=xiaohongshu" */ viewer_url?:string;/** Identifier of the work this rendition belongs to. e.g. "wk_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ work:string;/** Identifier of the draft this rendition is built from. e.g. "drf_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ draft:string;/** Versioned platform key the rendition is for, such as xiaohongshu@1, docx@1 or markdown@1. e.g. "xiaohongshu@1" */ platform:string;/** File format the platform receives, decided by the platform. e.g. "card_png" */ format:"markdown"|"text"|"docx"|"inline_html"|"card_png"|"post_text"|"thread"|"lexical_html"|"epub"|"video_meta";/** Theme the rendition uses, a thm_ identifier or a built-in theme key; null means the platform default. e.g. "warm-card" */ theme?:string|null;settings?:{/** Whether external links become footnotes at the end of the article, for platforms that do not allow links in the text. e.g. true */ footnote_links?:boolean;/** How the posts of a thread are numbered. e.g. "n/m" */ thread_numbering?:"none"|"n/"|"n/m";/** How a card rendition arranges its text cards and photos. */ cards?:{/** Order of text cards and photos. e.g. "text_then_photos" */ layout:"text_then_photos"|"interleave"|"photos_only";/** Name of the draft property whose image becomes the cover card. e.g. "images" */ cover_from_prop?:string};/** For a book format, the chapters to include. */ chapter_range?:{/** First chapter number to include. e.g. 1 */ from:number;/** Last chapter number to include. e.g. 10 */ to:number}};/** Content revision of the draft this rendition was last rendered from; compared with the draft to derive stale. e.g. 14 */ source_revision:number;/** True when the draft has changed past source_revision. e.g. false */ stale:boolean;/** Where the render stands. e.g. "rendered" */ render_state:"pending"|"rendering"|"rendered"|"invalid"|"failed";/** Findings of the last render, errors and warnings; empty when there are none. */ issues:Array<{/** Whether the finding blocks export. e.g. "warning" */ severity:"error"|"warning";/** Stable machine code such as draft_empty, heading_missing or render_unavailable; branch on this value, never on the message text. e.g. "heading_missing" */ code:string;/** Human-readable explanation of what was found, written to be shown as is. e.g. "The note has no title" */ message:string;/** Identifier of the unit the finding is about, when it is about one unit. e.g. "unt_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ unit?:string;/** Identifier of the block inside that unit the finding is about, when it is about one block. e.g. "blk_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ block?:string;/** A suggested repair when the check knows one. e.g. "Add a title to the first unit" */ suggestion?:string}>;/** The parts of the rendition in order: card pages and a final copy part for a card rendition. */ parts:Array<{/** Position of this part in the rendition; pass it as the part query of the content operation. e.g. 0 */ index:number;/** Identifiers of the units this part was built from. */ units:Array<string>;/** Text of this part when it carries text, such as the copy part of a card rendition, whose text starts with the note title. e.g. "初夏通勤包,我只背这一个" */ text?:string;/** Identifiers of the files rendered for this part, such as one card PNG of 1080 by 1440 pixels; empty for a text-only part. */ files:Array<string>;/** Identifier of the post on the platform, present only after the part was published to an account; always null for an export. */ remote_id?:string|null;/** Link of the post on the platform, present only after the part was published to an account; always null for an export. */ remote_url?:string|null;/** Where this part is in publishing; an exported part stays pending because nothing was sent to an account. e.g. "pending" */ publish_state:"pending"|"sending"|"sent"|"failed"|"uncertain";/** Why this part failed, present only when publish_state is failed. */ error?:{/** Stable machine code of the failure. e.g. "PLATFORM_REJECTED" */ code:string;/** Human-readable explanation of the failure. e.g. "The platform rejected the post" */ message:string};/** Hash of the content of this part, used to recognise a part that was already sent. e.g. "9f2c6a1b" */ content_hash?:string}>;/** Identifiers of the whole-rendition files, such as the DOCX, or the ZIP a card rendition gains when exported. */ files:Array<string>;/** Source images already uploaded to a platform, keyed by file identifier; empty for an export. */ assets?:{[key:string]:{/** Media identifier or address on the platform. e.g. "media_123" */ remote?:string;/** Kind of media on the platform, such as image. e.g. "image" */ kind?:string;/** Upload time in RFC 3339 UTC. e.g. "2026-11-06T09:30:00Z" */ upload_time?:string}};/** How closely the Console preview matches what the platform shows. e.g. "approximate" */ preview_fidelity?:"exact"|"approximate"|"none";/** Export and publish state, kept apart from the render state. */ publish:{/** How this platform receives the rendition. e.g. "export" */ method:"api"|"draft_box"|"export";/** Where export or publishing stands; every rendition starts at none and an export ends at exported. e.g. "exported" */ state:"none"|"scheduled"|"exporting"|"exported"|"drafting"|"drafted"|"publishing"|"published"|"partial"|"failed"|"blocked_auth"|"cancelled";/** Channel account used for publishing; null for an export. */ channel?:string|null;/** Scheduled publish time in RFC 3339 UTC; null for an export. */ scheduled_time?:string|null;/** Time until which a running render or export holds the rendition; a second render or export before then answers REVISION_CONFLICT. */ lease_until?:string|null;/** When the export or publish finished in RFC 3339 UTC; null until then. e.g. "2026-11-06T09:31:12Z" */ publish_time?:string|null;/** Who ran the export or publish; null until then. */ by?:({/** 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});/** Findings of the checks run before publishing, such as channel authorization. */ preflight?:Array<{/** Whether the finding blocks export. e.g. "warning" */ severity:"error"|"warning";/** Stable machine code such as draft_empty, heading_missing or render_unavailable; branch on this value, never on the message text. e.g. "heading_missing" */ code:string;/** Human-readable explanation of what was found, written to be shown as is. e.g. "The note has no title" */ message:string;/** Identifier of the unit the finding is about, when it is about one unit. e.g. "unt_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ unit?:string;/** Identifier of the block inside that unit the finding is about, when it is about one block. e.g. "blk_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ block?:string;/** A suggested repair when the check knows one. e.g. "Add a title to the first unit" */ suggestion?:string}>}}>;参数
| 名称 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
| work | path | string | 是 | 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. |
| draft | path | string | 是 | Draft being addressed, either its in-work key such as novel or its drf_ identifier; a key renamed earlier still resolves through its previous value. |
请求体
| 必填 | 内容类型 | 说明 |
|---|---|---|
| 是 | application/json | The rendition to create: its platform, and optionally a theme, settings, whether to render at once and a request id. |
响应
| 状态码 | 内容类型 | 说明 |
|---|---|---|
| 201 | application/json | The new rendition. With render true it already carries render_state, issues, parts and files; otherwise render_state is pending. |
| 400 | application/json | INVALID_PARAMS means a field is missing, malformed or not allowed; correct the named field and repeat the call. PLATFORM_NOT_AVAILABLE means the platform cannot be used yet, for example publishing to an account: choose an export platform such as markdown@1, docx@1 or xiaohongshu@1, or export the rendition instead of publishing it. |
| 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 | WORK_NOT_FOUND, DRAFT_NOT_FOUND, PLATFORM_NOT_FOUND or THEME_NOT_FOUND means the work, the draft, the platform key or the theme is not reachable; use the slug and draft key from the lists, a versioned platform key from the platform list and a theme from the theme list. |
| 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. |