Document Classification in Zapier
Classify Document is a Zapier action by PDF4me that matches PDF content against regex or JavaScript rules you define on dev.pdf4me.com and returns the matching Class Name. Use it to route invoices, contracts, and receipts to the right folder or workflow branch, no machine learning or training data required.
What this action does
PDF4me Classify Document takes one PDF and returns the Class Name that matches rules you created in advance, inside a Zap. Define classes such as pdf4me_invoice with a regex like invoice(.*) on the PDF4me dashboard, then use the returned Class Name in a Filter, Paths, Upload File, Google Sheets, or Airtable step to sort documents by type without writing or training a classifier.
Authenticating Your API Request
To access the PDF4me Web API through Zapier, every request must include proper authentication credentials.
Important Facts You Should Not Miss

Set up action panel: File is required, File Name is optional and built from the trigger's file name and extension
Parameters
Required in the Zapier UI: File. File Name is optional.
| Parameter | Required | What it does | Example |
|---|---|---|---|
| File | Required | The PDF file to classify. Map from your trigger (for example File from New File in Folder) or a previous step. | 1. File |
| File Name | Optional | Name of the PDF for identification in the response. Typically built from the trigger's File Name plus File Ext. | document.pdf |
pdf4me_invoice), choose Regular Expression or JavaScript, and enter a pattern such as invoice(.*). Click Save Changes before testing in Zapier.Output
| Field | Type | What it contains |
|---|---|---|
Trace Id | String | Unique identifier for the request, useful for support and debugging. |
Class Names | String | The matched class (for example pdf4me_invoice or Invoice). Empty or unmatched if no saved class matched the content. Use in a Filter, Paths, or file-naming step. |
How Do I Set Up Document Classification in Zapier?
- On dev.pdf4me.com, open Classify Document and add a class (Class Name plus a Regular Expression or JavaScript pattern), then click Save Changes.
- In your Zap, add PDF4me as the action app and choose Classify Document.
- Connect your PDF4me account or select an existing connection.
- Map File from your trigger or a previous step. Optionally map File Name.
- Test the step and confirm Class Names returns the class you expect.
- Use Class Names in a Filter or Paths step to branch your Zap, or in Upload File to name the output by document type.
When Should I Use Rule-Based Classification Instead of an ML Classifier?
Choose Classify Document when your document types are identifiable by a consistent phrase, header, or ID pattern (an invoice number format, a fixed contract title, a known form code) and you want a result immediately with no training phase. Choose a machine-learning classifier such as Google Cloud Natural Language or Amazon Comprehend when categories are fuzzy, content varies widely in wording, or you already have a labeled dataset to train against.
Typical Setups
Workflow ExamplesCommon Zapier patterns using Classify Document.
- A New File in Folder trigger (Dropbox, Google Drive, SharePoint) fires on a new PDF.
- Classify Document maps File and File Name, returning Class Names.
- A Paths step branches on Class Names: invoice goes one way, contract another.
- Upload File saves each branch to its own folder (Accounting/Invoices, Legal/Contracts).
- A New File in Folder trigger fires on an incoming PDF.
- Classify Document returns Class Names for the document.
- A Paths step runs Parse Document with the invoice template when Class Names is invoice, or the receipt template when it is receipt.
- Each path maps the extracted fields to its own downstream step.
- A New File in Folder trigger fires on an incoming PDF.
- Classify Document returns Class Names for the document.
- Upload File uses the original File from the trigger and sets Specify File Name to Class Names plus an underscore plus the original filename.
Practical Tips
Cheat Sheet
| Field | Value |
|---|---|
| Action | Classify Document |
| Classes defined at | dev.pdf4me.com Classify Document dashboard |
| File | Required, from trigger or previous step |
| File Name | Optional |
| Output | Trace Id, Class Names |
| Unmatched result | Empty/unmatched Class Names, not an error |
| Credits | 1 credit per classification run |
Common Questions
Related Actions
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