File Uploading (Invoices)

These endpoints allow users to extract structured invoice data from text, PDFs, or image files using AI-powered document classification and field extraction.


🔸 POST /extract/invoice

Extract structured invoice data from plain text.

📥 Request Body:

{
  "text": "Invoice No: 2024-0021, Date: March 5, 2024, Total: $1,240.50..."
}

🔐 Auth Required: ✅ Yes

📤 Response:

{
  "vendor": "Acme Corp",
  "invoice_number": "2024-0021",
  "date": "2024-03-05",
  "total_amount": 1240.50,
  ...
}

✔️ Internally, this:

  • Classifies the document type (e.g. invoice, receipt, purchase order)

  • Extracts invoice data using structured format templates


🔸 POST /extract/pdf-image-text

Upload an invoice PDF or image file, and get structured invoice data extracted.

📥 Form-Data:

Field
Type
Required
Description

file

UploadFile

PDF, JPG, PNG, BMP supported

🔐 Auth Required: ✅ Yes

📤 Response:

{
  "invoice_number": "INV-1023",
  "vendor": "Tech Solutions Ltd.",
  "total_due": 982.75,
  ...
}

✔️ Supports:

  • .pdf, .jpg, .jpeg, .png, .bmp

  • In-memory file processing (no disk writes)

🧠 Behind the scenes:

  • Uses Groq-powered AI to classify + extract fields

  • Handles noisy OCR text, multi-page files, and embedded formats


📎 These endpoints are ideal for automating expense tracking, accounting system integration, and back-office document processing.

Last updated