npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

n8n-nodes-datamagik-docs

v1.0.11

Published

n8n node for DataMagik document generation API

Downloads

32

Readme

n8n-nodes-datamagik-docs

n8n.io - Workflow Automation

This is an n8n community node for the DataMagik document generation API. It allows you to integrate document generation capabilities directly into your n8n workflows.

Features

  • List Templates: Get available document templates from your DataMagik account
  • Smart Document Generation: Create PDF or HTML documents from templates with automatic completion waiting
  • Automatic Polling: Built-in intelligent polling that waits up to 2 minutes for document completion
  • Binary Downloads: Automatically downloads binary data when using binary return type
  • Custom Settings: Configure page size, margins, orientation, and more

Installation

Follow the installation guide in the n8n community nodes documentation.

Option 1: Install via n8n

  1. Go to Settings → Community Nodes
  2. Enter n8n-nodes-datamagik-docs
  3. Click Install

Option 2: Manual Installation

npm install n8n-nodes-datamagik-docs

Restart your n8n instance for the node to be recognized.

Configuration

Credentials

  1. Create a new credential of type "DataMagik API"
  2. Enter your API Token (JWT Bearer token)

Test Credentials

The node includes a built-in credential test that verifies your API token by calling the /api/health endpoint against the DataMagik API at https://data-magik.com.

Operations

List Templates

Retrieves all available document templates for your account.

Output: Array of template objects with the following properties:

  • template_id: Unique identifier for the template
  • name: Template name
  • description: Template description
  • format: Output format (pdf/html)
  • version: Template version
  • branch: Template branch
  • created_at: Creation timestamp
  • updated_at: Last update timestamp

Generate Document

Creates a document from a template using provided data. Automatically waits for completion (up to 2 minutes).

Required Parameters:

  • Template ID: The ID of the template to use (always provide as string to avoid precision issues)
  • Format: Output format (PDF or HTML)
  • Return Type: How to return the document (URL or Binary)
  • Template Data: JSON object with data to populate the template

Optional Parameters:

  • Priority: Queue priority (Urgent, High, Normal, Low)
  • Custom Filename: Custom name for the generated file
  • Template Branch: Template branch to use (default: main)
  • Template Version: Specific template version
  • Force Regenerate: Force regeneration even if cached
  • Document Settings: Page size, orientation, margins, etc.

Automatic Behavior:

  • Queued/Processing: Automatically polls every 5 seconds until complete
  • URL Return Type: Returns the completed status object with download URL
  • Binary Return Type: Automatically downloads and returns binary data
  • Error Handling: Throws error if generation fails or times out (2 minutes)

Example Template Data:

{
	"customer_name": "John Doe",
	"invoice_number": "INV-001",
	"amount": 1000.0,
	"items": [{ "description": "Service A", "quantity": 1, "price": 1000.0 }]
}

Usage Examples

Basic Document Generation (Auto-Complete)

{
	"operation": "generate",
	"templateId": "1097823044285431810",
	"format": "pdf",
	"returnType": "url",
	"templateData": {
		"customer_name": "{{ $json.customer_name }}",
		"amount": "{{ $json.total_amount }}"
	}
}

Note: This will automatically wait up to 2 minutes for the document to be ready and return the complete status object.

Generate with Binary Download (Auto-Complete)

{
	"operation": "generate",
	"templateId": "1097823044285431810",
	"format": "pdf",
	"returnType": "binary",
	"templateData": {
		"customer_name": "John Doe"
	}
}

Note: This will automatically wait for completion and return the document as binary data.

Custom Document Settings

{
	"operation": "generate",
	"templateId": "1097823044285431810",
	"format": "pdf",
	"returnType": "url",
	"documentSettings": {
		"page_size": "Letter",
		"orientation": "landscape",
		"margin_top": 0.5,
		"margin_right": 0.5,
		"margin_bottom": 0.5,
		"margin_left": 0.5
	}
}

Important Notes

Template ID Precision

Always provide template IDs as strings to avoid JavaScript number precision issues:

Correct: "templateId": "1097823044285431810"
Incorrect: "templateId": 1097823044285431810

Queue vs Direct Generation

  • URL Return Type: Uses queue-based generation (recommended for production)
  • Binary Return Type: Direct generation (faster but limited to smaller documents)

Rate Limiting

The API implements rate limiting and quota management. Monitor the metadata section in responses for quota information.

Error Handling

The node includes comprehensive error handling for common scenarios:

  • Invalid authentication
  • Template not found
  • Quota exceeded
  • Template rendering errors
  • Network timeouts

Enable "Continue on Fail" in node settings to handle errors gracefully in workflows.

Support

  • Documentation: DataMagik API Documentation
  • Issues: Report issues on the GitHub repository
  • Community: Join the n8n community for support and discussions

License

MIT

Version History

1.0.0

  • Initial release
  • Support for all core DataMagik API operations
  • Queue-based document generation with polling
  • Comprehensive error handling
  • Binary data support for downloads