Getting started with our API: document upload

When you visit https://<organisation_name>.contract-<environment>.fit/apidoc/ (replace <organisation_name> by your organization name and <environment> by the desired environment (t, q or p)), you will see the following API documentation page (swagger/openAPI):

The first endpoint (/documents/) is the simplest, most straightforward way to process documents though our API. When clicking to expand, then clicking “Try it out” in the top right corner, we obtain:

Here, we can click “Choose file” to select a file of our choice (pdf, any image file, office documents or text files are supported). The inbox id is an optional field to specify a specific inbox if desired. When left empty, it will default to a preconfigured “invoice” inbox.

The “key_value_flag” here determines whether we want to receive our results in a simplified, key-value format, or the extended JSON with all details on the processed document.

Let us illustrate the two available returned JSONs for the Bruneau invoice example below:

When leaving “key_value_flag” to true, we will receive key value output, which looks like the following example:

[{'IBAN': 'BE90290050800032', 'VAT_number': 'BE0665922717', 'amount_payable': 152.11, 'currency': 'EUR', 'due_date': '2017-10-03', 'gross_amount': 152.11, 'invoice_date': '2017-10-05', 'invoice_number': '10.837.642', 'net_amount': 143.5, 'sender_name': 'S.A JM Bruneau NV', 'tax_amount': 8.61, 'type': 'invoice'}]

When “key_value_flag” is set to false, we receive all information, as such:

{ 'id': '5e8d96b1fbc2435097cbd31b', 'original_filename': 'tests/data/files/input.pdf', 'inbox': test_inbox, 'page_count': 1, 'prediction': { 'sections': [{'page': 0, 'document_type': 'invoice', 'format': test_format, 'confidence': 100}], 'lines': {}, 'annotations': {'IBAN': [{'confidence': 100, 'lower_right': [0, 4, 33], 'text': 'BE90 2900 5080 0032', 'upper_left': [0, 4, 14], 'value': 'BE90290050800032', 'version': 'e3019c47-5863-33a6-b641-0a1fa74daf28'}], 'VAT_number': [{'confidence': 100, 'lower_right': [0, 3, 28], 'text': 'BE 0465.015.822', 'upper_left': [0, 3, 13], 'value': 'BE0465015822', 'version': 'f39a0bf7-b87d-367a-856e-25319d90eea5'}, {'confidence': 100, 'lower_right': [0, 21, 99], 'text': 'BE0665922717', 'upper_left': [0, 21, 87], 'value': 'BE0665922717', 'version': 'f39a0bf7-b87d-367a-856e-25319d90eea5'}], 'amount_payable': [{'confidence': 95, 'lower_right': [0, 34, 137], 'text': '152.11', 'upper_left': [0, 34, 131], 'value': 152.11, 'version': '352414c7-207d-3f58-9036-e976e8b084a6'}], 'currency': [{'confidence': 80, 'lower_right': [0, 0, -1], 'text': 'EUR', 'upper_left': [0, 0, -1], 'value': 'EUR', 'version': '2929180c-59d4-3736-ba06-53ea55e8e662'}], 'due_date': [{'confidence': 55, 'lower_right': [0, 7, 50], 'text': '03/10/2017', 'upper_left': [0, 7, 40], 'value': '2017-10-03', 'version': '8c7a59a0-c9f0-3eb5-b85b-b211f4afe940'}], 'gross_amount': [{'confidence': 95, 'lower_right': [0, 34, 137], 'text': '152.11', 'upper_left': [0, 34, 131], 'value': 152.11, 'version': '352414c7-207d-3f58-9036-e976e8b084a6'}], 'invoice_date': [{'confidence': 45, 'lower_right': [0, 7, 50], 'text': '03/10/2017', 'upper_left': [0, 7, 40], 'value': '2017-10-03', 'version': '8c7a59a0-c9f0-3eb5-b85b-b211f4afe940'}, {'confidence': 45, 'lower_right': [0, 29, 70], 'text': '05/10/2017', 'upper_left': [0, 29, 60], 'value': '2017-10-05', 'version': '8c7a59a0-c9f0-3eb5-b85b-b211f4afe940'}], 'invoice_number': [{'confidence': 85, 'lower_right': [0, 6, 50], 'text': '10.837.642 ', 'upper_left': [0, 6, 37], 'value': '10.837.642', 'version': 'feed3d51-6f17-3a9b-8f4c-17b84fb618fe'}], 'net_amount': [{'confidence': 88, 'lower_right': [0, 34, 19], 'text': '143.5', 'upper_left': [0, 34, 14], 'value': 143.5, 'version': '352414c7-207d-3f58-9036-e976e8b084a6'}], 'sender_name': [{'confidence': 100, 'lower_right': [0, 39, 105], 'text': 'S.A JM Bruneau NV', 'upper_left': [0, 39, 88], 'value': 'S.A JM Bruneau NV', 'version': 'b243cf89-43c4-3e0a-9908-93e5be680097'}], 'tax_amount': [{'confidence': 95, 'lower_right': [0, 33, 122], 'text': '8.61', 'upper_left': [0, 33, 118], 'value': 8.61, 'version': '352414c7-207d-3f58-9036-e976e8b084a6'}] } }, 'feedback': {}, 'evaluation_data': [], 'files': [{'filename': 'tests/data/files/input.pdf', 'page': 0, 'page_count': 1, 'filehash': '111c9e1a519b2ebf2f22eeea20e4b1805e5c0a614afa817c7940d347831e2020'}], 'usage_data': { 'annotations': 13, 'line_items': 0, 'lines': 0, 'pages': 1, 'sections': 1, 'total': 15 }, 'flag_for_review': True, 'lock': { 'value': False, 'since': None, 'by': None }, 'escalate': { 'value': False, 'since': None, 'by': None } }