Skip to main content

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.

Related Blog Posts
No blog post yet for this feature — coming soon.
In the meantime, browse the PDF4me blog for tutorials and workflows across every platform.
Visit the blog →

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

Classes live on dev.pdf4me.com, not in Zapier
Create and edit classes (Class Name plus a Regular Expression or JavaScript pattern) on the Classify Document dashboard first. The Zapier action only evaluates a PDF against whatever classes already exist in your account.
Rule-based, not machine learning
Unlike ML classifiers that need labeled training data and a fixed taxonomy, this action matches content against a regex or JavaScript expression you write. No training runs, no confidence thresholds to tune, you control exactly what text identifies each class.
Only File is required
File Name is optional and used only for identification. The action does not return or alter the PDF itself, keep using the original File reference from your trigger for any downstream step.
Zapier Classify Document action Configure panel showing File mapped from trigger and File Name built from File Name plus File Ext

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.

ParameterRequiredWhat it doesExample
FileRequiredThe PDF file to classify. Map from your trigger (for example File from New File in Folder) or a previous step.1. File
File NameOptionalName of the PDF for identification in the response. Typically built from the trigger's File Name plus File Ext.document.pdf
Creating a class
On the Classify Document dashboard, click Edit, add a Class Name (for example pdf4me_invoice), choose Regular Expression or JavaScript, and enter a pattern such as invoice(.*). Click Save Changes before testing in Zapier.

Output

FieldTypeWhat it contains
Trace IdStringUnique identifier for the request, useful for support and debugging.
Class NamesStringThe 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?

  1. On dev.pdf4me.com, open Classify Document and add a class (Class Name plus a Regular Expression or JavaScript pattern), then click Save Changes.
  2. In your Zap, add PDF4me as the action app and choose Classify Document.
  3. Connect your PDF4me account or select an existing connection.
  4. Map File from your trigger or a previous step. Optionally map File Name.
  5. Test the step and confirm Class Names returns the class you expect.
  6. 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.
Route invoices vs contracts to different folders
  1. A New File in Folder trigger (Dropbox, Google Drive, SharePoint) fires on a new PDF.
  2. Classify Document maps File and File Name, returning Class Names.
  3. A Paths step branches on Class Names: invoice goes one way, contract another.
  4. Upload File saves each branch to its own folder (Accounting/Invoices, Legal/Contracts).
Classify first, then parse with the matching template
  1. A New File in Folder trigger fires on an incoming PDF.
  2. Classify Document returns Class Names for the document.
  3. A Paths step runs Parse Document with the invoice template when Class Names is invoice, or the receipt template when it is receipt.
  4. Each path maps the extracted fields to its own downstream step.
Prefix filenames with the detected class
  1. A New File in Folder trigger fires on an incoming PDF.
  2. Classify Document returns Class Names for the document.
  3. 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

Test your regex on dev.pdf4me.com before wiring the Zap
Save Changes only commits a class once its pattern actually matches sample content. Confirm the class works in the dashboard test panel first, then map File in Zapier.
Always handle the unmatched case
Class Names comes back empty or unmatched when no saved class fits, this is not an error. Add a default Paths branch or a catch-all Filter so unclassified documents still land somewhere reviewable.
Keep patterns specific to avoid false matches
A broad regex like invoice(.*) can also match a contract that happens to mention the word invoice. Anchor patterns to consistent headers, ID formats, or fixed phrases unique to each document type.
The action does not return the PDF itself
Only Class Names and Trace Id come back. Keep referencing the original File from your trigger for any follow-up step like Upload File or Parse Document.
JavaScript expressions unlock logic regex cannot
For classification rules that need more than pattern matching, for example combining two conditions, use a JavaScript expression class instead of a Regular Expression class.

Cheat Sheet

FieldValue
ActionClassify Document
Classes defined atdev.pdf4me.com Classify Document dashboard
FileRequired, from trigger or previous step
File NameOptional
OutputTrace Id, Class Names
Unmatched resultEmpty/unmatched Class Names, not an error
Credits1 credit per classification run

Common Questions

How is this different from AI or machine-learning document classification?+
Services like <a href="https://cloud.google.com/natural-language/docs/classifying-text" target="_blank" rel="noopener noreferrer">Google Cloud Natural Language</a> and <a href="https://docs.aws.amazon.com/comprehend/latest/APIReference/API_ClassifyDocument.html" target="_blank" rel="noopener noreferrer">Amazon Comprehend</a> classify text with trained machine-learning models and a predefined category taxonomy. PDF4me Classify Document instead matches PDF content against a regex or JavaScript rule you write and store on dev.pdf4me.com. There is no model training, no taxonomy to adopt, and no confidence score to tune, you decide exactly what pattern identifies each document type.
Where do I create document classes?+
Classes are created and stored in your PDF4me account, not inside Zapier. Open the Classify Document dashboard on dev.pdf4me.com, add a Class Name with a Regular Expression or JavaScript pattern, and click Save Changes. The Zapier action only evaluates a PDF against classes that already exist in your account.
What does the action return if no class matches?+
Class Names comes back empty or unmatched rather than throwing an error when the PDF content does not match any saved expression. Route this case through a Filter or a default Paths branch so unclassified documents still land somewhere reviewable instead of silently disappearing from the workflow.
Can I classify a document without sending the PDF content again in the next step?+
Yes. Classify Document returns only Class Names and Trace Id, it does not return or modify the PDF file itself. Keep referencing the File field from your trigger or an earlier step for any follow-up action such as Upload File, Parse Document, or an email attachment.

Industry Use Cases & Applications

  • 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

Get Help