跳转到内容
EN

Create a rendition theme

Code Mode: praxis.studio.themes.create

HTTP: POST /studio/v1/themes

Create a theme for one platform: the HTML and CSS a written piece is rendered into, plus the fixed header and footer every rendition carries. A DOCX platform takes a reference document instead of markup, and a card theme takes its aspect, width and fonts. An agent may write a theme here, which is how a new layout appears without a release.

签名

praxis.studio.themes.create(args:{body:{/** Versioned platform key this theme renders for, taken from the platform list. e.g. "wechat_mp@1" */ platform:string;/** Name of the theme, shown wherever a rendition chooses its layout. e.g. "素雅正文" */ name:string;/** HTML template with a small mustache-like subset over the title, the units and the pages; give it for a markup platform. e.g. "<article><h1>{{title}}</h1>{{#units}}<section>{{{markdown}}}</section>{{/units}}</article>" */ html?:string;/** Stylesheet applied to the markup, folded inline for a platform that requires inline styles. e.g. "article{font-size:16px;line-height:1.75;}" */ css?:string;/** Reference document giving a DOCX rendition its styles, by file identifier; give it instead of markup for a word-processor platform. e.g. "file_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ reference_docx?:string;/** Fragment placed at the top of every rendition this theme produces. e.g. "乌江连载" */ header?:string;/** Fragment placed at the bottom of every rendition this theme produces. e.g. "关注「乌江日报」追更" */ footer?:string;card?:{/** Proportions of each card page, which the platform's image requirements decide. e.g. "3:4" */ aspect:"3:4"|"1:1"|"4:5";/** Width the card is rendered at in pixels before any platform-side scaling, chosen above the platform minimum. e.g. 1080 */ width_px:number;/** Font families the card expects; a font that is not available is reported rather than silently substituted. */ fonts:Array<string>}}}):Promise<{/** Theme identifier for an organization's own theme, or the built-in key when builtin is true. e.g. "thm_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** Resource kind marker, always studio.theme for this shape. e.g. "studio.theme" */ object:string;/** Creation time in RFC 3339 UTC. e.g. "2026-11-04T09:44:10Z" */ create_time?:string;/** Time of the last change to this theme in RFC 3339 UTC. e.g. "2026-11-04T10:20:33Z" */ update_time?:string;/** Versioned platform key this theme renders for; a theme of another platform cannot produce that platform's rendition. e.g. "wechat_mp@1" */ platform:string;/** Name of the theme, shown where a rendition chooses its layout. e.g. "素雅正文" */ name:string;/** Version of this theme, advanced by each change; a rendition records the version it was built with, so a later edit does not rewrite it. e.g. 3 */ version:number;/** HTML template the rendition is built from, using a small mustache-like subset over the title, the units and the pages; absent for a DOCX or card theme. e.g. "<article><h1>{{title}}</h1>{{#units}}<section>{{{markdown}}}</section>{{/units}}</article>" */ html?:string;/** Stylesheet applied to the HTML and, for a platform that inlines styles, folded into the markup before publishing. e.g. "article{font-size:16px;line-height:1.75;}" */ css?:string;/** Reference document that gives a DOCX rendition its styles, referenced by its file identifier; present instead of the markup for a word-processor platform. e.g. "file_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ reference_docx?:string;/** Fragment placed at the top of every rendition, such as a publication name; it is fixed across the whole output. e.g. "乌江连载" */ header?:string;/** Fragment placed at the bottom of every rendition, such as a follow prompt; it is fixed across the whole output. e.g. "关注「乌江日报」追更" */ footer?:string;card?:{/** Proportions of each card page, which the platform's image requirements decide. e.g. "3:4" */ aspect:"3:4"|"1:1"|"4:5";/** Width the card is rendered at in pixels before any platform-side scaling, chosen above the platform minimum. e.g. 1080 */ width_px:number;/** Font families the card expects; a font that is not available is reported rather than silently substituted. */ fonts:Array<string>};/** Whether this theme ships with the platform instead of being created here; a built-in theme cannot be changed or deleted. e.g. false */ builtin:boolean}>;

请求体

必填内容类型说明
是application/jsonThe theme to create: its platform and name, and the markup, reference document or card settings that platform renders with.

响应

状态码内容类型说明
201application/jsonThe new theme with its version; keep its identifier to pass when creating a rendition.
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/jsonPLATFORM_NOT_FOUND means the key names no platform, or the version suffix is missing; read the platform list and pass one of its versioned keys.
500application/jsonINTERNAL means the request could not complete; re-read the resource before retrying a write, because the write may already have landed.