Skills document-generation-api

Generate PDF, DOCX, EPUB, and PPTX documents from structured content blocks.

install
source · Clone the upstream repo
git clone https://github.com/iterationlayer/skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/iterationlayer/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/document-generation-api" ~/.claude/skills/iterationlayer-skills-document-generation-api && rm -rf "$T"
manifest: skills/document-generation-api/SKILL.md
source content

Document Generation API

Generate PDF, DOCX, EPUB, and PPTX documents from structured content blocks.

Cost: 2 credits per request

Prerequisites

You need an Iteration Layer API key. Get one at platform.iterationlayer.com — free trial credits included, no credit card required.

For full integration guidance (SDKs, auth, MCP, error handling), see the Iteration Layer Integration Guide.

API Reference

Generate PDF, DOCX, EPUB, and PPTX documents from a single API call. Send a structured document definition with metadata, page settings, styles, and content blocks, and receive the rendered document as base64-encoded JSON in the response.

Key Features

  • Multi-Format Output -- Generate PDF, DOCX, EPUB, and PPTX from one unified document structure.
  • Rich Content Blocks -- Paragraphs with rich text runs, headlines (h1-h6), images, tables, grids, lists, QR codes, barcodes, and more.
  • 12-Column Grid Layout -- Arrange content blocks side by side using a flexible 12-column grid system.
  • Optional Styles with Sensible Defaults -- Styles and page settings are optional. Defaults use PlusJakartaSans for body text, Outfit for headings, black text, sky-500 links, A4 pages with 72pt margins.
  • Font Weight Support -- Full range from thin to black, not just bold/not-bold. PDF and EPUB render all weights; DOCX and PPTX map semibold and above to bold.
  • Two-Layer Style System -- Define document-wide default styles, then override per block for full control.
  • Headers and Footers -- Repeating headers and footers with the same block types as body content, plus page numbers.
  • Bundled Google Fonts + Custom Fonts -- The top Google Fonts are bundled and available by default. Upload additional font files (base64-encoded) with weight and style metadata for full typographic control.
  • Page Size Presets -- Built-in presets (A0-A6, B0-B6, Letter, Legal, Tabloid, Executive, Statement) plus custom dimensions.
  • Table of Contents -- Auto-generated from headlines with configurable levels and dot leaders.
  • PPTX Slide Support -- Each page-break creates a new slide in PowerPoint output.

Overview

The Document Generation API renders structured documents from a JSON definition. You send a format, document metadata, and an ordered list of content blocks, and receive the rendered document as base64-encoded JSON. Page settings and styles are optional -- sensible defaults are applied automatically (A4 with 72pt margins, PlusJakartaSans body, Outfit headings, black text, sky-500 links).

Endpoint:

POST /document-generation/v1/generate

Supported output formats: PDF, DOCX, EPUB, PPTX

Request Format

<!-- tabs -->
curl -X POST \
  https://api.iterationlayer.com/document-generation/v1/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "format": "pdf",
    "document": {
      "metadata": {
        "title": "Quarterly Report",
        "author": "Acme Corp",
        "language": "en"
      },
      "page": {
        "size": {
          "preset": "A4"
        },
        "margins": {
          "top_in_pt": 72.0,
          "right_in_pt": 72.0,
          "bottom_in_pt": 72.0,
          "left_in_pt": 72.0
        }
      },
      "styles": {
        "text": {
          "font_family": "Helvetica",
          "font_size_in_pt": 12.0,
          "line_height": 1.5,
          "color": "#000000"
        },
        "headline": {
          "font_family": "Helvetica",
          "font_size_in_pt": 24.0,
          "color": "#111111",
          "spacing_before_in_pt": 12.0,
          "spacing_after_in_pt": 6.0,
          "font_weight": "bold"
        },
        "link": {
          "color": "#0066CC",
          "is_underlined": true
        },
        "list": {
          "text_style": {
            "font_family": "Helvetica",
            "font_size_in_pt": 12.0,
            "line_height": 1.5,
            "color": "#000000"
          },
          "marker_color": "#000000",
          "marker_gap_in_pt": 8.0
        },
        "table": {
          "header": {
            "background_color": "#333333",
            "text_color": "#FFFFFF",
            "font_size_in_pt": 12.0,
            "font_weight": "bold"
          },
          "body": {
            "background_color": "#FFFFFF",
            "text_color": "#000000",
            "font_size_in_pt": 11.0
          },
          "border": {
            "outer": {
              "top": {
                "color": "#CCCCCC",
                "width_in_pt": 1.0
              },
              "right": {
                "color": "#CCCCCC",
                "width_in_pt": 1.0
              },
              "bottom": {
                "color": "#CCCCCC",
                "width_in_pt": 1.0
              },
              "left": {
                "color": "#CCCCCC",
                "width_in_pt": 1.0
              }
            },
            "inner": {
              "horizontal": {
                "color": "#EEEEEE",
                "width_in_pt": 0.5
              },
              "vertical": {
                "color": "#EEEEEE",
                "width_in_pt": 0.5
              }
            }
          }
        },
        "grid": {
          "background_color": "#FFFFFF",
          "border_color": "#CCCCCC",
          "border_width_in_pt": 0.0,
          "gap_in_pt": 12.0
        },
        "separator": {
          "color": "#CCCCCC",
          "thickness_in_pt": 1.0,
          "spacing_before_in_pt": 12.0,
          "spacing_after_in_pt": 12.0
        },
        "image": {
          "border_color": "#000000",
          "border_width_in_pt": 0.0
        }
      },
      "content": [
        {
          "type": "headline",
          "level": "h1",
          "text": "Quarterly Report"
        },
        {
          "type": "paragraph",
          "runs": [
            {
              "text": "This is "
            },
            {
              "text": "bold text",
              "font_weight": "bold"
            },
            {
              "text": " in a paragraph."
            }
          ]
        }
      ]
    }
  }'
import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({
  apiKey: "YOUR_API_KEY",
});

const result = await client.generateDocument({
  format: "pdf",
  document: {
    metadata: {
      title: "Quarterly Report",
      author: "Acme Corp",
      language: "en",
    },
    page: {
      size: {
        preset: "A4",
      },
      margins: {
        top_in_pt: 72.0,
        right_in_pt: 72.0,
        bottom_in_pt: 72.0,
        left_in_pt: 72.0,
      },
    },
    styles: {
      text: {
        font_family: "Helvetica",
        font_size_in_pt: 12.0,
        line_height: 1.5,
        color: "#000000",
      },
      headline: {
        font_family: "Helvetica",
        font_size_in_pt: 24.0,
        color: "#111111",
        spacing_before_in_pt: 12.0,
        spacing_after_in_pt: 6.0,
        font_weight: "bold",
      },
      link: {
        color: "#0066CC",
        is_underlined: true,
      },
      list: {
        text_style: {
          font_family: "Helvetica",
          font_size_in_pt: 12.0,
          line_height: 1.5,
          color: "#000000",
        },
        marker_color: "#000000",
        marker_gap_in_pt: 8.0,
      },
      table: {
        header: {
          background_color: "#333333",
          text_color: "#FFFFFF",
          font_size_in_pt: 12.0,
          font_weight: "bold",
        },
        body: {
          background_color: "#FFFFFF",
          text_color: "#000000",
          font_size_in_pt: 11.0,
        },
        border: {
          outer: {
            top: {
              color: "#CCCCCC",
              width_in_pt: 1.0,
            },
            right: {
              color: "#CCCCCC",
              width_in_pt: 1.0,
            },
            bottom: {
              color: "#CCCCCC",
              width_in_pt: 1.0,
            },
            left: {
              color: "#CCCCCC",
              width_in_pt: 1.0,
            },
          },
          inner: {
            horizontal: {
              color: "#EEEEEE",
              width_in_pt: 0.5,
            },
            vertical: {
              color: "#EEEEEE",
              width_in_pt: 0.5,
            },
          },
        },
      },
      grid: {
        background_color: "#FFFFFF",
        border_color: "#CCCCCC",
        border_width_in_pt: 0.0,
        gap_in_pt: 12.0,
      },
      separator: {
        color: "#CCCCCC",
        thickness_in_pt: 1.0,
        spacing_before_in_pt: 12.0,
        spacing_after_in_pt: 12.0,
      },
      image: {
        border_color: "#000000",
        border_width_in_pt: 0.0,
      },
    },
    content: [
      {
        type: "headline",
        level: "h1",
        text: "Quarterly Report",
      },
      {
        type: "paragraph",
        runs: [
          {
            text: "This is ",
          },
          {
            text: "bold text",
            font_weight: "bold",
          },
          {
            text: " in a paragraph.",
          },
        ],
      },
    ],
  },
});
from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")

result = client.generate_document(
    format="pdf",
    document={
        "metadata": {
            "title": "Quarterly Report",
            "author": "Acme Corp",
            "language": "en",
        },
        "page": {
            "size": {
                "preset": "A4",
            },
            "margins": {
                "top_in_pt": 72.0,
                "right_in_pt": 72.0,
                "bottom_in_pt": 72.0,
                "left_in_pt": 72.0,
            },
        },
        "styles": {
            "text": {
                "font_family": "Helvetica",
                "font_size_in_pt": 12.0,
                "line_height": 1.5,
                "color": "#000000",
            },
            "headline": {
                "font_family": "Helvetica",
                "font_size_in_pt": 24.0,
                "color": "#111111",
                "spacing_before_in_pt": 12.0,
                "spacing_after_in_pt": 6.0,
                "font_weight": "bold",
            },
            "link": {
                "color": "#0066CC",
                "is_underlined": True,
            },
            "list": {
                "text_style": {
                    "font_family": "Helvetica",
                    "font_size_in_pt": 12.0,
                    "line_height": 1.5,
                    "color": "#000000",
                },
                "marker_color": "#000000",
                "marker_gap_in_pt": 8.0,
            },
            "table": {
                "header": {
                    "background_color": "#333333",
                    "text_color": "#FFFFFF",
                    "font_size_in_pt": 12.0,
                    "font_weight": "bold",
                },
                "body": {
                    "background_color": "#FFFFFF",
                    "text_color": "#000000",
                    "font_size_in_pt": 11.0,
                },
                "border": {
                    "outer": {
                        "top": {
                            "color": "#CCCCCC",
                            "width_in_pt": 1.0,
                        },
                        "right": {
                            "color": "#CCCCCC",
                            "width_in_pt": 1.0,
                        },
                        "bottom": {
                            "color": "#CCCCCC",
                            "width_in_pt": 1.0,
                        },
                        "left": {
                            "color": "#CCCCCC",
                            "width_in_pt": 1.0,
                        },
                    },
                    "inner": {
                        "horizontal": {
                            "color": "#EEEEEE",
                            "width_in_pt": 0.5,
                        },
                        "vertical": {
                            "color": "#EEEEEE",
                            "width_in_pt": 0.5,
                        },
                    },
                },
            },
            "grid": {
                "background_color": "#FFFFFF",
                "border_color": "#CCCCCC",
                "border_width_in_pt": 0.0,
                "gap_in_pt": 12.0,
            },
            "separator": {
                "color": "#CCCCCC",
                "thickness_in_pt": 1.0,
                "spacing_before_in_pt": 12.0,
                "spacing_after_in_pt": 12.0,
            },
            "image": {
                "border_color": "#000000",
                "border_width_in_pt": 0.0,
            },
        },
        "content": [
            {
                "type": "headline",
                "level": "h1",
                "text": "Quarterly Report",
            },
            {
                "type": "paragraph",
                "runs": [
                    {
                        "text": "This is ",
                    },
                    {
                        "text": "bold text",
                        "font_weight": "bold",
                    },
                    {
                        "text": " in a paragraph.",
                    },
                ],
            },
        ],
    },
)
import il "github.com/iterationlayer/sdk-go"
client := il.NewClient("YOUR_API_KEY")

result, err := client.GenerateDocument(
	il.GenerateDocumentRequest{
		Format: "pdf",
		Document: il.DocumentDefinition{
			Metadata: il.DocumentMetadata{
				Title:    "Quarterly Report",
				Author:   "Acme Corp",
				Language: "en",
			},
			Page: il.DocumentPage{
				Size: il.DocPageSize{
				Preset: "A4",
			},
				Margins: il.DocMargins{
					TopInPt:    72,
					RightInPt:  72,
					BottomInPt: 72,
					LeftInPt:   72,
				},
			},
			Styles: il.DocumentStyles{
				Text: il.TextStyle{
					FontFamily:  "Helvetica",
					FontSizeInPt: 12,
					Color:       "#000000",
					LineHeight:  1.5,
				},
				Headline: il.HeadlineStyle{
					FontFamily:        "Helvetica",
					FontSizeInPt:      24,
					Color:             "#111111",
					SpacingBeforeInPt: 12,
					SpacingAfterInPt:  6,
					FontWeight:        "bold",
				},
			},
			Content: []il.ContentBlock{
				il.NewHeadlineBlock("h1", "Quarterly Report"),
				il.ParagraphBlock{
					Type: "paragraph",
					Runs: []il.TextRun{
						{
							Text: "This is ",
						},
						{
							Text:       "bold text",
							FontWeight: "bold",
						},
						{
							Text: " in a paragraph.",
						},
					},
				},
			},
		},
	},
)
<!-- response -->
{
  "success": true,
  "data": {
    "buffer": "JVBERi0xLjcKMSAwIG9iago8...",
    "mime_type": "application/pdf"
  }
}
<!-- /tabs -->

Document Structure

The top-level request has the following fields:

FieldTypeRequiredDescription
format
stringYesOutput format:
pdf
,
docx
,
epub
, or
pptx
document
objectYesThe full document definition (see below)
webhook_url
stringNoHTTPS URL to receive results asynchronously. If provided, returns 201 immediately. See Webhooks.

Async Mode

Add a

webhook_url
parameter to process the request in the background. The API returns
201 Accepted
immediately and delivers the result to your webhook URL when processing completes. See Webhooks for payload format and retry behavior.

The

document
object contains:

FieldTypeRequiredDescription
metadata
objectYesDocument metadata (title, author, language)
page
objectNoPage size and margins. Defaults to A4 with 72pt margins
fonts
arrayNoCustom font definitions (base64-encoded font files)
styles
objectNoDocument-wide default styles. Defaults to PlusJakartaSans body, Outfit headings, black text, sky-500 links
header
arrayNoContent blocks rendered at the top of every page
footer
arrayNoContent blocks rendered at the bottom of every page
header_distance_from_edge_in_pt
floatNoDistance from the page edge to the header
footer_distance_from_edge_in_pt
floatNoDistance from the page edge to the footer
content
arrayYesOrdered list of content blocks

Metadata

FieldTypeRequiredDescription
title
stringYesDocument title (min 1 character)
author
stringNoDocument author
language
stringNoLanguage code (min 2 characters, e.g.,
"en"
)
{
  "metadata": {
    "title": "Annual Report 2025",
    "author": "Acme Corp",
    "language": "en"
  }
}

Page Settings

The

page
object controls page dimensions, margins, and background color.

FieldTypeRequiredDescription
size
objectYesPage size (preset or custom dimensions)
margins
objectYesPage margins
background_color
stringNoHex color for the page background (e.g.,
#FFFFFF
)

Page size -- use a preset or provide custom dimensions:

FieldTypeRequiredDescription
preset
stringNoOne of:
A0
-
A6
,
B0
-
B6
,
Letter
,
Legal
,
Tabloid
,
Executive
,
Statement
width_in_pt
floatNoCustom width in points (>= 1)
height_in_pt
floatNoCustom height in points (>= 1)

Use either

preset
or both
width_in_pt
and
height_in_pt
.

Margins:

FieldTypeRequiredDescription
top_in_pt
floatYesTop margin in points (>= 0)
right_in_pt
floatYesRight margin in points (>= 0)
bottom_in_pt
floatYesBottom margin in points (>= 0)
left_in_pt
floatYesLeft margin in points (>= 0)
{
  "page": {
    "size": {
      "preset": "A4"
    },
    "margins": {
      "top_in_pt": 72.0,
      "right_in_pt": 72.0,
      "bottom_in_pt": 72.0,
      "left_in_pt": 72.0
    },
    "background_color": "#FFFFFF"
  }
}

Custom Fonts

The top Google Fonts are bundled and available by default. Documents can reference any bundled font by name without providing font definitions. If a font name isn't found, it falls back to Inter Regular.

Bundled fonts:

  • AlfaSlabOne
  • AnekTelugu
  • Anton
  • Archivo
  • ArchivoBlack
  • Arimo
  • Assistant
  • Barlow
  • BarlowCondensed
  • BebasNeue
  • Bitter
  • BricolageGrotesque
  • Bungee
  • Cabin
  • Cairo
  • Caveat
  • ChangaOne
  • CommitMono
  • CormorantGaramond
  • CrimsonText
  • DancingScript
  • DMSans
  • Dosis
  • EBGaramond
  • Exo2
  • Figtree
  • FiraSans
  • FjallaOne
  • GravitasOne
  • Heebo
  • Hind
  • HindSiliguri
  • IBMPlexSans
  • Inconsolata
  • Inter
  • InterTight
  • JosefinSans
  • Jost
  • Kanit
  • Karla
  • Lato
  • Lexend
  • LibreBaskerville
  • LibreFranklin
  • Lobster
  • Lora
  • Manrope
  • Merriweather
  • Montserrat
  • MPLUSRounded1c
  • Mukta
  • Mulish
  • NanumGothic
  • NotoSans
  • NotoSansArabic
  • NotoSansJP
  • NotoSansKR
  • NotoSansSC
  • NotoSansTC
  • NotoSansTelugu
  • NotoSerif
  • NotoSerifJP
  • Nunito
  • NunitoSans
  • OpenSans
  • Oswald
  • Outfit
  • Overpass
  • Oxygen
  • Pacifico
  • PlayfairDisplay
  • PlusJakartaSans
  • Poppins
  • Prompt
  • PTSans
  • PTSerif
  • PublicSans
  • Quicksand
  • Raleway
  • Ramabhadra
  • RedHatDisplay
  • Roboto
  • RobotoCondensed
  • RobotoFlex
  • RobotoMono
  • RobotoSlab
  • Rubik
  • Saira
  • SchibstedGrotesk
  • ShareTech
  • Slabo27px
  • SmoochSans
  • Sora
  • SourceCodePro
  • SourceSans3
  • SpaceGrotesk
  • TitilliumWeb
  • Ubuntu
  • WorkSans

To use additional fonts beyond the bundled set, upload them as base64-encoded font files. Each font definition requires a name, weight, style, and the font file data.

FieldTypeRequiredDescription
name
stringYesFont family name (min 1 character)
weight
stringYesOne of:
thin
,
extralight
,
light
,
regular
,
medium
,
semibold
,
bold
,
extrabold
,
black
style
stringYesOne of:
normal
,
italic
buffer
stringYesBase64-encoded font file (TTF, OTF, WOFF, or WOFF2)
{
  "fonts": [
    {
      "name": "CustomFont",
      "weight": "regular",
      "style": "normal",
      "buffer": "<base64-encoded-font-file>"
    },
    {
      "name": "CustomFont",
      "weight": "bold",
      "style": "normal",
      "buffer": "<base64-encoded-font-file>"
    }
  ]
}

Style System

The style system uses a two-layer merge approach: you define document-wide default styles in the

styles
object, and optionally override any property per content block using the block's
styles
field.

The

styles
object contains defaults for all block types:

FieldTypeRequiredDescription
text
objectNoDefault text/paragraph style
headline
objectNoDefault headline style
link
objectNoDefault link style
list
objectNoDefault list style
table
objectNoDefault table style
grid
objectNoDefault grid style
separator
objectNoDefault separator style
image
objectNoDefault image style

Text Style

FieldTypeRequiredDescription
font_family
stringYesFont family name
font_size_in_pt
floatYesFont size in points (>= 1)
line_height
floatYesLine height multiplier (>= 0.5)
color
stringYesText color as hex (e.g.,
#000000
)
font_weight
stringNoFont weight:
thin
,
extralight
,
light
,
regular
,
medium
,
semibold
,
bold
,
extrabold
,
black
. PDF/EPUB render all weights. DOCX/PPTX map
semibold
and above to bold.
is_italic
booleanNoItalic text

Headline Style

FieldTypeRequiredDescription
font_family
stringYesFont family name
font_size_in_pt
floatYesFont size in points (>= 1)
color
stringYesHeadline color as hex
spacing_before_in_pt
floatYesSpace before the headline (>= 0)
spacing_after_in_pt
floatYesSpace after the headline (>= 0)
font_weight
stringNoFont weight:
thin
,
extralight
,
light
,
regular
,
medium
,
semibold
,
bold
,
extrabold
,
black
. PDF/EPUB render all weights. DOCX/PPTX map
semibold
and above to bold.
is_italic
booleanNoItalic text

Link Style

FieldTypeRequiredDescription
color
stringYesLink color as hex
is_underlined
booleanNoWhether links are underlined

List Style

FieldTypeRequiredDescription
text_style
objectYesText style for list items (same fields as text style)
marker_color
stringYesBullet/number color as hex
marker_gap_in_pt
floatYesGap between marker and text (>= 0)

Table Style

FieldTypeRequiredDescription
header
objectYesHeader row style:
background_color
,
text_color
,
font_size_in_pt
,
font_weight
body
objectYesBody row style:
background_color
,
text_color
,
font_size_in_pt
border
objectYesBorder style with
outer
(top, right, bottom, left) and
inner
(horizontal, vertical) -- each with
color
and
width_in_pt

Grid Style

FieldTypeRequiredDescription
background_color
stringYesGrid background color as hex
border_color
stringYesGrid border color as hex
border_width_in_pt
floatYesBorder width in points (>= 0)
gap_in_pt
floatYesGap between columns in points (>= 0)

Separator Style

FieldTypeRequiredDescription
color
stringYesLine color as hex
thickness_in_pt
floatYesLine thickness in points (>= 0)
spacing_before_in_pt
floatYesSpace before the separator (>= 0)
spacing_after_in_pt
floatYesSpace after the separator (>= 0)

Image Style

FieldTypeRequiredDescription
border_color
stringYesBorder color as hex
border_width_in_pt
floatYesBorder width in points (>= 0)

Content Blocks

Content blocks are the building blocks of your document. They are provided as an ordered array in the

content
field and rendered sequentially.

paragraph

A text paragraph composed of one or more rich text runs. Each run can have independent bold, italic, and link formatting. Alternatively, use

markdown
for simple Markdown-formatted text.

FieldTypeRequiredDescription
type
stringYes
"paragraph"
runs
arrayNoArray of text runs (see below)
markdown
stringNoMarkdown-formatted text (alternative to
runs
)
text_alignment
stringNoOne of:
left
,
center
,
right
,
justify
styles
objectNoText style overrides

Text run:

FieldTypeRequiredDescription
text
stringYesThe text content (min 1 character)
font_weight
stringNoFont weight (same values as text style)
is_italic
booleanNoItalic formatting
link_url
stringNoMakes the run a hyperlink
{
  "type": "paragraph",
  "runs": [
    {
      "text": "Visit our "
    },
    {
      "text": "website",
      "font_weight": "bold",
      "link_url": "https://example.com"
    },
    {
      "text": " for details."
    }
  ],
  "text_alignment": "justify"
}

headline

A heading from level h1 to h6. Optionally participates in the table of contents.

FieldTypeRequiredDescription
type
stringYes
"headline"
level
stringYesOne of:
h1
,
h2
,
h3
,
h4
,
h5
,
h6
text
stringYesHeadline text (min 1 character)
styles
objectNoHeadline style overrides
table_of_contents
objectNoTable of contents settings (see below)

Table of contents options:

FieldTypeRequiredDescription
is_included
booleanNoWhether this headline appears in the TOC
label_override
stringNoCustom label in the TOC (min 1 character)
level_override
stringNoOverride the TOC indentation level (
h1
-
h6
)
{
  "type": "headline",
  "level": "h2",
  "text": "Chapter 1: Introduction",
  "table_of_contents": {
    "is_included": true
  }
}

image

An inline image with specified dimensions.

FieldTypeRequiredDescription
type
stringYes
"image"
buffer
stringYesBase64-encoded image data
width_in_pt
floatYesDisplay width in points (>= 1)
height_in_pt
floatYesDisplay height in points (>= 1)
fit
stringNoOne of:
cover
,
contain
styles
objectNoImage style overrides
{
  "type": "image",
  "buffer": "<base64-encoded-image>",
  "width_in_pt": 400.0,
  "height_in_pt": 300.0,
  "fit": "contain"
}

table

A data table with optional header row, column widths, and cell-level formatting.

FieldTypeRequiredDescription
type
stringYes
"table"
header
objectNoHeader row with
cells
array
rows
arrayYesArray of row objects, each with a
cells
array
column_widths_in_percent
arrayNoColumn width percentages (each >= 1)
styles
objectNoTable style overrides

Table cell:

FieldTypeRequiredDescription
text
stringYesCell content (min 1 character)
horizontal_alignment
stringNoOne of:
left
,
center
,
right
column_span
integerNoNumber of columns to span (>= 1)
row_span
integerNoNumber of rows to span (>= 1)
styles
objectNoCell-level style overrides:
background_color
,
text_color
,
font_size_in_pt
,
font_weight
,
is_italic
{
  "type": "table",
  "header": {
    "cells": [
      {
        "text": "Product"
      },
      {
        "text": "Qty",
        "horizontal_alignment": "right"
      },
      {
        "text": "Price",
        "horizontal_alignment": "right"
      }
    ]
  },
  "rows": [
    {
      "cells": [
        {
          "text": "Widget A"
        },
        {
          "text": "100",
          "horizontal_alignment": "right"
        },
        {
          "text": "$9.99",
          "horizontal_alignment": "right"
        }
      ]
    }
  ],
  "column_widths_in_percent": [50.0, 25.0, 25.0]
}

grid

A 12-column grid layout for placing content blocks side by side. Each column specifies a

column_span
(1-12) and contains its own array of content blocks.

FieldTypeRequiredDescription
type
stringYes
"grid"
columns
arrayYesArray of column objects (see below)
horizontal_alignment
stringNoOne of:
left
,
center
,
right
vertical_alignment
stringNoOne of:
top
,
center
,
bottom
styles
objectNoGrid style overrides

Grid column:

FieldTypeRequiredDescription
column_span
integerYesNumber of columns to span (1-12)
horizontal_alignment
stringNoOne of:
left
,
center
,
right
vertical_alignment
stringNoOne of:
top
,
center
,
bottom
blocks
arrayYesContent blocks within the column
{
  "type": "grid",
  "columns": [
    {
      "column_span": 6,
      "blocks": [
        {
          "type": "headline",
          "level": "h3",
          "text": "Left Column"
        },
        {
          "type": "paragraph",
          "runs": [
            {
              "text": "Content on the left."
            }
          ]
        }
      ]
    },
    {
      "column_span": 6,
      "blocks": [
        {
          "type": "headline",
          "level": "h3",
          "text": "Right Column"
        },
        {
          "type": "paragraph",
          "runs": [
            {
              "text": "Content on the right."
            }
          ]
        }
      ]
    }
  ]
}

list

An ordered or unordered list with support for nested items.

FieldTypeRequiredDescription
type
stringYes
"list"
variant
stringYes
"ordered"
or
"unordered"
items
arrayYesArray of list items (see below)
styles
objectNoList style overrides

List item:

FieldTypeRequiredDescription
text
stringYesItem text (min 1 character)
children
arrayNoNested list items
{
  "type": "list",
  "variant": "unordered",
  "items": [
    {
      "text": "First item"
    },
    {
      "text": "Second item",
      "children": [
        {
          "text": "Nested item A"
        },
        {
          "text": "Nested item B"
        }
      ]
    },
    {
      "text": "Third item"
    }
  ]
}

table-of-contents

An auto-generated table of contents built from headline blocks that have

table_of_contents.is_included
set to
true
.

FieldTypeRequiredDescription
type
stringYes
"table-of-contents"
levels
arrayYesWhich headline levels to include (e.g.,
["h1", "h2", "h3"]
)
leader
stringYesLeader style between title and page number:
"dots"
or
"none"
text_alignment
stringNoOne of:
left
,
center
,
right
,
justify
styles
objectNoText style overrides
{
  "type": "table-of-contents",
  "levels": ["h1", "h2", "h3"],
  "leader": "dots"
}

page-break

Forces a page break at this point. In PPTX output, each page-break creates a new slide.

{
  "type": "page-break"
}

separator

A horizontal rule/divider line.

FieldTypeRequiredDescription
type
stringYes
"separator"
styles
objectNoSeparator style overrides
{
  "type": "separator"
}

page-number

Renders the current page number. Only valid in headers and footers.

FieldTypeRequiredDescription
type
stringYes
"page-number"
text_alignment
stringNoOne of:
left
,
center
,
right
,
justify
styles
objectNoText style overrides
{
  "type": "page-number",
  "text_alignment": "center"
}

qr-code

Renders a QR code from a string value.

FieldTypeRequiredDescription
type
stringYes
"qr-code"
value
stringYesData to encode (min 1 character)
width_in_pt
integerYesWidth in points (>= 1)
height_in_pt
integerYesHeight in points (>= 1)
fg_hex_color
stringYesForeground color as hex (e.g.,
#000000
)
bg_hex_color
stringYesBackground color as hex (e.g.,
#FFFFFF
)
{
  "type": "qr-code",
  "value": "https://example.com",
  "width_in_pt": 100,
  "height_in_pt": 100,
  "fg_hex_color": "#000000",
  "bg_hex_color": "#FFFFFF"
}

barcode

Renders a barcode in one of several standard formats.

FieldTypeRequiredDescription
type
stringYes
"barcode"
value
stringYesData to encode (min 1 character)
format
stringYesOne of:
code128
,
ean13
,
ean8
,
code39
,
itf
,
codabar
width_in_pt
integerYesWidth in points (>= 1)
height_in_pt
integerYesHeight in points (>= 1)
fg_hex_color
stringYesForeground color as hex
bg_hex_color
stringYesBackground color as hex
{
  "type": "barcode",
  "value": "1234567890128",
  "format": "ean13",
  "width_in_pt": 200,
  "height_in_pt": 80,
  "fg_hex_color": "#000000",
  "bg_hex_color": "#FFFFFF"
}

Headers and Footers

Headers and footers accept the same content block types as the document body, with the addition of

page-number
and the exclusion of
table-of-contents
and
page-break
. They are rendered on every page.

Supported block types in headers/footers:

paragraph
,
headline
,
image
,
table
,
grid
,
list
,
page-number
,
separator
,
qr-code
,
barcode

{
  "header": [
    {
      "type": "paragraph",
      "runs": [
        {
          "text": "Acme Corp -- Confidential"
        }
      ],
      "text_alignment": "right"
    }
  ],
  "footer": [
    {
      "type": "grid",
      "columns": [
        {
          "column_span": 6,
          "blocks": [
            {
              "type": "paragraph",
              "runs": [
                {
                  "text": "Acme Corp"
                }
              ]
            }
          ]
        },
        {
          "column_span": 6,
          "blocks": [
            {
              "type": "page-number",
              "text_alignment": "right"
            }
          ]
        }
      ]
    }
  ],
  "header_distance_from_edge_in_pt": 36.0,
  "footer_distance_from_edge_in_pt": 36.0
}

PPTX Notes

When generating PPTX (PowerPoint) output:

  • The initial content before the first
    page-break
    becomes the first slide.
  • Each
    page-break
    block creates a new slide.
  • All content blocks between page breaks are placed on the same slide.
  • Page size settings map to slide dimensions.

Format Compatibility

Not all features are supported equally across output formats. The table below shows per-format feature support:

FeaturePDFDOCXPPTXEPUB
Paragraph (rich text)
Headline (h1-h6 sizes)
Image
QR Code
Barcode
Table
Grid (columns)
List (ordered/unordered)
Nested lists
Table of Contents
Page Break
Separator
Page Number
Header / Footer
Font Weight (thin–black)⚠️⚠️
Custom Fonts
Page Background Color
Table Cell Backgrounds

Notes:

  • Font Weight (DOCX/PPTX): DOCX and PPTX only support bold on/off. Weights
    semibold
    ,
    bold
    ,
    extrabold
    , and
    black
    render as bold. All lighter weights (
    thin
    through
    medium
    ) render as normal. PDF and EPUB render the full 100--900 numeric weight range, so all weights are visually distinct when the font supports them.
  • Table of Contents (DOCX): DOCX table of contents entries are inserted as static text. To make them interactive with page numbers in Microsoft Word, right-click the TOC and select "Update Field" after opening the document.

Recipes

For complete, runnable examples see the Recipes page.

  • Generate PDF Invoice -- Generate a professional PDF invoice with company branding, line items, and totals.
  • Generate PDF Report -- Generate a professional PDF report with title, executive summary, data table, and footer.
  • Generate DOCX Contract -- Generate an editable DOCX service agreement with parties, terms, and payment schedule.
  • Generate Shipping Label -- Generate a compact PDF shipping label with sender and recipient addresses, barcode, and tracking number.
  • Generate Restaurant Menu -- Generate a branded restaurant menu PDF with sections, items, prices, and descriptions.

Error Responses

StatusDescription
400Invalid request (validation errors, missing required fields, invalid base64 font data)
401Missing or invalid API key
422Processing error (document rendering failure)
429Rate limit exceeded

Links