Classify Document - Document Classification for Zapier
PDF4me Classify Document classifies PDF documents based on expressions (regular expressions or JavaScript) that you define on dev.pdf4me.com. You create document classes with search patterns—e.g. pdf4me_invoice with regex invoice(.*)—and when a PDF is sent to the action, PDF4me matches the document content against your rules and returns the Class Name. Use the Class Name in Filters, Paths, or follow-up actions to route, rename, or process documents by type.
Important: Classification rules are defined and stored in your PDF4me account. Create your classes first at Classify Document, then use the action in Zapier. For full setup, see Set Up Classify Document.
Authenticating Your API Request
To access the PDF4me Web API through Zapier, every request must include proper authentication credentials. Authentication ensures secure communication and validates your identity as an authorized user.
Key Features
- Expression-Based Classification: Define document classes with Regular Expression or JavaScript on dev.pdf4me.com
- Class Name Output: Returns the matched class (e.g.
pdf4me_invoice,Invoice) for routing and filtering - Custom Rules: Match document content with regex patterns (e.g.
invoice(.*),Invoice\s*#\s*Pdf4me-\d{6}-\d{5}) - Workflow Integration: Use Class Name in Filters, Paths, Upload File, Google Sheets, Airtable, and 6,000+ Zapier apps
- One Credit per Classification: Each Classify Document run uses 1 credit

Parameters
Important: Parameters marked with an asterisk (*) are required. Map values from your trigger or previous Zap steps.
| Parameter | Type | Description | Example |
|---|---|---|---|
| File* | File | The PDF file to classify. Map from your trigger (e.g. 1. File from New File in Folder) | 1. File |
| File Name | String | Name of the PDF file (e.g. base name + extension). Map 1. File Name + 1. File Ext from the trigger | document.pdf |
Class setup: Create classes at Classify Document. Add a class (e.g. pdf4me_invoice) with a regex (e.g. invoice(.*)). Save Changes so Zapier can use them.

Output
Classify Document returns the Class Name that matched your PDF based on your classification rules. It does not return or modify the PDF file. Use the file from your trigger or previous step if you need to pass the PDF onward.
| Parameter | Type | Description |
|---|---|---|
| Class Names | String | The matched class (e.g. pdf4me_invoice, Invoice). Use in Filters, Paths, or the next action |
| Trace Id | String | Unique trace identifier for tracking and debugging |
Example: If your PDF matches the pdf4me_invoice class, the output includes 2. Class Names = pdf4me_invoice. Use this in a Filter (only continue if Class Names = invoice), in Paths to branch your Zap, or in Upload File to name files by class.
:::tip How Classify Document Works
- Create classes on dev.pdf4me.com: Go to Classify Document, click Edit, add classes with Class Name and Regular Expression (or JavaScript). Example:
pdf4me_invoicewithinvoice(.*). Click Save Changes. - Map File and File Name in Zapier: The action takes File (required) and File Name (optional) from your trigger or previous step.
- Use Class Name in the next step: Route with Filters or Paths, rename files, or map to spreadsheets and databases.
For detailed setup, see Set Up Classify Document. :::
Workflow Examples
- Route by Document Type
- Parse by Document Type
- Rename by Class
Route Invoices vs Contracts to Different Folders
Complete Workflow Steps:
- Trigger: New File in Folder (Dropbox, Google Drive, SharePoint)
- Classify Document: Map 1. File and 1. File Name + 1. File Ext; action returns 2. Class Names
- Paths (or Filter): If 2. Class Names =
invoice, run path A; ifcontract, run path B - Upload File (path A): Save to
/Accounting/Invoices/; (path B) save to/Legal/Contracts/
Business Benefits:
- Automates document sorting by type using your regex/JavaScript rules
- Routes documents to the right folder without manual review
- Works with any classes you define (invoices, contracts, receipts, forms, etc.)
Different Parse Templates per Class
Complete Workflow Steps:
- Trigger: New File in Folder
- Classify Document: Get 2. Class Names
- Paths: If Class Names =
invoice, run Parse Document with invoice template; ifreceipt, run Parse Document with receipt template - Use Parse Info in the next step for each path
Business Benefits:
- Classify first, then parse with the right template
- Handles mixed document types with type-specific extraction
Rename Files by Document Type
Complete Workflow Steps:
- Trigger: New File in Folder
- Classify Document: Get 2. Class Names
- Upload File: Use 1. File (from trigger) for content; Specify File Name = 2. Class Names + underscore + original filename (e.g.
invoice_document.pdf)
Business Benefits:
- Prefix filenames with document type for searchability
- Same content, findable by class
Industry Use Cases & Applications
- Accounts Payable & Finance
- Legal & Professional Services
- General Document Management
- Invoice Routing: Route invoices by class (e.g. regex matching "invoice") to AP workflow
- Receipt Processing: Identify receipts for expense management using expression patterns
- Document Sorting: Organize financial documents by type using your classification rules
- Contract Identification: Classify contracts using regex (e.g.
contract(.*)) for contract management - Document Routing: Route documents to appropriate legal teams based on Class Name
- Case File Management: Classify case-related documents with custom expressions
- Mixed Folder Sorting: Sort mixed PDFs (invoices, receipts, forms) from one folder into type-specific folders
- Parse by Type: Use Class Name in Paths to run different Parse Document templates per document type
- Rename for Search: Prefix filenames with class for easier search and filing
Related Blogs
Step-by-step guides to classify and route documents by type: