# Get Extracted Results For Invoices In Between Date Range

Endpoint Name: getdocumentsbetweendates

Request type : `POST`

Authorization : Bearer token as header

Endpoint Details : API is used to get the extracted data/results for invoices that belong to a specific date range.

## Request Type

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

## Request Body

<table data-header-hidden><thead><tr><th width="167"></th><th width="152"></th><th width="93.90911865234375"></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>collection_name</td><td>string</td><td>Yes</td><td>Name of the collection.</td></tr><tr><td>start_date</td><td>string</td><td>Yes</td><td>Format : “DD-MM-YYYY”.</td></tr><tr><td>end_date</td><td>string</td><td>Yes</td><td>Format : “DD-MM-YYYY”.</td></tr><tr><td>page_index</td><td>integer</td><td>No</td><td>integer value, Page number.</td></tr><tr><td>items_per_page</td><td>integer</td><td>No</td><td>Results per page (Max 20).</td></tr></tbody></table>

## Request Code Samples

### Shell

* Request Body

```sh
curl --location "URL/access/klearstack/getdocumentsbetweendates" \
  -H "Authorization: Bearer your_token_here" \
  --form "company_name=Replace_Company_Name_Here" \
  --form "collection_name=Replace_Collection_Name_Here"
  --form "start_date=DD-MM-YYYY" \
  --form "end_date=DD-MM-YYYY" \
  --form "page_index=1" \
  --form "items_per_page=10"
```

### Python

* Request Body

```python
import requests

url = "URL/access/klearstack/getdocumentsbetweendates"

payload = {'company_name': 'Replace_Company_Name_Here',
'collection_name': 'Replace_Collection_Name_Here'
'start_date': 'DD-MM-YYYY',
'end_date': 'DD-MM-YYYY',
'page_index': '1',
'items_per_page': '10'}
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("collection_name", "Replace_Collection_Name_Here")
    .addFormDataPart("start_date", "DD-MM-YYYY")
    .addFormDataPart("end_date", "DD-MM-YYYY")
    .addFormDataPart("page_index", "1")
    .addFormDataPart("items_per_page", "10")
    .build();

Request request = new Request.Builder()
    .url("URL/access/klearstack/getdocumentsbetweendates")
    .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('collection_name', 'Replace_Collection_Name_Here');
formData.append('start_date', 'DD-MM-YYYY');
formData.append('end_date', 'DD-MM-YYYY');
formData.append('page_index', '1');
formData.append('items_per_page', '10');

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'URL/access/klearstack/getdocumentsbetweendates',
  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("collection_name", "Replace_Collection_Name_Here");
formData.append("start_date", "DD-MM-YYYY");
formData.append("end_date", "DD-MM-YYYY");
formData.append("page_index", "1");
formData.append("items_per_page", "10");

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/getdocumentsbetweendates");
xhr.setRequestHeader("Authorization", "Bearer your_token_here");

xhr.send(formData);
```

### API Response

<table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td>Status Code</td><td>Response</td></tr><tr><td>200</td><td><pre><code>{
    "result": [
        {
            "Document_id": "68becd0f7cd9ff12c3d707d3",
            "is_approved": 0,
            "file_name": "test__MNV__9503222207.pdf",
            "overall_confidence": 0.8882295802918684,
            "document_type": "Invoice",
            "upload_time": "2025-09-08T18:03:21.001",
            "finished_time": "2025-09-08T18:04:47.017",
            "Inv_Number": {
                "value": "IA194485094",
                "confidence": 0.997040534621632,
                "page_index": 1,
                "coordinate": [
                    564,
                    557,
                    632,
                    566
                ]
            },
            "Inv_PO": {
                "value": "1146965",
                "confidence": 0.945120326753658,
                "page_index": 1,
                "coordinate": [
                    605,
                    271,
                    652,
                    280
                ]
            },
            "Engine_Number": {
                "value": "E20ASE09941",
                "confidence": 0.932500680264945,
                "page_index": 1,
                "coordinate": [
                    161,
                    883,
                    231,
                    891
                ]
            },
            "Chassis_Number": {
                "value": "MD2C59202SAE86580",
                "confidence": 0.931441079866287,
                "page_index": 1,
                "coordinate": [
                    413,
                    883,
                    527,
                    891
                ]
            },
            "Inv_Total": {
                "value": "100000.0",
                "confidence": 0.99,
                "page_index": 1,
                "coordinate": [
                    149,
                    1294,
                    162,
                    1304
                ]
            },
            "Inv_Supplier": {
                "value": "Digit Go Digit General Insurance Ltd",
                "page_index": 1,
                "coordinate": [
                    971,
                    68,
                    1161,
                    98
                ],
                "confidence": 0.75
            },
            "Inv_Customer": {
                "value": "PANKAJ SANTOSH RAUT",
                "page_index": 1,
                "coordinate": [
                    161,
                    234,
                    294,
                    246
                ],
                "confidence": 0.75
            },
            "Inv_Origin": {
                "value": "India",
                "confidence": 0.955733651465401,
                "page_index": 1,
                "coordinate": [
                    1244,
                    1110,
                    1269,
                    1120
                ]
            },
            "Inv_Customer_Mobile": {
                "value": "1111111111",
                "confidence": 0.954875597510902,
                "page_index": 1,
                "coordinate": [
                    0,
                    0,
                    0,
                    0
                ]
            },
            "Inv_Customer_Address": {
                "value": "HOSPITAL TEACHERS COLONY NHAVARA PO   1146965  NHAVARE  DIST : PUNE - 412211",
                "page_index": 1,
                "coordinate": [
                    263,
                    234,
                    513,
                    631
                ],
                "confidence": 0.94
            },
            "Inv_Date": {
                "value": "06-Aug-2025",
                "confidence": 0.9957775219021949,
                "page_index": 1,
                "coordinate": [
                    669,
                    560,
                    732,
                    568
                ]
            },
            "Sign_Exist_Flag": {
                "value": "True",
                "confidence": 0.5162655711174011,
                "page_index": 1,
                "coordinate": [
                    285,
                    366,
                    346,
                    417
                ]
            }
        }
    ],
    "status": "complete",
    "page_index": 1,
    "total_pages": 1,
    "total_count": 1
}
</code></pre></td></tr><tr><td>403</td><td>Forbidden: Client Error</td></tr><tr><td>501</td><td>Server Error</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-extracted-results-for-invoices-in-between-date-range.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.
