JSPM

@sharpapi/sharpapi-node-invoice-parsing

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q43031F
  • License MIT

SharpAPI.com Node.js SDK for parsing invoices from uploaded files

Package Exports

  • @sharpapi/sharpapi-node-invoice-parsing
  • @sharpapi/sharpapi-node-invoice-parsing/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@sharpapi/sharpapi-node-invoice-parsing) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

SharpAPI GitHub cover

Invoice Parsing API for Node.js

Parse invoices and extract structured data from uploaded files -- powered by SharpAPI AI.

npm version License

SharpAPI Invoice Parser extracts structured data from invoice files (PDF, DOC, DOCX, images). Returns invoice number, dates, line items, totals, tax details, and buyer/seller information in a clean JSON format.


Table of Contents

  1. Requirements
  2. Installation
  3. Usage
  4. API Documentation
  5. Response Format
  6. Examples
  7. Use Cases
  8. License

Requirements

  • Node.js >= 16.x
  • npm or yarn

Installation

Step 1. Install the package via npm:

npm install @sharpapi/sharpapi-node-invoice-parsing

Step 2. Get your API key

Visit SharpAPI.com to get your API key.


Usage

const { SharpApiInvoiceParsingService } = require('@sharpapi/sharpapi-node-invoice-parsing');

const apiKey = process.env.SHARP_API_KEY; // Store your API key in environment variables
const service = new SharpApiInvoiceParsingService(apiKey);

async function parseInvoice() {
  try {
    // Submit invoice file for parsing
    const statusUrl = await service.parseInvoice('./invoices/invoice-2024-001.pdf');
    console.log('Job submitted. Status URL:', statusUrl);

    // Fetch results (polls automatically until complete)
    const result = await service.fetchResults(statusUrl);
    console.log('Result:', result.getResultJson());
  } catch (error) {
    console.error('Error:', error.message);
  }
}

parseInvoice();

API Documentation

Methods

parseInvoice(filePath, language?)

Parses an uploaded invoice file and extracts structured data.

Parameters:

  • filePath (string, required): Path to the invoice file

Supported file formats: DOC, DOCX, PDF, JPG, JPEG, PNG, TIFF, TIF

Returns: Promise - Status URL for polling results


Response Format

The API returns a structured JSON response with extracted invoice data:

{
  "data": {
    "type": "api_job_result",
    "id": "e00ebeec-6df3-4282-b515-8c447ea5d6ab",
    "attributes": {
      "status": "success",
      "type": "invoice_parse",
      "result": [
        {
          "source_pages": [
            1
          ],
          "document": {
            "type": "invoice",
            "original_type_label": "Invoice",
            "is_invoice": true,
            "is_copy": false,
            "copy_type": null
          },
          "invoice": {
            "invoice_number": "D7BDFA00-0019",
            "issue_date": "2025-12-07",
            "due_date": "2025-12-07",
            "document_date": null,
            "order_date": null,
            "delivery_date": null,
            "shipping_date": null,
            "pricing_date": null,
            "currency": "USD",
            "exchange_rate": null,
            "page_info": "1 of 1",
            "amount_in_words": "",
            "notes": "",
            "remarks": "",
            "delivery_instructions": "",
            "terms_and_conditions": [],
            "late_payment_interest_rate": null
          },
          "references": {
            "delivery_order_number": "",
            "purchase_order_number": "",
            "sales_order_number": "",
            "customer_reference": "",
            "external_document_number": "",
            "grn_number": "",
            "route_number": "",
            "lorry_number": "",
            "serial_number": "",
            "batch_number": "",
            "other_references": []
          },
          "e_invoice": {
            "uuid": "",
            "e_invoice_code": "",
            "e_invoice_type": "",
            "e_invoice_version": "",
            "submission_id": "",
            "submission_document_id": "",
            "submission_long_id": "",
            "submission_status": "",
            "validation_datetime": null,
            "digital_signature_present": false,
            "validated_link": "",
            "original_e_invoice_ref": "",
            "qr_code_present": false
          },
          "seller": {
            "name": "OpenAl, LLC",
            "trade_name": "OpenAl",
            "registration_number": "",
            "tin": "",
            "sst_id": "",
            "gst_id": "",
            "vat_id": "GB434338990",
            "msic_code": "",
            "business_activity": "",
            "address": {
              "street_line_1": "548 Market Street",
              "street_line_2": "PMB 97273",
              "city": "San Francisco",
              "state": "California",
              "postcode": "94104-5401",
              "country": "US"
            },
            "phone": "",
            "fax": "",
            "email": "",
            "website": "",
            "bank_details": [
              {
                "bank_name": "",
                "account_name": "",
                "account_number": "",
                "sort_code": "",
                "swift_code": "",
                "iban": ""
              }
            ],
            "contact_person": {
              "name": "",
              "role": "",
              "phone": "",
              "email": ""
            }
          },
          "buyer": {
            "name": "A2Z WEB LTD",
            "trade_name": "",
            "registration_number": "",
            "tin": "",
            "brn": "",
            "sst_id": "",
            "gst_id": "",
            "vat_id": "",
            "customer_account_number": "",
            "billing_address": {
              "location_name": "",
              "street_line_1": "Unit 10 Enterprise Court, Farfield",
              "street_line_2": "Park",
              "city": "Rotherham",
              "state": "",
              "postcode": "S63 5DB",
              "country": "GB"
            },
            "delivery_address": {
              "recipient_name": "",
              "location_name": "",
              "street_line_1": "Unit 10 Enterprise Court",
              "street_line_2": "Farfield Park",
              "city": "Rotherham",
              "state": "",
              "postcode": "S63 5DB",
              "country": "GB"
            },
            "delivery_address_same_as_billing": false,
            "phone": "",
            "fax": "",
            "email": "",
            "attention_to": {
              "name": "",
              "phone": "",
              "email": ""
            }
          },
          "sales_info": {
            "salesperson_name": "",
            "salesperson_code": "",
            "salesperson_phone": "",
            "sales_agent": "",
            "sales_location": "",
            "sales_department": "",
            "outlet_name": ""
          },
          "financials": {
            "subtotal": 15.57,
            "gross_amount": null,
            "total_discount_amount": null,
            "shipping_charge": null,
            "delivery_fee": null,
            "total_excl_tax": 15.57,
            "total_tax_amount": 3.11,
            "service_tax_amount": null,
            "total_incl_tax": 18.68,
            "rounding_adjustment": null,
            "total_payable": 18.68,
            "amount_paid": null,
            "amount_due": 18.68,
            "tax_details": [
              {
                "tax_type": "VAT",
                "tax_rate": 20,
                "taxable_amount": 15.57,
                "tax_amount": 3.11
              }
            ]
          },
          "line_items": [
            {
              "line_number": 1,
              "item_code": "",
              "stock_code": "",
              "barcode": "",
              "description": "OpenAl API usage credit",
              "classification_code": "",
              "country_of_origin": "",
              "quantity": 1,
              "free_quantity": null,
              "unit_of_measure": "",
              "unit_of_measure_raw": "",
              "pack_size": "",
              "total_units": null,
              "weight": null,
              "weight_uom": "",
              "unit_price": 15.57,
              "discount_percent": null,
              "discount_amount": null,
              "subtotal": 15.57,
              "tax_rate": 20,
              "tax_type": "VAT",
              "tax_amount": 3.11,
              "total_excl_tax": 15.57,
              "total_incl_tax": null,
              "expiry_date": null,
              "batch_lot_number": "",
              "service_start_date": null,
              "service_end_date": null
            }
          ],
          "payment": {
            "payment_terms": "",
            "payment_terms_days": null,
            "payment_method": "",
            "payment_date": null,
            "payment_reference": "",
            "jompay_biller_code": "",
            "jompay_ref_1": ""
          },
          "logistics": {
            "shipping_method": "",
            "vehicle_number": "",
            "driver_name": "",
            "delivery_zone": "",
            "delivery_time_constraint": "",
            "carton_count": null,
            "total_volume": null,
            "total_weight": null,
            "goods_received_confirmation": false,
            "received_by": "",
            "receiver_signature_present": false
          }
        }
      ]
    }
  }
}

Use Cases

  • Accounts Payable Automation: Extract data from vendor invoices for automatic entry into accounting systems
  • Expense Management: Parse receipts and invoices for expense tracking
  • Financial Auditing: Digitize and structure invoice data for audit trails
  • ERP Integration: Feed parsed invoice data into ERP systems (SAP, Oracle, etc.)
  • Tax Compliance: Extract tax IDs, amounts, and rates for tax reporting
  • Document Digitization: Convert paper invoices (scanned as images) into structured data

License

This project is licensed under the MIT License. See the LICENSE.md file for details.


Support