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

# n8n Integration

> Automate PDF generation workflows by connecting n8n with pdf noodle

Integrate pdf noodle with [n8n](https://n8n.io) to automate your PDF generation workflows. Create invoices, reports, certificates, and any other documents automatically—no code required.

## Prerequisites

Before you begin, make sure you have:

* A pdf noodle account ([sign up here](https://app.pdfnoodle.com/auth/sign-up))
* Your API key from [API Settings](https://app.pdfnoodle.com/settings/api)
* At least one template created in pdf noodle
* n8n installed ([cloud](https://n8n.io) or [self-hosted](https://docs.n8n.io/hosting/))

***

## Setting Up the Integration

n8n connects to pdf noodle using the **HTTP Request node**.

<Steps>
  <Step title="Create a New Workflow">
    In n8n, create a new workflow and add your trigger (e.g., Webhook, Schedule, or any app trigger).
  </Step>

  <Step title="Add HTTP Request Node">
    Click the **+** button and search for **HTTP Request**.
  </Step>

  <Step title="Configure the Request">
    Set up the HTTP Request node:

    | Setting            | Value                                        |
    | ------------------ | -------------------------------------------- |
    | **Method**         | `POST`                                       |
    | **URL**            | `https://api.pdfnoodle.com/v1/pdf/sync`      |
    | **Authentication** | `Predefined Credential Type` → `Header Auth` |
  </Step>

  <Step title="Set Up Authentication">
    Create a Header Auth credential:

    | Setting   | Value                 |
    | --------- | --------------------- |
    | **Name**  | `Authorization`       |
    | **Value** | `Bearer YOUR_API_KEY` |
  </Step>

  <Step title="Configure the Body">
    Select **Body** → **JSON** and add:

    ```json theme={null}
    {
      "templateId": "your-template-id",
      "data": {
        "customerName": "{{ $json.customer.name }}",
        "invoiceNumber": "{{ $json.order.id }}",
        "total": {{ $json.order.total }}
      }
    }
    ```

    Use n8n's expression syntax to map data from previous nodes.
  </Step>
</Steps>

***

## Finding Your Template ID

1. Go to [app.pdfnoodle.com](https://app.pdfnoodle.com)
2. Navigate to the **Templates** section
3. Copy the Template ID shown in the list next to your template

***

## Response

When the request succeeds, you'll receive:

```json theme={null}
{
  "signedUrl": "https://pdforge-production.s3.us-east-2.amazonaws.com/...",
  "metadata": {
    "executionTime": "1.805 seconds",
    "fileSize": "4.066 kB"
  }
}
```

Use the `signedUrl` in subsequent nodes to send via email, upload to storage, or attach to records.

***

## Example Workflow

A typical workflow that generates an invoice when a new order is received:

1. **Webhook Trigger** - Receives order data
2. **HTTP Request** - Generates the PDF with pdf noodle
3. **Send Email** - Sends the PDF to the customer using `{{ $json.signedUrl }}`

***

## Error Handling

<AccordionGroup>
  <Accordion title="401 Unauthorized">
    * Verify your API key is correct
    * Ensure the Authorization header format is `Bearer YOUR_API_KEY`
  </Accordion>

  <Accordion title="400 Bad Request">
    * Check your JSON syntax is valid
    * Ensure all required template variables are provided
    * Verify the template ID exists
  </Accordion>

  <Accordion title="Template Not Found">
    * Double-check the Template ID
    * Ensure the template exists in your pdf noodle account
  </Accordion>
</AccordionGroup>

***

## API Endpoints

| Endpoint                    | Description                               |
| --------------------------- | ----------------------------------------- |
| `POST /v1/pdf/sync`         | Generate PDF from template (synchronous)  |
| `POST /v1/pdf/async`        | Generate PDF from template (asynchronous) |
| `POST /v1/html-to-pdf/sync` | Convert HTML to PDF (synchronous)         |

<Info>
  See the complete [API Reference](/api-reference) for all endpoints and options.
</Info>

***

<Note>
  You can also generate PDFs using any HTTP Request node by calling the pdf noodle API directly. See the [API Reference](/api-reference) for all available endpoints and options.
</Note>

## Resources

* [n8n Integration Page](https://pdfnoodle.com/integrations/n8n) - pdf noodle + n8n overview
* [n8n Automation Guide](https://pdfnoodle.com/blog/how-to-automate-pdf-generation-with-n8n-and-pdforge) - Step-by-step tutorial
* [n8n Documentation](https://docs.n8n.io) - Official n8n docs
* [pdf noodle API Reference](/api-reference) - Full API documentation
