Package Information
Available Nodes
Documentation
n8n-nodes-datamagik-docs

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
- Go to Settings → Community Nodes
- Enter
n8n-nodes-datamagik-docs - Click Install
Option 2: Manual Installation
npm install n8n-nodes-datamagik-docs
Restart your n8n instance for the node to be recognized.
Configuration
Credentials
- Create a new credential of type "DataMagik API"
- 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 templatename: Template namedescription: Template descriptionformat: Output format (pdf/html)version: Template versionbranch: Template branchcreated_at: Creation timestampupdated_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