API Documentation
Klearstack is a SaaS application that extracts data from unstructured documents into a structured format using Artificial Intelligence. This document contains information about 4 REST API’s for our Invoices module.
Documentation includes:
- Description of API
- Input Parameters
- Success Response
- Method used in API
- URL for each API
Note: SSL verification must be turned off.
For E.g.
In python, post by passing verify = False parameter.
In Postman, turn off SSL Certificate Verification.
Upload A Single Invoice And Get Batch Id
Method |
URL |
POST |
URL/access/klearstack/uploadinvoice |
Type | Params | Values | Description |
POST | company_name | string | Name of the company |
POST | username | string | Username for a particular user of a company |
POST | password | string | Password for a particular user of a company |
POST | file | Binary | Single image (pdf/jpeg/png) or native pdf file |
POST | processing_pref | string | Either “Speed” or “Accuracy” (It’s not case sensitive) |
POST | document_type | string | Type of document to be processed -“Invoices” or “Receipts” or“PurchaseOrders” |
POST | invoice_type | string | “B2B” for invoices commissioned by a business to another business directly;“B2C” for invoices commissioned by a business to a consumer |
Status | Example Response |
200 |
{
“Function successfully executed!”: “169a4df0-52c4-4835-8bb4-10296c8e5e3a” } |
400 | {“error”: “Please provide username.”} |
400 | {“error”: “Please provide password.”} |
Upload Multiple Invoices In A Zip Folder And Get Batch Id
Method |
URL |
POST |
URL/access/klearstack/uploadbatch |
Type | Params | Values | Description |
POST | company_name | string | Name of the company |
POST | username | string | Username for a particular user of a company |
POST | password | string | Password for a particular user of a company |
POST | file | Binary |
Zip folder containing images/pdf |
POST | processing_pref | string | Either “Speed” or “Accuracy” (It’s not case sensitive) |
POST | document_type | string | Type of document to be processed -“Invoices” or “Receipts” or“PurchaseOrders” |
POST | invoice_type | string | “B2B” for invoices commissioned by a business to another business directly;“B2C” for invoices commissioned by a business to a consumer |
Status | Example Response |
200 |
{
“Function successfully executed!”: “169a4df0-52c4-4835-8bb4-10296c8e5e3a” } |
400 | {“error”: “Please provide username.”} |
400 | {“error”: “Please provide password.”} |
401 | {“error”: “Incorrect username or password.”} |
500 | {“error”: “Something went wrong. Please try again later.”} |
Get Extracted Results For Invoices In A Batch Id
Method |
URL |
POST |
URL/access/klearstack/getbatchinvoices |
Type | Params | Values | Description |
POST | company_name | string | Name of the company |
POST | username | string | Username for a particular user of a company |
POST | password | string | Password for a particular user of a company |
POST | format_number | string | Format type of a Invoice. (1–old format/2-new format) |
POST | batch_id | string | Batch ID of a specific batch. |
POST | approve_flag | string | If approve_flag is true, then it returns the invoices which are approved. |
POST | save_flag | string | If save_flag is true, then it returns the invoices which are saved |
Get Results of Invoices Accessible By A Specific User
Method |
URL |
POST |
URL/access/klearstack/getuserinvoices |
Type | Params | Values | Description |
POST | company_name | string | Name of the company |
POST | username | string | Username for a particular user of a company |
POST | password | string | Password for a particular user of a company |
POST | format_number | string | Format type of aInvoice. (1–old format/2-new format)format) |
POST | approve_flag | string | If approve_flag is true, then it returns the invoices which are approved. |
POST | save_flag | string | If save_flag is true, then it returns the invoices which are saved |
Get Results of Modified Invoices since the last pull
Method |
URL |
POST |
URL/access/klearstack/getmodifiedinvoices |
Type | Params | Values | Description |
POST | company_name | string | Name of the company |
POST | username | string | Username for a particular user of a company |
POST | password | string | Password for a particular user of a company |
POST | document_type | string |
Type of document to be processed – “Invoices” or“Receipts” or “PurchaseOrders”By default “Invoices” will beset if this parameter is not passed
Note: Optional Parameter |
Get Results of Approved Invoices using Date filter
Method |
URL |
POST |
URL/access/klearstack/getapproveinvoices |
Type | Params | Values | Description |
POST | company_name | string | Name of the company |
POST | username | string | Username for a particular user of a company |
POST | password | string | Password for a particular user of a company |
POST | document_type | string | Type of document to be processed – “Invoices” or“Receipts” or “PurchaseOrders”By default “Invoices” will beset if this parameter is not passed. Note: Optional Parameter |
POST | from_date | string | Date from which user wants approved invoices.Format : “DD/MM/YYYY” |
POST | to_date | string | Date till which user wants approved invoices.Format : “DD/MM/YYYY” |
POST | user_list | string | Name of users whose invoices are required.(comma separated)Ex. “Creator,Creator1”By default all users are considered. Note: Optional Parameter |
POST | QBE_status | string | Status of QBE integration.Only two values are considered“successful” or “failed” |
Status | Example Response |
200 | { “result”: [ { “approved_date”: “Wed Apr 14 2021”, “file_name”: “tata capital west bengal 5712.pdf”, “overall_confidence”: 0.917829326729445, “AccountsData”: { “LineItem1, 980001, Printing & Stationery, 49,357.00” ], “SplitAccounts”: [], “individualQuickBookAc”: [], “individualQbItemType”: [], “sgstv”: “”, “cgstv”: “”, }, “Inv_Date”: { “value”: “23 February, 2020”, “confidence”: 0.566981644843936, “page_index”: 1 }, “Inv_Number”: { “value”: “MATTB-2331”, “confidence”: 0.946715178008698, “page_index”: 1, 1283, 383, 1409, 409 ] }, “Inv_PO”: { 1287, 443, 1349, 468 ] }, “Inv_Total”: { 0, 0, 0, 0 ] }, “Inv_CGST_Value”: { }, “Inv_SGST_Value”: { “value”: “1661”, }, “Inv_CGST_Percent”: { “value”: “5”, }, “Inv_SGST_Percent”: { “value”: “5”, }, “Inv_Supplier”: { “value”: “Pai International Electronics Ltd”, “page_index”: 1, 0, 0, 0, 0 ], “confidence”: 0.805663607700772 }, “Inv_Customer”: { 406, 58, 795, 105 ], “confidence”: 0.954218689055312 }, “Inv_Type”: { }, “Inv_Currency”: { “value”: “INR”, “confidence”: 0.978, “page_index”: 1 }, “Inv_Origin”: { “value”: “India”, “confidence”: 0.978, “page_index”: 1 }, “Inv_Supplier_Address”: { “value”: “GST INVOICE , PAI INTERNATIONAL ELECTRONICS LTD. , Corporate Office: # 28/1A, 100 Feet Road, Indiranagar, Bangalore-560 – 560038.”, “page_index”: 1, “coordinate”: [ 406, 3, 1179, 157 ], “confidence”: 0.962132237592736 }, “Inv_Supplier_State”: { “value”: “Karnataka”, “confidence”: 0.95, “page_index”: 1 }, “Inv_Supplier_City”: { “value”: “Bengaluru”, “confidence”: 0.981349645091967, “page_index”: 1 }, “Inv_Supplier_Pincode”: { “value”: “560038”, }, “line_items”: [ { “Description”: “Dell Latitude 3400 C15 Intel Core I5 8265 U 8 Gb Ddr4 /512 Gb Ssd 14” Screen(1366×768) Intel Uhd Graphic 620 10/100/1000 Ehernate Port Window 10 Pro With Bag Pack”, “of Goods”: “”, “HSN Code”: “8471”, “Quantity”: “1 NOS”, }, 95, 776, 1343, 892 ] }, { “Description”: “3 year warranty Output IGST 18%”, “HSN Code”: “”, “per”: “%”, “Line_Item_Total”: “8,884.26” }, “page_index”: 2, “coordinate”: [ 92, 777, 1325, 812 ] } ], “data_items”: [ { “Description”: “APPLE IPHONE732GB 7 BLACK”, “serial_number”: “MOBIP63”, }, 153, 593, 342, 657 ], “confidence”: 0.973677977720621 }, { “Description”: “2 2 BOAT NECKLACE STYLE IN EAR SPORTS BT HEADSET ROCKERZ 255RBL”, “serial_number”: “8904130843761/5314”, “imei_number”: “”, “Line_Item_Total”: “1899” }, “page_index”: 1, “coordinate”: [ 152, 754, 374, 781 ], “confidence”: 0.973677977720621 }, { “Description”: “3 3 MOBILE CARRY BAG (PAPER)”, “serial_number”: “BAG04”, }, 152, 835, 224, 859 ], “confidence”: 0.973677977720621 } ] } ], “status”: “complete” } |
400 | {“error”:”Please provide username.”} |
400 | {“error”:”Please provide password.”} |
401 | {“error”:”Incorrect username or password.”} |
500 | {“error”:”Something went wrong. Please try again later.”} |
Update Results of Approved Invoices with QBE response
Method |
URL |
POST |
URL/access/klearstack/updateqbestatus |
Type | Params | Values | Description |
POST | company_name | string | Name of the company |
POST | username | string | Username for a particular user of a company |
POST | password | string | Password for a particular user of a company |
POST | document_type | string | Type of document to be processed – “Invoices” or “Receipts” or“PurchaseOrders”. By default “Invoices” will be set if this parameter is not passed. Note: Optional Parameter |
POST | QBE_response | string |
Response of Quickbooks to particular invoice. This will be a string of Json. Ex.
“{“document_id”:”6073ff72de02f2c94bca9cef”, “QBE_status”:”successful”,”error_message”: “ErrMsg”,”QBE_timestamp”:”14/04/2021 12:32:49″}” |
Status | Example Response |
200 | “QBE status updated successfully” |
200 | if document id is not found. “Document ID not found” |