Back to Templates

Classify documents with easybits Extractor via web form

Created by

Created by: Felix || easybits
Felix

Last update

Last update a day ago

Share


What This Workflow Does

Upload a document (PDF, PNG, or JPEG) via a hosted web form and let easybits Extractor classify it into one of your defined categories. This workflow handles the upload, file conversion, and API call – you just define the categories.

How It Works

  1. Form Upload – A user uploads a file through the n8n web form
  2. Base64 Conversion – The binary file is extracted and converted to a base64 string
  3. Build Data URI – The correct MIME type is read from the original upload and prepended to create a proper data URI
  4. Classification via easybits – The data URI is POSTed to the easybits Extractor API, which analyzes the document and returns a document_class label (e.g. medical_invoice, hotel_invoice, or null if uncertain)

From here, you can extend the workflow however you like – route files to Google Drive folders, send Slack alerts for unrecognized documents, log results to a spreadsheet, etc.


Setup Guide

1. Create Your easybits Extractor Pipeline

  1. Go to https://extractor.easybits.tech/ and create a new pipeline
  2. Add a single field to the mapping called document_class
  3. In that field's description, paste a classification prompt that tells the model which categories exist and how to identify each one.
  4. The prompt should instruct the model to return exactly one category label – or null if the document doesn't match any category. No explanations, no extra text.
  5. Adjust the categories to fit your use case. The example uses medical_invoice, restaurant_invoice, and hotel_invoice – but you can define whatever classes you need.
  6. Copy your Pipeline ID and API Key

2. Connect the Nodes in n8n

  1. In the easybits Extractor (Classification) HTTP node, replace the pipeline URL with your own: https://extractor.easybits.tech/api/pipelines/YOUR_PIPELINE_ID
  2. Create a Bearer Auth credential using your easybits API Key and assign it to that node

3. Activate & Test

  1. Click Active in the top-right corner of n8n
  2. Open the form URL and upload a test document
  3. Check the execution output – you should see your document_class label in the response