> ## Documentation Index
> Fetch the complete documentation index at: https://docs.autype.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Document JSON Overview

> Top-level structure of the Autype document JSON used for rendering

The document JSON is the core data structure used by the Render endpoint (`POST /render`) and Bulk Render endpoint (`POST /bulk-render`) to generate PDF, DOCX, and ODT documents.

## Top-level structure

A document JSON object has the following top-level keys:

```json theme={null}
{
  "document": { ... },
  "sections": [ ... ],
  "variables": { ... },
  "abbreviations": { ... },
  "citations": [ ... ],
  "defaults": { ... }
}
```

| Property        | Type   | Required | Description                                                                                                                                               |
| --------------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `document`      | object | **Yes**  | Page settings: output format, size, margins, orientation, and metadata.                                                                                   |
| `sections`      | array  | **Yes**  | Array of content sections. Each section contains an array of elements. Min: 0, Max: 500.                                                                  |
| `variables`     | object | No       | Template variables for `{{varName}}` text substitution and `variableRef` elements.                                                                        |
| `abbreviations` | object | No       | Map of abbreviation short forms to their full text (e.g., `"API": "Application Programming Interface"`).                                                  |
| `citations`     | array  | No       | Array of citation entries in [CSL-JSON](https://citeproc-js.readthedocs.io/en/latest/csl-json/markup.html) format for bibliography generation. Max: 1000. |
| `defaults`      | object | No       | Global styling defaults: fonts, colors, spacing, element styles, header/footer, citation style, and more.                                                 |

## Strict validation mode

The render endpoints (`POST /render` and `POST /render/markdown`) support an optional `?strict=true` query parameter that enables strict validation. In strict mode, the API performs additional checks that go beyond schema validation:

* **Broken internal references** — references to non-existent anchors (e.g., `[see here](#missing-anchor)`) cause an error
* **Undefined citations** — `@[citeKey]` references to citation IDs not present in the `citations` array cause an error
* **Undefined abbreviations** — `~ABK~` references to abbreviation keys not present in the `abbreviations` object cause an error
* **Duplicate anchors** — multiple elements defining the same anchor ID cause an error (this is always checked, even without strict mode)

Without strict mode, broken references, undefined citations, and undefined abbreviations are treated as **warnings** and do not block rendering. With strict mode enabled, they become **errors** and the render request is rejected with a `400 Bad Request` response containing the list of validation errors.

<Note>
  Strict mode is recommended for production workflows to catch issues early. In the Autype editor, these same checks are shown as warnings in the sidebar.
</Note>

## Document settings

The `document` object configures the page layout and document metadata.

```json theme={null}
{
  "document": {
    "type": "pdf",
    "filename": "invoice-2024",
    "title": "Invoice #1234",
    "author": "Acme Inc",
    "subject": "Monthly Invoice",
    "keywords": ["invoice", "billing"],
    "size": "A4",
    "orientation": "portrait",
    "marginTop": 2.5,
    "marginRight": 2.5,
    "marginBottom": 2,
    "marginLeft": 2.5
  }
}
```

### Properties

| Property       | Type      | Required | Default      | Description                                                                                    |
| -------------- | --------- | -------- | ------------ | ---------------------------------------------------------------------------------------------- |
| `type`         | string    | **Yes**  | —            | Output format: `"pdf"`, `"docx"`, or `"odt"`                                                   |
| `filename`     | string    | No       | —            | Output filename without extension. Only `a-z`, `A-Z`, `0-9`, `_`, `-` allowed. Max: 100 chars. |
| `title`        | string    | No       | —            | Document title (PDF/DOCX metadata). Max: 200 chars.                                            |
| `author`       | string    | No       | —            | Document author (PDF/DOCX metadata). Max: 100 chars.                                           |
| `subject`      | string    | No       | —            | Document subject (PDF/DOCX metadata). Max: 200 chars.                                          |
| `keywords`     | string\[] | No       | —            | Document keywords for metadata. Max: 10 items, 50 chars each.                                  |
| `size`         | string    | No       | `"A4"`       | Page size: `"A4"`, `"A3"`, `"A5"`, `"Letter"`, `"Legal"`                                       |
| `orientation`  | string    | No       | `"portrait"` | Page orientation: `"portrait"` or `"landscape"`                                                |
| `marginTop`    | number    | No       | —            | Top margin in cm (0–10)                                                                        |
| `marginRight`  | number    | No       | —            | Right margin in cm (0–10)                                                                      |
| `marginBottom` | number    | No       | —            | Bottom margin in cm (0–10)                                                                     |
| `marginLeft`   | number    | No       | —            | Left margin in cm (0–10)                                                                       |

## Sections

Sections are the content containers of your document. There are two types:

### Flow section

Flowing content that spans multiple pages automatically. This is the most common section type.

```json theme={null}
{
  "type": "flow",
  "newPage": true,
  "columns": { "count": 2, "space": 1.27, "separate": true },
  "content": [
    { "type": "h1", "text": "Introduction" },
    { "type": "text", "text": "This is a paragraph." }
  ]
}
```

| Property  | Type    | Required | Default | Description                                    |
| --------- | ------- | -------- | ------- | ---------------------------------------------- |
| `type`    | string  | **Yes**  | —       | Must be `"flow"`                               |
| `id`      | string  | No       | —       | Optional unique identifier. Max: 100 chars.    |
| `newPage` | boolean | No       | `true`  | Start this section on a new page.              |
| `columns` | object  | No       | —       | Multi-column layout configuration.             |
| `content` | array   | **Yes**  | —       | Array of content elements. Max: 5000 elements. |

#### Columns

| Property   | Type    | Required | Default | Description                         |
| ---------- | ------- | -------- | ------- | ----------------------------------- |
| `count`    | number  | **Yes**  | —       | Number of columns (1–4)             |
| `space`    | number  | No       | `1.27`  | Space between columns in cm (0–5)   |
| `separate` | boolean | No       | `false` | Show separator line between columns |

### Page section

A single positioned page — useful for cover pages, title pages, or any content that needs precise vertical positioning.

```json theme={null}
{
  "type": "page",
  "align": "center",
  "content": [
    { "type": "h1", "text": "My Document", "align": "center" },
    { "type": "text", "text": "A subtitle", "align": "center" }
  ]
}
```

| Property  | Type   | Required | Default | Description                                           |
| --------- | ------ | -------- | ------- | ----------------------------------------------------- |
| `type`    | string | **Yes**  | —       | Must be `"page"`                                      |
| `id`      | string | No       | —       | Optional unique identifier. Max: 100 chars.           |
| `align`   | string | No       | `"top"` | Vertical alignment: `"top"`, `"center"`, `"bottom"`   |
| `startY`  | number | No       | —       | Y position in cm from top (0–100). Overrides `align`. |
| `content` | array  | **Yes**  | —       | Array of content elements. Max: 200 elements.         |

## Complete example

```json theme={null}
{
  "document": {
    "type": "pdf",
    "filename": "certificate",
    "title": "Certificate of Completion",
    "size": "A4",
    "orientation": "landscape",
    "marginTop": 2,
    "marginRight": 2.5,
    "marginBottom": 2,
    "marginLeft": 2.5
  },
  "variables": {
    "recipientName": "Max Mustermann",
    "courseName": "Advanced Document Automation",
    "completionDate": "15. Januar 2026"
  },
  "defaults": {
    "fontFamily": "Arial",
    "fontSize": 12,
    "color": "#333333"
  },
  "sections": [
    {
      "type": "flow",
      "content": [
        { "type": "h1", "text": "Certificate of Completion", "align": "center" },
        { "type": "spacer", "height": 2 },
        { "type": "text", "text": "This is to certify that", "align": "center" },
        { "type": "h2", "text": "{{recipientName}}", "align": "center" },
        { "type": "text", "text": "has successfully completed the course", "align": "center" },
        { "type": "h3", "text": "{{courseName}}", "align": "center" },
        { "type": "spacer", "height": 2 },
        { "type": "text", "text": "Date: {{completionDate}}", "align": "center" }
      ]
    }
  ]
}
```

## Next steps

<CardGroup cols={2}>
  <Card title="Variables" icon="braces" href="/api-reference/json-syntax/variables">
    Dynamic content substitution with text, number, image, list, and table variables.
  </Card>

  <Card title="Abbreviations" icon="book-a" href="/api-reference/json-syntax/abbreviations">
    Define abbreviation short forms and generate abbreviation lists.
  </Card>

  <Card title="Citations" icon="book" href="/api-reference/json-syntax/citations">
    CSL-JSON citations and automatic bibliography generation.
  </Card>

  <Card title="Defaults" icon="paintbrush" href="/api-reference/json-syntax/defaults">
    Global styling: fonts, colors, spacing, header/footer, and more.
  </Card>

  <Card title="Layout" icon="book-a" href="/api-reference/json-syntax/sections/layout">
    Flow and page sections, columns, page breaks, and spacers.
  </Card>

  <Card title="Text Elements" icon="text-initial" href="/api-reference/json-syntax/sections/text-elements">
    Headings, paragraphs, inline formatting, and anchors.
  </Card>

  <Card title="Tables" icon="table" href="/api-reference/json-syntax/sections/tables">
    Tables with headers, rows, cell formatting, captions, and data binding.
  </Card>

  <Card title="Lists" icon="list" href="/api-reference/json-syntax/sections/lists">
    Ordered and unordered lists with nested items.
  </Card>

  <Card title="Media & Code" icon="image" href="/api-reference/json-syntax/sections/media">
    Images, charts, QR codes, code blocks, and math equations.
  </Card>

  <Card title="Indices" icon="bookmark" href="/api-reference/json-syntax/sections/indices">
    Table of contents, list of figures, list of tables.
  </Card>
</CardGroup>
