Classify Document using n8n action
PDF4me Classify Document automatically analyzes and categorizes PDF documents using AI-powered machine learning through n8n automation workflows. Process PDFs via n8n triggers, binary data, base64 strings, or public URLs to identify document types (invoices, contracts, receipts, forms, reports), extract classification metadata, confidence scores, alternative classifications, and structured JSON output for intelligent document routing. This solution is ideal for automated document sorting, content management systems, compliance workflows, mailroom automation, invoice processing, and intelligent document routing that require accurate AI-powered classification with real-time analysis and seamless integration.
Setup
Add the PDF4me "Classify Document" node to your n8n workflow and configure the required parameters. For initial setup instructions, see our n8n Integration Guide.
Prerequisites:
- PDF4me API credentials
- n8n workflow access
Configuration:
- Add PDF4me node to workflow
- Select "Classify Document" action
- Configure input parameters (see below)

Parameters
Complete list of parameters for the Classify Document action. Configure these parameters to control document classification.
Important: Parameters marked with an asterisk (***) are required and must be provided for the action to function correctly.
| Parameter | Type | Description | Example |
|---|---|---|---|
| Input Data Type*** | String | PDF Input Format Selection • Choose the format of your PDF data input • PDF4me supports multiple input types • Options: Binary Data, Base64 String, or URL | Binary Data |
| Input Binary Field | Binary | Binary PDF File Input (Required if Binary Data) • Reference PDF file from previous n8n node or file upload • PDF4me processes binary PDF files with automatic format detection • Required when Input Data Type is "Binary Data" | {{ $binary.data }} |
| Base64 Document Content | String | Base64 Encoded PDF Input (Required if Base64 String) • Provide PDF data as base64 encoded string • PDF4me automatically decodes and processes the PDF content • Required when Input Data Type is "Base64 String" | UEsDBBQABgAI... |
| File URL | String | Public PDF URL Input (Required if URL) • Provide a public/open permission URL to the PDF file • PDF4me downloads and processes the file from URL • Required when Input Data Type is "URL" | https://abc.com/sample.pdf |
| Document Name*** | String | Source PDF Reference • Specify the name of the source PDF file • For reference and tracking purposes in classification • Helps with processing tracking | invoice_2024.pdf |
Advanced Options
The following parameters are available in the Advanced Options section and are optional:
| Parameter | Type | Description | Example |
|---|---|---|---|
| Custom Profiles | String | Custom Configuration Profiles • Set additional options using custom profiles • JSON-like format containing predefined parameters • Enables advanced classification processing settings • Optional for specialized requirements | { "OutputDataFormat": "json" } |
Output
Output Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| fileName | String | PDF4me output file name - Name of the generated JSON file containing the classification results. The file contains all document classification information in JSON format | classification_results_1756990750241.json |
| mimeType | String | PDF4me file MIME type - MIME type of the output file, always "application/json" for JSON format classification data | application/json |
| fileSize | Number | PDF4me file size in bytes - Size of the generated JSON file in bytes, provided for storage planning and transfer monitoring | 221 |
| success | Boolean | PDF4me classification status indicator - Boolean flag indicating the success or failure of the document classification process. PDF4me returns true for successful classifications and false for any errors | true |
| message | String | PDF4me classification status message - Human-readable status message providing details about the classification process result. Includes success confirmation or error details for troubleshooting | Document classification completed successfully |
| docName | String | PDF4me source document reference - Original filename of the PDF document that was processed for classification | document.pdf |
JSON File Structure
The downloadable JSON file contains document classification data with the following format:
| Field | Type | Description | Example |
|---|---|---|---|
| className | String | PDF4me document class identifier - The specific document class or category identified by the AI classification engine | invoice |
| confidence | Number | PDF4me classification confidence - Confidence score (0-1) indicating the reliability of the classification result | 0.95 |
| templateId | String | PDF4me template identifier - Unique identifier for the document template used in classification | 00000000-0000-0000-0000-000000000000 |
| classificationTimestamp | String | PDF4me classification timestamp - ISO 8601 timestamp indicating when the classification was completed | 2025-09-23T18:33:43.457Z |
| alternativeClassifications | Array | PDF4me alternative classifications - Array of alternative document types with their confidence scores | [{"type": "receipt", "confidence": 0.15}] |
N8N Action Response
The PDF4me Classify Document API returns a response that can be viewed in multiple formats. Choose the view that best fits your needs:
- JSON
- Table
- Schema
- Binary
JSON Response Format
The raw JSON response from the API:
[
{
"fileName": "classification_results_1756990750241.json",
"mimeType": "application/json",
"fileSize": 221,
"success": true,
"message": "Document classification completed successfully",
"docName": "document.pdf"
}
]
Table View
Response data in a structured table format:
| Parameter | Value |
|---|---|
| fileName | classification_results_1756990750241.json |
| mimeType | application/json |
| fileSize | 221 |
| success | true |
| message | Document classification completed successfully |
| docName | document.pdf |
Schema View
The data structure and types of the response:
1 item
fileName: AB classification_results_1756990750241.json
mimeType: AB application/json
fileSize: # 221
success: ☑ true
message: AB Document classification completed successfully
docName: AB document.pdf
Type Indicators:
AB= String#= Number☑= Boolean{}= Object[]= Array
Binary Data View
The actual JSON file data and metadata:
data
─────────────────────────────
File Name: classification_results_1756990750241.json
File Extension: json
Mime Type: application/json
File Size: 0.22 KB
JSON File Content Example:
{
"className": "invoice",
"templateId": "00000000-0000-0000-0000-000000000000",
"classificationTimestamp": "2025-09-23T18:33:43.457Z",
}
Use Cases
Document Classification and Routing
- Intelligent Document Routing: Download and process the JSON file to extract the
classNamefield for automatically routing documents to appropriate departments, systems, or processing queues based on their identified document type - Template-Based Processing: Leverage the
templateIdfrom the JSON file to apply specific document templates and processing rules for consistent handling of similar document types - Automated Workflow Triggers: Parse the JSON file and trigger specific n8n workflows based on the
classNamevalue to initiate document-specific business processes
Audit and Compliance Tracking
- Request Traceability: Use the generated JSON file for complete audit trails and request tracking throughout your document processing pipeline
- Processing Timestamp Monitoring: Utilize the
classificationTimestampfrom the JSON file to monitor processing times and ensure SLA compliance - Operation Logging: Track all classification operations using the JSON file for comprehensive activity logging and compliance reporting
Document Management and Organization
- Source File Tracking: Use the
docNamefield to maintain document lineage and track original file names through processing workflows - Success Status Monitoring: Implement error handling and retry logic based on the
successstatus for robust document processing - File-Based Management: Organize documents by processing the generated JSON files for consistent classification and document standardization
Related Blogs
Step-by-step guides to classify and route documents by type: