Skip to main content

Classify Document in Power Automate

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 Conditions, Switch, or follow-up actions to route, rename, or process documents by type in Microsoft 365 flows.

Important: Classification rules are defined and stored in your PDF4me account. Create your classes first at Classify Document, then use the action in Power Automate. For full setup, see Set Up Classify Document.

Authenticating Your API Request

To access the PDF4me Web API through Power Automate, every request must include proper authentication credentials. Authentication ensures secure communication and validates your identity as an authorized user.

Classify Document Power Automate

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(.*), contract(.*))
  • Flow Integration: Use Class Name in Conditions, Switch, SharePoint, OneDrive, and Microsoft 365 apps
  • One Credit per Classification: Each Classify Document run uses 1 credit

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.

ParameterTypeDescriptionExample
File Content***BinarySource Document Content
• Map file content from previous action
• Supports PDF and other document formats
• Can be from SharePoint, OneDrive, email
• Must be valid document file
[File Content from Get File]
File NameStringDocument File Name
• Name of the file to classify
• Used for processing identification
• Should include proper file extension
• Optional but recommended
Invoice_12345.pdf

Class setup: Create classes at Classify Document. Add a class (e.g. pdf4me_invoice) with a regex (e.g. invoice(.*)). Save Changes so Power Automate can use them.

Classify Document: Class Name, expression type (Regular Expression), regex invoice(.*)

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 content from your trigger or previous step if you need to pass the PDF onward.

Table View

Response data in a structured table format:

ParameterTypeDescription
Class NamesStringThe matched class (e.g. pdf4me_invoice, Invoice). Use in Conditions, Switch, or the next action
Trace IdStringUnique trace identifier for tracking and debugging

:::tip How Classify Document Works

  1. Create classes on dev.pdf4me.com: Go to Classify Document, click Edit, add classes with Class Name and Regular Expression (or JavaScript). Example: pdf4me_invoice with invoice(.*). Click Save Changes.
  2. Map File Content and File Name in Power Automate: The action takes File Content (required) and File Name (optional) from your trigger or previous step.
  3. Use Class Name in the next step: Route with Switch or Condition, apply metadata, or save to type-specific folders.

For detailed setup, see Set Up Classify Document. :::

Workflow Examples

The PDF4me Classify Document action in Power Automate provides comprehensive workflow templates designed for real-world business scenarios:

Route Invoices vs Contracts to Different Folders

Complete Workflow Steps:

  1. Trigger: Document uploaded to SharePoint or OneDrive folder
  2. Get File Content: Retrieve document from inbox
  3. Classify Document: Map File Content and File Name; action returns Class Names
  4. Switch on Class Names: Use Switch condition on Class Names
  5. Invoice Path: If invoice, route to AP processing workflow
  6. Contract Path: If contract, route to legal review workflow
  7. Receipt Path: If receipt, route to expense folder
  8. Save to SharePoint: Save in type-specific folder for each path

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.)

Industry Use Cases & Applications

Finance & Banking Use Cases

  • 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

Step-by-step guides to classify and route documents by type:

Get Help