Create ebook
create_ebookCreate a fully designed Unplain ebook from a title and Markdown content. Style it in the SAME call: 'brandThemeId' applies the user's saved identity (list_brand_themes), 'preset' applies one of Unplain's built-in looks, 'theme' sets individual colours, fonts and sizes, and they layer in that order, so one call can say "the Journal preset with an oxblood accent". Every new ebook is then designed automatically over that theme, free on every plan: its layout, a designed cover, contents page, chapter openers and feature pages. Send design 'none' to keep the plain layout. Call get_design_options first for the valid fonts, presets and ranges. 'cta' is the CTA page Unplain adds at the end: its layout, headline, body, button label, link and showButton switch (false, or an empty label, hides the button), social links and the footer credit switch, the same fields as the editor's CTA settings. A shown button needs a real url: with none, one Unplain cannot link to, or the placeholder https://example.com it is left out of the PDF, and warnings say so. Send only the keys to change; the rest stay as they are. Cover artwork is separate: create the ebook, then call generate_cover_image. mode: 'final' (default) also renders a PDF and returns a job to poll with get_export_status; 'draft' only creates the project. The caller's plan limits apply exactly as they do in the Unplain web app: check get_account first, because a document longer than the plan allows is created and rendered but its PDF is withheld.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cta | No | The CTA page Unplain adds at the end of the ebook: its layout, headline, body, button (and whether it is shown), the address the button opens, the social links and the footer credit switch. Unplain writes this page, so it takes no part of the document and never counts toward the free plan's page limit. Send only what should change; every key left out stays as it is. | |
| toc | No | Table of contents. A guide of more than a few sections reads better with one. | |
| mode | No | draft: create the project only. final: also render and return a PDF. | final |
| theme | No | Individual theme properties for THIS ebook only, applied on top of any preset or Brand Theme in the same call. Every field is optional; send only what you want to change. | |
| title | Yes | ||
| author | No | ||
| design | No | auto (the default): Unplain designs the new ebook automatically, free on every plan, on top of its theme (the Brand Theme, preset or theme colors and fonts): its layout, a designed cover, contents page and chapter openers, and feature pages, never pushing a free plan ebook over the free page limit. none: keep the plain layout. | |
| preset | No | Apply a built-in Unplain preset as the starting look (colors, fonts, type scale, corner radius, cover layout, footer). Content is never touched. Combine with 'theme' to adjust individual properties on top. See get_design_options for what each preset looks like. | |
| content | Yes | ||
| subtitle | No | ||
| coverStyle | No | Cover layout. 'editorial', 'centered', 'bold' and 'top' place the title over a full-bleed image (or the page background when there is none); 'imageOnly' fills the page with the image and no text, logo or overlay. 'imageTop' and 'imageBottom' set the image as a clean band above or below the title and need an image to look right. | |
| brandThemeId | No | Apply one of the caller's saved Brand Themes, from list_brand_themes: its colors, fonts, logo and social links. Use this when the user says "my brand" or names their company. Applied BEFORE preset and theme, so those can adjust it. When omitted (and no preset is given), Unplain applies the one theme the content clearly belongs to (it links to the theme's website and is titled with its name), else the default Brand Theme, and reports it as brandThemeApplied. A workspace with no Brand Theme gets the built-in preset the content clearly calls for, if any (presetApplied). | |
| idempotencyKey | No | repeat calls with the same key return the existing project instead of a duplicate |