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 | Required | What it does | Example |
|---|---|---|---|
| Input Data Type | Required | Choose how to provide the PDF file to classify. Options: Binary Data, Base64 String, URL. Default is `Binary Data`. | Binary Data |
| Input Binary Field | Conditional | Name of the binary property that contains the PDF file (usually "data" for file uploads). Shown when Input Data Type is Binary Data. Default is `data`. | data |
| Base64 PDF Content | Conditional | Base64 encoded PDF document content. Shown when Input Data Type is Base64 String. | UEsDBBQABgAI... |
| PDF URL | Conditional | URL to the PDF file to classify. Shown when Input Data Type is URL. | |
| Document Name | Optional | Name of the document (used for processing). Default is `document.pdf`. | document.pdf |
| Output Binary Field Name | Optional | Not used: this operation returns no file, only the classification result as JSON. Default is `data`. | data |
| Advanced Options | Optional | Optional settings, collapsed behind Add Option. | Add Option |
| Custom Profiles | Optional | Use 'JSON' to adjust custom properties. Review Profiles at https://dev.pdf4me.com/apiv2/documentation/ to set extra options for API calls and may be specific to certain APIs. | { "OutputDataFormat": "json" } |
Output
Output Parameters
| Field | Type | What it contains |
|---|---|---|
_metadata | String | Object added by the node: success (always true), message (`Document classified successfully`), processingTimestamp (time the node received the result, ISO 8601), sourceFileName (the input file's name for Binary Data, the last part of the URL for URL, and Document Name for Base64) and operation (`classifyDocument`). |
All fields of the PDF4me response are copied into the item: the classification result, such as the class name of the document (className in the Power Automate connector). The exact fields depend on the PDF4me response.
All fields of PDF4me's response are copied into the item: the classification result, such as the class name of the document (className in the Power Automate connector). The exact fields depend on PDF4me's response.
JSON File Structure
The downloadable JSON file contains document classification data with the following format:
| Field | Type | What it contains |
|---|---|---|
_metadata | String | Object added by the node: success (always true), message (`Document classified successfully`), processingTimestamp (time the node received the result, ISO 8601), sourceFileName (the input file's name for Binary Data, the last part of the URL for URL, and Document Name for Base64) and operation (`classifyDocument`). |
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