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

# n8n

> Powerful workflow automation with the DocsAutomator community node

n8n is one of the most powerful workflow automation platforms available today, with extensive AI capabilities and agent-building features. The DocsAutomator community node enables document creation, automation management, and feature access directly within n8n workflows.

[n8n Integration Overview](https://www.youtube.com/embed/CJKAVxcgkn8)

## Key Benefits

> [card] Self-Hosted Option
>
> Run n8n on your own infrastructure for complete data control

> [card] Generous Free Tier
>
> n8n cloud offers a complimentary plan for getting started

> [card] Full Automation Management
>
> Programmatically create, update, duplicate, and delete automations

> [card] Flexible Data Transformation
>
> Use n8n's powerful expression system to transform data

## Installation

> [tab] From Nodes Panel (Recommended)
>
> **1. Add New Node**
>
> Click the **+** button to add a new node
>
> **2. Search**
>
> Search for "DocsAutomator"
>
> **3. Install**
>
> Click on the DocsAutomator node, then click **Install** when prompted

> [tab] From Settings
>
> **1. Navigate to Settings**
>
> Go to **Settings** > **Community Nodes**
>
> **2. Install Node**
>
> Click **Install a community node**
>
> **3. Enter Package Name**
>
> Enter `n8n-nodes-docsautomator`
>
> **4. Confirm**
>
> Click **Install**

> [tab] Self-Hosted
>
> Follow the [n8n community nodes installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) for your specific setup.

## Setting Up Credentials

**1. Get Your API Key**

1. Log in to your [DocsAutomator account](https://app.docsautomator.co)
2. Navigate to **Settings** > **API Key**
3. Copy your API key

**2. Add Credentials in n8n**

1. Go to **Credentials** > **Add Credential**
2. Search for "DocsAutomator API"
3. Paste your API key into the **API Key** field
4. Click **Save**

> [!TIP]
>
> You can also add credentials directly when configuring a DocsAutomator node by clicking on the credential dropdown and selecting "Create New".

## Creating Documents

**1. Add the DocsAutomator Node**

Click the **+** button and search for "DocsAutomator"

**2. Select Your Credentials**

Choose your configured DocsAutomator API credentials from the dropdown

**3. Configure the Operation**

* **Resource**: Select `Document`
* **Operation**: Select `Create`

**4. Select an Automation**

Choose the automation you want to use from the **Automation** dropdown

> [!NOTE]
>
> Only automations with **API** or **n8n** as the data source will appear in this list.

**5. Map Placeholder Values**

For each placeholder in your template, provide a value. You can enter static text or use n8n expressions to map data from previous nodes.

**6. Configure Line Items (Optional)**

If your template includes line items, expand the **Line Items** section.

**7. Set Processing Options**

* **Preview Mode**: Enable to generate a preview document (doesn't count against credits)
* **Async Processing**: Enable to return immediately with a job ID

**8. Test the Workflow**

Click **Test Step** to generate a document and verify your configuration.

## Working with Line Items

Line items must be provided as a JSON array of objects. Each object represents one row, with keys matching your placeholder names.

```json theme={null}
[
  {
    "item_name": "Widget A",
    "quantity": 2,
    "unit_price": 10.00,
    "total": 20.00
  },
  {
    "item_name": "Widget B",
    "quantity": 1,
    "unit_price": 25.50,
    "total": 25.50
  }
]
```

### Multiple Line Item Sets

If your template has multiple line item sections:

1. Click **Add Line Item**
2. Select the line item type (e.g., "Line Items 1", "Line Items 2")
3. Provide the JSON array for that section

### Transforming Data

Use n8n's built-in nodes to transform data:

* **Code node**: Write JavaScript to transform complex data structures
* **Split Out node**: Convert arrays into individual items
* **Aggregate node**: Combine multiple items into an array

```javascript theme={null}
const items = $input.all();

const lineItems = items.map(item => ({
  item_name: item.json.product.name,
  quantity: item.json.qty,
  unit_price: item.json.price,
  total: item.json.qty * item.json.price
}));

return { json: { lineItems: JSON.stringify(lineItems) } };
```

## Managing Automations

The n8n node provides full CRUD operations for automations:

| Operation | Description |
| - | - |
| **Get Many** | List all automations in your workspace |
| **Get** | Retrieve a single automation by ID |
| **Create** | Create a new automation |
| **Update** | Modify an existing automation's settings |
| **Duplicate** | Create a copy of an automation |
| **Delete** | Remove an automation |

## Expression Tips

Common n8n expressions for DocsAutomator:

```javascript theme={null}
// Format dates
{{ $now.toFormat('MMMM d, yyyy') }}

// Access nested data
{{ $json.customer.address.city }}

// Conditional values
{{ $json.discount > 0 ? $json.discount + '%' : 'None' }}

// Format currency
{{ '$' + $json.amount.toFixed(2) }}

// Join array values
{{ $json.tags.join(', ') }}
```

## Best Practices

> [accordion] Use Preview Mode for Testing
>
> Enable **Preview Mode** to verify placeholder mapping and document formatting without using credits.

> [accordion] Error Handling
>
> * Enable **Continue On Fail** to prevent workflow failure
> * Use an **Error Trigger** workflow to handle failures gracefully
> * Check error output for detailed messages

> [accordion] Async Processing for Large Documents
>
> For documents that take longer to generate:
>
> 1. Enable **Async Processing** to receive a job ID immediately
> 2. Use a **Wait** node to pause for processing
> 3. Check the job status using the DocsAutomator API

## FAQ

> [accordion] Which automations appear in n8n?
>
> Only automations with **API** or **n8n** as the data source will appear. To use an automation with n8n, go to DocsAutomator, open your automation settings, and change the **Data Source** to "API" or "n8n".

> [accordion] How do I handle errors in my workflow?
>
> Use **Continue On Fail** on the DocsAutomator node, create an **Error Trigger** workflow, or use an **IF node** to check for error conditions.

## E-Signatures and PDF Templates

> [!NOTE]
>
> DocsAutomator supports [e-signatures](https://docsautomator.co/docs/features/docsautomator-esign.md) with all data sources, including n8n. After generating a document, you can automatically route it for signing. DocsAutomator also supports [PDF templates](https://docsautomator.co/docs/docsautomator-basics/pdf-template-guide.md) in addition to Google Doc templates.

## Resources

> [card] [n8n Documentation](https://docs.n8n.io/)
>
> Official n8n documentation

> [card] [Community Nodes Guide](https://docs.n8n.io/integrations/community-nodes/)
>
> Learn about n8n community nodes

> [card] [DocsAutomator API](https://docsautomator.co/docs/integrations-api/docsautomator-api.md)
>
> API reference documentation

> [card] [Template Guide](https://docsautomator.co/docs/docsautomator-basics/google-doc-template-guide.md)
>
> Learn the template syntax


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.