n8n Integration
Anyparser integrates with n8n to enable document parsing in your automated workflows without writing any code. This guide shows you how to use Anyparser with n8n’s drag-and-drop interface.
Prerequisites
- An active n8n instance (cloud or self-hosted)
- Anyparser API credentials
- Basic understanding of n8n workflows
Setting Up Anyparser in n8n
1. Add Credentials
- Go to Settings → Credentials
- Click Add Credential
- Search for “HTTP Request”
- Configure the credentials:
Name: Anyparser APIAPI Key: your-api-key
2. Configure HTTP Request Node
- Add an “HTTP Request” node to your workflow
- Configure the node:
Method: POSTURL: https://anyparserapi.com/parse/v1Authentication: Anyparser API (created in step 1)Headers:Content-Type: multipart/form-data
Basic Document Parsing
Create a workflow to parse a single document:
-
HTTP Request Node Configuration:
{"format": "json","model": "text","image": true,"table": true,"files": ["data/document.pdf"]} -
Response Processing:
- Add a “Set” node to extract specific fields
- Use dot notation to access response data:
markdown: {{$json.markdown}}total_characters: {{$json.total_characters}}
Advanced Workflows
1. Batch Document Processing
Process multiple documents in sequence:
-
Split In Batches Node:
- Configure batch size
- Set iteration mode
-
HTTP Request Node:
{"format": "json","model": "text","files": {{$json.files}}} -
Merge Node:
- Combine results
- Aggregate statistics
2. OCR Workflow
Set up OCR processing for images and scanned documents:
-
HTTP Request Node:
{"format": "json","model": "ocr","ocr_language": ["eng"],"ocr_preset": "document","files": {{$json.files}}} -
IF Node:
- Check OCR success
- Handle errors
3. Web Crawling Workflow
Create a web crawling workflow:
-
HTTP Request Node:
{"format": "json","model": "crawler","url": {{$json.url}},"max_depth": 2,"max_executions": 10} -
Filter Node:
- Filter by status code
- Extract specific URLs
Error Handling
Implement proper error handling in your workflows:
-
Error Trigger Node:
- Catch HTTP errors
- Handle timeouts
-
IF Node:
Condition: {{$json.statusCode}} !== 200 -
Send Email Node:
- Notify on errors
- Include error details
Example Workflows
1. Document Processing Pipeline
graph LR A[Read File] --> B[HTTP Request] B --> C[Process Response] C --> D[Save Results] B --> E[Error Handler]
2. OCR Processing Pipeline
graph LR A[Image Input] --> B[HTTP Request] B --> C[Extract Text] C --> D[Validate Results] D --> E[Store Data]
Best Practices
-
Workflow Design
- Use meaningful node names
- Add comments for clarity
- Group related nodes
- Test with sample data
-
Error Management
- Add error handlers
- Implement retries
- Log errors
- Set up notifications
-
Resource Management
- Process in batches
- Implement rate limiting
- Monitor API usage
- Clean up temporary files
-
Security
- Secure credentials
- Validate input data
- Sanitize outputs
- Monitor access
Common Use Cases
-
Document Processing
- Batch process documents
- Extract specific content
- Generate summaries
- Convert formats
-
OCR Processing
- Process scanned documents
- Extract text from images
- Handle multiple languages
- Validate results
-
Web Crawling
- Crawl websites
- Extract content
- Monitor changes
- Archive data
-
Data Integration
- Connect to databases
- Update CRM systems
- Generate reports
- Trigger notifications