> ## 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.

# n8n

> Connect Autype to n8n for self-hosted document automation workflows

<Info>
  **Variable syntax:** n8n uses `{{...}}` for its own expressions, which conflicts with Autype's default variable syntax. When building n8n workflows, use the alternative **`${varName}`** syntax for Autype variable placeholders instead. The API automatically converts `${...}` to `{{...}}` internally. This applies to all API input — document JSON, Markdown content, and bulk render items.
</Info>

## Overview

The [n8n-nodes-autype](https://www.npmjs.com/package/n8n-nodes-autype) community node lets you generate documents, render PDFs, and manage content directly from n8n workflows. Self-host your entire document automation pipeline with n8n's visual editor and Autype's rendering engine.

## Prerequisites

* An Autype account with an API key ([Dashboard → Settings → API Keys](https://app.autype.com))
* An [n8n](https://n8n.io) instance (self-hosted or n8n Cloud)

## What you can do

With the Autype community node for n8n, you can:

* **Render documents** from JSON or Extended Markdown to PDF, DOCX, or ODT
* **Bulk render** documents with variable data from spreadsheets, CRMs, or databases
* **Manage projects and documents** — create, list, and retrieve documents
* **Upload images** for use in documents
* **PDF tools** — merge, split, rotate, watermark, compress, and more
* **Use as AI tool** — the node has `usableAsTool` enabled, so AI agents in n8n can call it directly

## Installation

### n8n Cloud or self-hosted (GUI)

1. Go to **Settings → Community Nodes**
2. Enter `n8n-nodes-autype`
3. Click **Install**

### Self-hosted (CLI)

```bash theme={null}
cd ~/.n8n
npm install n8n-nodes-autype
```

Restart n8n after installing.

## Using variables in n8n

Since n8n reserves the `{{...}}` syntax for its own expressions, Autype accepts `${...}` as an alternative on all API inputs.

### Example: Document JSON in n8n

Instead of:

```json theme={null}
{
  "sections": [{
    "type": "flow",
    "content": [
      { "type": "h1", "text": "Invoice for {{companyName}}" },
      { "type": "text", "text": "Date: {{invoiceDate}}" }
    ]
  }]
}
```

Use this in n8n:

```json theme={null}
{
  "sections": [{
    "type": "flow",
    "content": [
      { "type": "h1", "text": "Invoice for ${companyName}" },
      { "type": "text", "text": "Date: ${invoiceDate}" }
    ]
  }]
}
```

Both forms are equivalent. The API normalizes `${...}` to `{{...}}` before processing.

### Mixing n8n expressions and Autype variables

You can freely combine n8n's expression syntax with Autype's `${...}` variable placeholders. In the node's JSON fields, n8n expressions are evaluated first, then Autype substitutes its own variables during rendering:

```
Invoice for ${companyName} — generated on {{ $now.format('yyyy-MM-dd') }}
```

In this example:

* `{{ $now.format('yyyy-MM-dd') }}` is an **n8n** expression evaluated at execution time
* `${companyName}` is an **Autype** variable placeholder substituted during rendering

<Note>
  The `${...}` syntax is only for **input**. If you retrieve document content from the API (e.g., via the Get Document operation), variable placeholders will always be returned as `{{...}}`.
</Note>

## Built-in variables

The following Autype variables are always available and work with both syntaxes:

| `${...}` syntax      | `{{...}}` equivalent  | Description                     |
| -------------------- | --------------------- | ------------------------------- |
| `${pageNumber}`      | `{{pageNumber}}`      | Current page number             |
| `${totalPages}`      | `{{totalPages}}`      | Total number of pages           |
| `${date}`            | `{{date}}`            | Current date (DD.MM.YYYY)       |
| `${date/YYYY-MM-DD}` | `{{date/YYYY-MM-DD}}` | Current date with custom format |

## Getting started

<Steps>
  <Step title="Install the community node">
    In your n8n instance, go to **Settings → Community Nodes** and install `n8n-nodes-autype`.
  </Step>

  <Step title="Create an API key">
    Go to the [Autype Dashboard](https://app.autype.com) and navigate to **Settings → API Keys**. Create a new key — it will start with `ak_...`.
  </Step>

  <Step title="Add credentials in n8n">
    In n8n, go to **Credentials → Add Credential** and search for **Autype**. Paste your API key and save.
  </Step>

  <Step title="Build your workflow">
    Add the **Autype** node to your workflow, choose a resource and operation (e.g. **Render → Render from JSON**), and configure it. Execute the workflow to generate your first document.
  </Step>
</Steps>

<Warning>
  API keys are scoped to your organization. Keep them secret — never commit them to version control or store them in plain text.
</Warning>

## Available operations

The Autype community node provides **40+ operations** across 8 resources. Each operation maps directly to an endpoint of the [Developer API](/api-reference/introduction).

### Rendering

| Operation                      | Description                                                                                                                                                                         |
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Render from JSON**           | Submit a complete document as structured JSON and render it to PDF, DOCX, or ODT. Optionally waits for completion and returns binary output.                                        |
| **Render from Markdown**       | Submit content as Extended Markdown and render it to PDF, DOCX, or ODT. Supports page size, orientation, margins, variables, defaults, abbreviations, citations, and style options. |
| **Render Persistent Document** | Render an existing document from your Autype workspace by its ID. Optionally override variables and output format.                                                                  |
| **Validate JSON**              | Validate a document JSON configuration without rendering. Returns validation errors if any.                                                                                         |
| **Validate Markdown**          | Validate Markdown content without rendering.                                                                                                                                        |
| **List Render Jobs**           | List all render jobs for your organization with pagination.                                                                                                                         |

### Bulk Rendering

| Operation                 | Description                                                                                  |
| ------------------------- | -------------------------------------------------------------------------------------------- |
| **Bulk Render from JSON** | Create up to 100 documents at once by providing a document ID and an array of variable sets. |
| **Bulk Render from File** | Upload a CSV, Excel, or JSON file with variable data to generate documents in bulk.          |

### Documents

| Operation                  | Description                                                       |
| -------------------------- | ----------------------------------------------------------------- |
| **List Documents**         | List all documents, optionally filtered by project.               |
| **Get a Document**         | Retrieve a document by ID including its latest content.           |
| **Create a Document**      | Create a new document in a project with optional initial content. |
| **Get Document Variables** | Get variable definitions for a document.                          |

### Projects

| Operation            | Description                             |
| -------------------- | --------------------------------------- |
| **List Projects**    | List all projects in your organization. |
| **Create a Project** | Create a new project.                   |

### Files (Tool Files)

| Operation                    | Description                                                                                                       |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| **Upload a File**            | Upload a file (PDF, DOCX, ODT, PNG, JPEG) for use with tool operations. Files expire after 60 minutes.            |
| **Get File Details**         | Get metadata for a specific tool file.                                                                            |
| **Download a File**          | Download a tool file by ID as binary data.                                                                        |
| **List Tool Files**          | List all non-expired tool files.                                                                                  |
| **Delete a File**            | Delete a tool file from storage.                                                                                  |
| **Upload a Temporary Image** | Upload an image for use in ad-hoc renders (expires after 24 hours). Returns a `refPath` for use in document JSON. |
| **List Temporary Images**    | List all non-expired temporary images.                                                                            |
| **Delete a Temporary Image** | Delete a temporary image.                                                                                         |

### PDF Tools

| Operation                | Description                                                                     |
| ------------------------ | ------------------------------------------------------------------------------- |
| **Merge PDFs**           | Merge 2–20 PDF files into a single document.                                    |
| **Split PDF**            | Split a PDF into multiple parts by page ranges. Output is a ZIP file.           |
| **Rotate PDF Pages**     | Rotate specific pages by 90°, 180°, or 270°.                                    |
| **Keep or Remove Pages** | Keep or remove specific pages using page specs like `1`, `2-5`, `3-`.           |
| **Add Watermark**        | Add a text watermark with configurable font size, opacity, rotation, and color. |
| **Get Metadata**         | Extract page count, title, author, and creation date.                           |
| **Protect PDF**          | Encrypt a PDF with user and/or owner passwords.                                 |
| **Unlock PDF**           | Remove password protection from a PDF.                                          |
| **Compress PDF**         | Reduce file size (low, medium, or high compression).                            |
| **PDF to Image**         | Convert pages to PNG or JPEG (configurable DPI).                                |
| **Get Form Fields**      | Extract form field names, types, and values.                                    |
| **Fill Form**            | Fill form fields with text, checkboxes, dropdowns, and radio values.            |

### Document Tools

| Operation                | Description                                                          |
| ------------------------ | -------------------------------------------------------------------- |
| **Convert DOCX to PDF**  | Convert a DOCX file to PDF.                                          |
| **Convert ODT to PDF**   | Convert an ODT file to PDF.                                          |
| **Replace Placeholders** | Replace placeholder tags in a DOCX or ODT document with text values. |
| **List Tool Jobs**       | List tool jobs with pagination.                                      |

## How tool operations work

Most PDF and document tool operations follow the same pattern:

1. **Submit** — The node sends a request to the API and receives a job ID
2. **Poll** — When "Wait for Completion" is enabled, the node polls automatically (every 2 seconds, up to 5 minutes)
3. **Return** — Once completed, the node returns the job ID, status, output file ID, metadata, and optionally the binary output

<Tip>
  Enable **Download Output** to receive the result as binary data directly attached to the node output. This lets you chain results into subsequent nodes (e.g., send the PDF via email or upload to cloud storage).
</Tip>

<Tip>
  Input files are **not deleted** after a tool job completes. They remain available until they expire (default: 60 minutes). You can reuse the same file ID across multiple tool operations in your workflow.
</Tip>

## Common workflow patterns

### Generate a PDF from dynamic data

1. Use a trigger node (e.g., Webhook, Google Sheets, Airtable) to get your data
2. Add the **Autype** node with **Render → Render from JSON** and build your document JSON
3. Enable **Download Output** to get the PDF as binary data
4. Send the PDF via email, upload to S3, or save to disk

### Bulk generate personalized documents

1. Add the **Autype** node with **Bulk Render → Bulk Render from JSON**
2. Provide a document ID and an array of variable sets
3. Enable **Download Output** to get a ZIP file with all documents

### Process an existing PDF

1. Use an **HTTP Request** node to download a PDF from any source
2. Add the **Autype** node with **File → Upload** to upload it as a tool file
3. Chain another **Autype** node with any PDF tool operation (e.g., **PDF Tools → Watermark**, **PDF Tools → Compress**)
4. Enable **Download Output** to get the processed result

### AI agent document generation

The Autype node has `usableAsTool` enabled, which means n8n AI agents can use it as a tool. Add the Autype node as a tool to your AI agent workflow, and the agent can generate documents, render PDFs, and perform tool operations autonomously.
