Integration guide

AgentGen + n8n

Add PDF and image generation to any n8n workflow using a single HTTP Request node. Pass HTML in, get a hosted CDN URL back — no custom code required.

Video walkthrough

How it works

AgentGen exposes a simple REST API. In n8n, you use an HTTP Request node to POST your HTML and receive a hosted file URL. No credentials setup beyond adding your API key as a header.

1. Configure the HTTP Request node

Node settings
MethodPOST
URLhttps://www.agent-gen.com/api/v1/generate/pdf
AuthenticationNone (add header manually)
Header — X-API-Keyyour API key
Body Content TypeJSON

2. JSON body — generate a PDF

{
  "html": "{{ $json.html }}",
  "format": "A4",
  "margin": {
    "top": "20mm",
    "bottom": "20mm",
    "left": "15mm",
    "right": "15mm"
  },
  "print_background": true
}

3. JSON body — generate an image

{
  "html": "{{ $json.html }}",
  "width": 1200,
  "height": 630,
  "format": "png"
}

4. Use the URL in the next node

The response contains a url field pointing to your generated file on the CDN. Reference it in downstream nodes with:

{{ $json.url }}
// e.g. https://cdn.agent-gen.com/output/abc123.pdf

Use the URL to send the file via email (Gmail/Outlook node), attach it to a Slack message, store it in Google Drive, or return it from a webhook — anything that accepts a URL works.

Try without an API key

You can test the integration without signing up. Skip the X-API-Key header and the API will return a real file with a small watermark, rate-limited to 1 request per minute. Perfect for validating your workflow before committing.

2 tokens/page

PDF cost

1 token

Image cost

< 2 seconds

Latency

Add document generation to your n8n workflow

50 free tokens on signup. No credit card required.