Skip to main content
Classify Document

Know the document type before you parse it.

Send a PDF and PDF4me predicts whether it is an invoice, contract, receipt or another type, with a confidence score. Use it as the routing step that sorts a mixed batch, then parses each file by type.

Run it anywhere

Classify Document, on every platform.

Add Classify Document as a native no-code action, or call the same operation from the REST API. Build it once, then route on the returned type everywhere.

How it works

One POST, one classification.

  • Get your API key. Grab a key from the dashboard and send it in the header as Authorization: Basic YOUR_API_KEY.
  • POST the document. Base64-encode the PDF and send it as docContent with a docName to /api/v2/ClassifyDocument.
  • Read the verdict. The response returns documentType, category and a confidence score between 0.0 and 1.0.
  • Branch on confidence. Route high-confidence files automatically; queue low-confidence ones for a quick review.
  • Go async for big jobs. Set async: true to get a 202 and a Location URL you poll until the result is ready.
POST /api/v2/ClassifyDocument type + category confidence 0.0-1.0
classify-document.sh
curl -X POST https://api.pdf4me.com/api/v2/ClassifyDocument \
  -H "Authorization: Basic YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "docContent": "<base64 PDF>",
    "docName": "incoming.pdf"
  }'
What comes back

A clean JSON verdict, ready to route on.

  • documentTypeThe identified type of the document, such as invoice, contract or report.
  • categoryThe broader group the document belongs to, for example financial, legal or business.
  • confidenceA score from 0.0 to 1.0 for how sure the model is. The threshold for auto-routing is yours to set.
  • metadataExtra document details returned alongside the result, including page count and creation date.
response.json
{
  "documentType": "invoice",
  "category": "financial",
  "confidence": 0.95,
  "metadata": {
    "pageCount": 1,
    "createdDate": "2024-01-15T10:30:00Z"
  }
}
Pick your approach

Three ways to classify, one place to run them.

Start with built-in detection, tighten it with your own rules, or let an AI Analyzer route and extract together. Each one returns a label your workflow can branch on.

Built-in type detection

Call ClassifyDocument as-is and get documentType, category and confidence with zero configuration. The fastest way to sort a mixed pile.

Your own expression rules

In the dashboard, define Class Names with a Search Text pattern, a Regular Expression or JavaScript. PDF4me matches your rules and returns your Class Name.

AI Classify Analyzer

Create one Analyzer, add a Schema per document variant with a natural-language Classification Prompt. The AI routes each PDF and extracts its fields in one call.

Get your documents done.

Build it into your product with the API, automate it with no code, or use the free tools in your browser. No credit card to begin.

Start with a single callcurl -X POST https://api.pdf4me.com/v1/ConvertToPdf

Free tier · No credit card required