API Documentation
KlearStack v 5.7.3: 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:

  1. Description of API
  2. Input Parameters
  3. Success Response
  4. Method used in API
  5. 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
This API is used to get the batch id for a single invoice (image/pdf) uploaded by the user

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
This API is used to get a single batch id for all the invoices uploaded by the user in the form of a zip folder.

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
This API is used to get the extracted data/results for invoices that belong to a specific 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
This API is used to get the results of all the invoices uploaded by that particular user of a company.

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
This API is used to get the results of modified invoices which are modified by any user of a company 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
This API is used to get the results of approved invoices which are approved by the approver of a company using date range filter, QBE status filter and username list.

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”: [

{
“Document_id”: “5e9ebf7c1ed959c4bb4dc214”, “is_approved”: 0,

“approved_date”: “Wed Apr 14 2021”, “file_name”: “tata capital west bengal 5712.pdf”, “overall_confidence”: 0.917829326729445,

“AccountsData”: {
“Supplier GL Account #”: “1200021”,
“Supplier ID”: 1001,
“Supplier name”: “Tatiana Henderson LLP”, “CGST”: “450002, Central Input GST”,
“SGST”: “450001, State Input GST”,
“IGST”: “420003, Inter State Input GST”, “PurchaseAc”: “980001, Printing & Stationery”, “SplitFlag”: “false”,
“LineItemAccounts”: [

“LineItem1, 980001, Printing & Stationery, 49,357.00” ],

“SplitAccounts”: [], “individualQuickBookAc”: [], “individualQbItemType”: [], “sgstv”: “”,

“cgstv”: “”,
“igstv”: “8,884.26”, “qbItemName”: “”, “qbItemType”: “”

}, “Inv_Date”: {

“value”: “23 February, 2020”, “confidence”: 0.566981644843936, “page_index”: 1

}, “Inv_Number”: {

“value”: “MATTB-2331”, “confidence”: 0.946715178008698, “page_index”: 1,
“coordinate”: [

1283, 383, 1409, 409

] },

“Inv_PO”: {
“value”: “P6060”,
“confidence”: 0.998517162654257, “page_index”: 1,
“coordinate”: [

1287, 443, 1349, 468

] },

“Inv_Total”: {
“value”: “30199”,
“confidence”: 0.970878755401809, “page_index”: 1,
“coordinate”: [

0, 0, 0, 0

] },

“Inv_CGST_Value”: {
“value”: “1661”,
“confidence”: 0.822383355941637, “page_index”: 1

}, “Inv_SGST_Value”: {

“value”: “1661”,
“confidence”: 0.881396053757078, “page_index”: 1

}, “Inv_CGST_Percent”: {

“value”: “5”,
“confidence”: 0.827240639155472, “page_index”: 1

}, “Inv_SGST_Percent”: {

“value”: “5”,
“confidence”: 0.823984961348311, “page_index”: 1

}, “Inv_Supplier”: {

“value”: “Pai International Electronics Ltd”, “page_index”: 1,
“coordinate”: [

0, 0, 0, 0

],

“confidence”: 0.805663607700772 },

“Inv_Customer”: {
“value”: “Pai, INTERNATIONAL,”, “page_index”: 1,
“coordinate”: [

406, 58,

795,

105 ],

“confidence”: 0.954218689055312 },

“Inv_Type”: {
“value”: “Tax Invoice”, “confidence”: 0.981186005027941, “page_index”: 1

}, “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”,
“confidence”: 0.981349645091967, “page_index”: 1

}, “line_items”: [

{
“row”: {

“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”,
“Rate”: “49,357.00”,
“per”: “NOS”, “Line_Item_Total”: “49,357.00”

},
“page_index”: 1, “coordinate”: [

95, 776, 1343, 892

] },

{
“row”: {

“Description”: “3 year warranty Output IGST 18%”, “HSN Code”: “”,
“Quantity”: “”,
“Rate”: “18”,

“per”: “%”,

“Line_Item_Total”: “8,884.26” },

“page_index”: 2, “coordinate”: [

92, 777, 1325, 812

] }

], “data_items”: [

{
“row”: {

“Description”: “APPLE IPHONE732GB 7 BLACK”, “serial_number”: “MOBIP63”,
“imei_number”: “356642080262057”, “Line_Item_Total”: “29900”

},
“page_index”: 1, “coordinate”: [

153, 593, 342, 657

],

“confidence”: 0.973677977720621 },

{
“row”: {

“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 },

{
“row”: {

“Description”: “3 3 MOBILE CARRY BAG (PAPER)”, “serial_number”: “BAG04”,
“imei_number”: “”,
“Line_Item_Total”: “”

},
“page_index”: 1, “coordinate”: [

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
This API is used to update the results of invoices with QBE response which were approved.

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”

Need more information?

If you have more questions, or need any custom integrations write to us!