# Get Results of Approved Invoices Using Date Filter

Endpoint Name : `getapproveinvoices`

Request type : `POST`

Authorization : Bearer token as header

Endpoint Details : 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.

<mark style="color:red;">Note: This API works only for Admin and Approver users.</mark>

### Request Type

<table data-header-hidden><thead><tr><th width="118"></th><th></th></tr></thead><tbody><tr><td>Method</td><td>URL</td></tr><tr><td>POST</td><td><code>URL/access/klearstack/getapproveinvoices</code></td></tr></tbody></table>

### Request Body

<table data-header-hidden><thead><tr><th width="173.3636474609375"></th><th width="99"></th><th width="98.54534912109375"></th><th></th></tr></thead><tbody><tr><td>Params</td><td>Values</td><td>Required</td><td>Description</td></tr><tr><td>company_name</td><td>string</td><td>Yes</td><td>Name of the company</td></tr><tr><td>username</td><td>string</td><td>Yes</td><td>Username for a particular user of a company</td></tr><tr><td>password</td><td>string</td><td>Yes</td><td>Password for a particular user of a company</td></tr><tr><td>document_type</td><td>string</td><td>No</td><td><p>Type of document to be processed - “Invoices”,  “Receipts”, “PurchaseOrders”,“NACH”,“LoanAgreement” </p><p>or “Insurances”</p><p>By default “Invoices” will be set if this parameter is not passed</p><p>Note: Optional Parameter.</p></td></tr><tr><td>from_date</td><td>string</td><td>Yes</td><td><p>Date from which the user wants approved invoices. </p><p>Format : “DD/MM/YYYY”</p></td></tr><tr><td>to_date</td><td>string</td><td>Yes</td><td><p>Date till which user wants approved invoices. </p><p>Format : “DD/MM/YYYY”</p></td></tr><tr><td>user_list</td><td>string</td><td>No</td><td><p>Name of users whose invoices are required.(comma separated)</p><p>Ex. “Creator,Creator1”</p><p>By default all users are considered.</p><p>Note: Optional Parameter</p></td></tr><tr><td>QBE_status</td><td>string</td><td>No</td><td><p>Status of QBE integration.</p><p>Only two values are considered</p><p>“successful” or “failed”<br>Note: Optional Parameter</p></td></tr></tbody></table>

### Shell

* Request Body

```sh
curl --location "URL/access/klearstack/getapproveinvoices" \
  --header "Authorization: Bearer your_token_here" \
  --form "company_name=Replace_Company_Name_Here" \
  --form "username=Replace_User_Name_Here" \
  --form "password=Replace_Password_Here" \
  --form "document_type=Invoices" \
  --form "from_date=01/01/2024" \
  --form "to_date=01/03/2024" \
  --form "user_list=Creator,Creator1" \
  --form "QBE_status=successful"
```

### Python

* Request Body

```python
import requests

url = "URL/access/klearstack/getapproveinvoices"

payload = {'company_name': 'Replace_Company_Name_Here',
'username': 'Replace_User_Name_Here',
'password': 'Replace_Password_Here',
'document_type': 'Invoices',
'from_date': '01/01/2024',
'to_date': '01/03/2024',
'user_list': 'Creator,Creator1',
'QBE_status': 'successful'}
files=[

]
headers = {
  'Authorization': 'Bearer your_token_here'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)

```

### Java (OkHttp)

* Request Body

```java
OkHttpClient client = new OkHttpClient();

RequestBody body = new MultipartBody.Builder()
  .setType(MultipartBody.FORM)
  .addFormDataPart("company_name", "Replace_Company_Name_Here")
  .addFormDataPart("username", "Replace_User_Name_Here")
  .addFormDataPart("password", "Replace_Password_Here")
  .addFormDataPart("document_type", "Invoices")
  .addFormDataPart("from_date", "01/01/2024")
  .addFormDataPart("to_date", "01/03/2024")
  .addFormDataPart("user_list", "Creator,Creator1")
  .addFormDataPart("QBE_status", "successful")
  .build();

Request request = new Request.Builder()
  .url("URL/access/klearstack/getapproveinvoices")
  .post(body)
  .addHeader("Authorization", "Bearer your_token_here")
  .build();

Response response = client.newCall(request).execute();
```

### Node.js (Axios)

* Request Body

```javascript
const axios = require('axios');
const FormData = require('form-data');

let formData = new FormData();
formData.append('company_name', 'Replace_Company_Name_Here');
formData.append('username', 'Replace_User_Name_Here');
formData.append('password', 'Replace_Password_Here');
formData.append('document_type', 'Invoices');
formData.append('from_date', '01/01/2024');
formData.append('to_date', '01/03/2024');
formData.append('user_list', 'Creator,Creator1');
formData.append('QBE_status', 'successful');

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'URL/access/klearstack/getapproveinvoices',
  headers: {
    'Authorization': 'Bearer your_token_here',
    ...formData.getHeaders()
  },
  data: formData
};

axios.request(config)
  .then((response) => {
    console.log(JSON.stringify(response.data));
  })
  .catch((error) => {
    console.log(error);
  });
```

### JavaScript (XHR)

* Request Body

```javascript
// WARNING: For POST requests, body is set to null by browsers.

var formData = new FormData();
formData.append("company_name", "Replace_Company_Name_Here");
formData.append("username", "Replace_User_Name_Here");
formData.append("password", "Replace_Password_Here");
formData.append("document_type", "Invoices");
formData.append("from_date", "01/01/2024");
formData.append("to_date", "01/03/2024");
formData.append("user_list", "Creator,Creator1");
formData.append("QBE_status", "successful");

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "URL/access/klearstack/getapproveinvoices");
xhr.setRequestHeader("Authorization", "Bearer your_token_here");

xhr.send(formData);
```

### API Response

<table data-header-hidden><thead><tr><th width="102"></th><th></th></tr></thead><tbody><tr><td>Status</td><td>Example Response</td></tr><tr><td>200</td><td><p>{</p><p>    "result": [</p><p>        {</p><p>            "Document_id": "5e9ebf7c1ed959c4bb4dc214",</p><p>            "is_approved": 0,</p><p>           "approved_date": "Wed Apr 14 2021",</p><p>            "file_name": "tata capital west bengal 5712.pdf",</p><p>            "overall_confidence": 0.917829326729445,</p><p>           "AccountsData": {</p><p>                "Supplier GL Account #": "1200021",</p><p>                "Supplier ID": 1001,</p><p>                "Supplier name": "Tatiana Henderson LLP",</p><p>                "CGST": "450002, Central Input GST",</p><p>                "SGST": "450001, State Input GST",</p><p>                "IGST": "420003, Inter State Input GST",</p><p>                "PurchaseAc": "980001, Printing &#x26; Stationery",</p><p>                "SplitFlag": "false",</p><p>                "LineItemAccounts": [</p><p>                    "LineItem1, 980001, Printing &#x26; Stationery, 49,357.00"</p><p>                ],</p><p>                "SplitAccounts": [],</p><p>                "individualQuickBookAc": [],</p><p>                "individualQbItemType": [],</p><p>                "sgstv": "",</p><p>                "cgstv": "",</p><p>                "igstv": "8,884.26",</p><p>                "qbItemName": "",</p><p>                "qbItemType": ""</p><p>            },</p><p>            "Inv_Date": {</p><p>                "value": "23 February, 2020",</p><p>                "confidence": 0.566981644843936,</p><p>                "page_index": 1</p><p>            },</p><p>            "Inv_Number": {</p><p>                "value": "MATTB-2331",</p><p>                "confidence": 0.946715178008698,</p><p>                "page_index": 1,</p><p>                "coordinate": [</p><p>                    1283,</p><p>                    383,</p><p>                    1409,</p><p>                    409</p><p>                ]</p><p>            },</p><p>            "Inv_PO": {</p><p>                "value": "P6060",</p><p>                "confidence": 0.998517162654257,</p><p>                "page_index": 1,</p><p>                "coordinate": [</p><p>                    1287,</p><p>                    443,</p><p>                    1349,</p><p>                    468</p><p>                ]</p><p>            },</p><p>            "Inv_Total": {</p><p>                "value": "30199",</p><p>                "confidence": 0.970878755401809,</p><p>                "page_index": 1,</p><p>                "coordinate": [</p><p>                    0,</p><p>                    0,</p><p>                    0,</p><p>                    0</p><p>                ]</p><p>            },</p><p>            "Inv_CGST_Value": {</p><p>                "value": "1661",</p><p>                "confidence": 0.822383355941637,</p><p>                "page_index": 1</p><p>            },</p><p>            "Inv_SGST_Value": {</p><p>                "value": "1661",</p><p>                "confidence": 0.881396053757078,</p><p>                "page_index": 1</p><p>            },</p><p>            "Inv_CGST_Percent": {</p><p>                "value": "5",</p><p>                "confidence": 0.827240639155472,</p><p>                "page_index": 1</p><p>            },</p><p>            "Inv_SGST_Percent": {</p><p>                "value": "5",</p><p>                "confidence": 0.823984961348311,</p><p>                "page_index": 1</p><p>            },</p><p>            "Inv_Supplier": {</p><p>                "value": "Pai International Electronics Ltd",</p><p>                "page_index": 1,</p><p>                "coordinate": [</p><p>                    0,</p><p>                    0,</p><p>                    0,</p><p>                    0</p><p>                ],</p><p>                "confidence": 0.805663607700772</p><p>            },</p><p>            "Inv_Customer": {</p><p>                "value": "Pai, INTERNATIONAL,",</p><p>                "page_index": 1,</p><p>                "coordinate": [</p><p>                    406,</p><p>                    58,</p><p>                    795,</p><p>                    105</p><p>                ],</p><p>                "confidence": 0.954218689055312</p><p>            },</p><p>            "Inv_Type": {</p><p>                "value": "Tax Invoice",</p><p>                "confidence": 0.981186005027941,</p><p>                "page_index": 1</p><p>            },</p><p>            "Inv_Currency": {</p><p>                "value": "INR",</p><p>                "confidence": 0.978,</p><p>                "page_index": 1</p><p>            },</p><p>            "Inv_Origin": {</p><p>                "value": "India",</p><p>                "confidence": 0.978,</p><p>                "page_index": 1</p><p>            },</p><p>            "Inv_Supplier_Address": {</p><p>                "value": "GST INVOICE , PAI INTERNATIONAL ELECTRONICS LTD. , Corporate Office: # 28/1A, 100 Feet Road, Indiranagar, Bangalore-560 - 560038.",</p><p>                "page_index": 1,</p><p>                "coordinate": [</p><p>                    406,</p><p>                    3,</p><p>                    1179,</p><p>                    157</p><p>                ],</p><p>                "confidence": 0.962132237592736</p><p>            },</p><p>            "Inv_Supplier_State": {</p><p>                "value": "Karnataka",</p><p>                "confidence": 0.95,</p><p>                "page_index": 1</p><p>            },</p><p>            "Inv_Supplier_City": {</p><p>                "value": "Bengaluru",</p><p>                "confidence": 0.981349645091967,</p><p>                "page_index": 1</p><p>            },</p><p>            "Inv_Supplier_Pincode": {</p><p>                "value": "560038",</p><p>                "confidence": 0.981349645091967,</p><p>                "page_index": 1</p><p>            },</p><p>           "line_items": [</p><p>                {</p><p>                    "row": {</p><p>                        "Description": "Dell Latitude 3400 C15 Intel Core I5 8265 U 8 Gb Ddr4 /512 Gb Ssd 14'' Screen(1366x768) Intel Uhd Graphic 620 10/100/1000 Ehernate Port Window 10 Pro With Bag Pack",</p><p>                        "of Goods": "",</p><p>                        "HSN Code": "8471",</p><p>                        "Quantity": "1 NOS",</p><p>                        "Rate": "49,357.00",</p><p>                        "per": "NOS",</p><p>                        "Line_Item_Total": "49,357.00"</p><p>                    },</p><p>                    "page_index": 1,</p><p>                    "coordinate": [</p><p>                        95,</p><p>                        776,</p><p>                        1343,</p><p>                        892</p><p>                    ]</p><p>                },</p><p>                {</p><p>                    "row": {</p><p>                        "Description": "3 year warranty Output IGST 18%",</p><p>                        "HSN Code": "",</p><p>                        "Quantity": "",</p><p>                        "Rate": "18",</p><p>                        "per": "%",</p><p>                        "Line_Item_Total": "8,884.26"</p><p>                    },</p><p>                    "page_index": 2,</p><p>                    "coordinate": [</p><p>                        92,</p><p>                        777,</p><p>                        1325,</p><p>                        812</p><p>                    ]</p><p>                }</p><p>            ],</p><p>            "data_items": [</p><p>                {</p><p>                    "row": {</p><p>                        "Description": "APPLE IPHONE732GB 7 BLACK",</p><p>                        "serial_number": "MOBIP63",</p><p>                        "imei_number": "356642080262057",</p><p>                        "Line_Item_Total": "29900"</p><p>                    },</p><p>                    "page_index": 1,</p><p>                    "coordinate": [</p><p>                        153,</p><p>                        593,</p><p>                        342,</p><p>                        657</p><p>                    ],</p><p>                    "confidence": 0.973677977720621</p><p>                },</p><p>                {</p><p>                    "row": {</p><p>                        "Description": "2 2 BOAT NECKLACE STYLE IN EAR SPORTS BT HEADSET ROCKERZ 255RBL",</p><p>                        "serial_number": "8904130843761/5314",</p><p>                        "imei_number": "",</p><p>                        "Line_Item_Total": "1899"</p><p>                    },</p><p>                    "page_index": 1,</p><p>                    "coordinate": [</p><p>                        152,</p><p>                        754,</p><p>                        374,</p><p>                        781</p><p>                    ],</p><p>                    "confidence": 0.973677977720621</p><p>                },</p><p>                {</p><p>                    "row": {</p><p>                        "Description": "3 3 MOBILE CARRY BAG (PAPER)",</p><p>                        "serial_number": "BAG04",</p><p>                        "imei_number": "",</p><p>                        "Line_Item_Total": ""</p><p>                    },</p><p>                    "page_index": 1,</p><p>                    "coordinate": [</p><p>                        152,</p><p>                        835,</p><p>                        224,</p><p>                        859</p><p>                    ],</p><p>                    "confidence": 0.973677977720621</p><p>                }</p><p>            ]</p><p>        }</p><p>    ],</p><p>    "status": "complete",</p><p>    “release_version”:”7.8.9”</p><p>}</p></td></tr><tr><td>400</td><td>{"error":"Please provide username."}</td></tr><tr><td>400</td><td>{"error":"Please provide password."}</td></tr><tr><td>401</td><td>{"error":"Incorrect username or password."}</td></tr><tr><td>500</td><td>{"error":"Something went wrong. Please try again later."}</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://klearstack.gitbook.io/klearstack-api-documentation/fetch-documents/get-results-of-approved-invoices-using-date-filter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
