Back to Prompts
Data ExtractionGPT-4o
Extract Invoice Data
Prompt
Extract all relevant data from the following invoice into structured JSON format.
Invoice:
{{invoice_text}}
Return the data in this exact JSON structure:
{
"invoice_number": "[Invoice/Reference number]",
"invoice_type": "[invoice/credit_note/proforma/quote]",
"invoice_date": "[YYYY-MM-DD]",
"due_date": "[YYYY-MM-DD or null]",
"vendor": {
"name": "[Company name]",
"address": "[Full address]",
"tax_id": "[VAT/Tax ID or null]",
"email": "[Email or null]",
"phone": "[Phone or null]"
},
"bill_to": {
"name": "[Customer/Company name]",
"address": "[Full address or null]",
"contact": "[Contact name or null]"
},
"line_items": [
{
"description": "[Item description]",
"quantity": [number],
"unit_price": [number],
"amount": [number],
"tax_rate": [percentage as number or null]
}
],
"subtotal": [number],
"tax_amount": [number or null],
"discount": [number or null],
"total": [number],
"currency": "[3-letter currency code, e.g., USD, EUR, GBP]",
"payment_terms": "[e.g., Net 30, Due on receipt, or null]",
"payment_methods": ["[Method 1]", "[Method 2]"],
"bank_details": {
"bank_name": "[Bank name or null]",
"account_number": "[Last 4 digits only or null]",
"routing_number": "[Routing/Sort code or null]"
},
"notes": "[Any additional notes or null]",
"po_number": "[Purchase order reference or null]"
}
Rules:
- All monetary amounts should be numbers without currency symbols
- Dates must be in YYYY-MM-DD format
- Use null for missing fields, never omit them
- For bank details, only include last 4 digits of account numbers for security
- Ensure line_items amounts match quantity × unit_price
- Verify subtotal + tax - discount = total (flag discrepancies in notes)
- Identify if this is a credit note (negative amounts) or proforma/quote (not yet due)
- Return valid JSON onlyExample
Input
INVOICE #2024-0892 From: CloudTech Solutions... To: Acme Manufacturing...
Output
{
"invoice_number": "2024-0892",
"invoice_date": "2024-03-15"...