Invoice fields

 

 

General fields structure

 

Each invoice object contains a set of different fields.

 

To acces an invoice object, you need to create a mindee.Client and call the Client.parse_invoice method:

 

from mindee import Client

# Instantiate your client
mindee_client = Client(invoice_token="your_token_here")

# Call the Mindee invoice endpoint and parse the result
invoice_data = mindee_client.parse_invoice("/path/to/my/file")

 

Whatever the field type, each of them contains the four following attributes:

 

  • Value: (Str or Float depending on the field type), corresponds to the field value. Set to None if the field was not extracted.
  • Probability: (Float), confidence score of the field prediction.
  • bbox:(Array[Float]), contains the relative vertices coordinates of the bounding box containing the field in the image. If the field is not written, the bbox is an empty array. 
  • reconstructed: (Bool), True if the field was reconstructed using other fields.

 

Depending on the Field type, there can be extra attributes.

 

 

 

Total amounts

 

 Invoice.total_incl: Total amount including taxes

# To get the total amount including taxes value (float), ex: 14.24
total_incl = invoice_data.invoice.total_incl.value

 

 Invoice.total_excl: Total amount excluding taxes

# To get the total amount excluding taxes value (float), ex: 10.21
total_excl = invoice_data.invoice.total_excl.value

 

Invoice.total_tax: Total tax value reconstructed from tax lines

# To get the total tax amount value (float), ex: 8.42
total_tax = invoice_data.invoice.total_tax.value

 

 

Taxes

 

invoice.taxes: Array of Tax fields

Each of the tax field has two extra attributes:

 

  • code: (String), Optional tax code. (HST, GST... for canadian; City Tax, State tax for US etc..)
  • rate: (Float), Optional tax rate.

 

# To get the list of taxes
taxes = invoice_data.invoice.taxes

# Loop on each Tax field
for tax in taxes:
   # To get the tax amount
   tax_amount = tax.value

   # To get the tax code for from a tax object
   tax_code = tax.code
  
   # To get the tax rate
   tax_rate = tax.rate

 

 

 

Dates

 

Each date field comes with an extra attribute:

 

  • date_object: (Datetime), datetime object from python datetime.date library

 

 

 invoice.invoice_date: Date of issuance of the invoice

# To get the invoice date of issuance (string)
invoice_date = invoice_data.invoice.invoice_date.value

 

invoice.due_date: Payment due date of the invoice

# To get the invoice due date (string)
due_date = invoice_data.invoice.invoice_date.value

 

 

 

Supplier informations

 

 Invoice.supplier: Supplier name as written in the invoice (logo or supplier infos

# To get the supplier name
supplier_name = invoice_data.invoice.supplier.value

 

 

Invoice.payment_details: List of invoice's supplier payment details informations.

Each object in the list contains extra attributes:

 

  • iban: (String)
  • swift: (String)
  • routing_number: (String)
  • account_number: (String)

 

# To get the list of payment details
payment_details = invoice_data.invoice.payment_details

# Loop on each object
for payment_detail in payment_details:
   # To get the IBAN
   iban = payment_details.iban

   # To get the swift
   swift = payment_details.swift

   # To get the routing number
   routing_number = payment_details.routing_number

   # To get the account_number
   account_number = payment_details.account_number

 

 

Invoice.company_number:  List of detected company registration number.

Each object in the list contains an extra attribute:

 

  • type: (String), Generic: VAT NUMBER, TAX ID, GST NUMBER, COMPANY REGISTRATION NUMBER or country specific: TIN (United States), GST/HST (Canada), SIREN/SIRET (France), UEN (Singapore), STNR (Germany), KVK (NL), CIF (Spain), NIF (Portugal), CVR (Denmark), CF (Italy), DIC (Czech Republic), RFC (Mexico), GSTIN (India) ...etc

 

# To get the list of company numbers
company_registration_numbers = invoice_data.invoice.company_number

# Loop on each object
for company_number in company_registration_numbers:
   # To get the type of number
   company_number_type = company_number.type

   # To get the company number
   company_number_value = company_number.value

 

 

Locale and currency

 

locale: Language ISO code

Contains an extra attribute:

 

  • currency: (String), ISO currency code

 

# To get the total language code
language = invoice_data.invoice.locale.value

# To get the invoice currency code
currency = invoice_data.invoice.locale.currency