KlearStack API Documentation
  • 👋Welcome to KlearStack's API Documentation
  • Authentication and User Details
    • Get Access Token
    • Get Access Token From UserID
    • Get New Access Token Using Existing Refresh Token
    • Get User ID
  • Upload Documents
    • Upload A Single Document And Get Batch ID
    • Upload Multiple Documents In A Zip Folder And Get Batch Id
  • Fetch Documents
    • Get Extracted Results For Invoices In a Batch Id
    • Get Extracted Results For Invoices In Between Date Range
    • Get Extracted Results For Invoices In a Set
    • Get Results of Invoices Accessible By A Specific User
    • Get Results of Modified Invoices since the last pull
    • Get Results of Approved Invoices Using Date Filter
    • Get details of a Document
  • UPDATE DOCUMENTS
    • Update Document
    • Update Results of Approved Invoices with QuickBooks Enterprise Response
    • Approve or Reject a Document
    • Push Annotated Text for a Document to KlearStack
  • DOCUMENT IMAGES
    • Get Image of Document
  • PUSH API
    • PUSH API Structure
    • Retry Push API
  • DataSources
    • Create New Datasource
    • List of all Datasources
    • Get data of a Datasource
    • Append in Datasource
    • Update Record of a Datasource
    • Delete Record of a Datasource
    • Delete Datasource
  • Documents Set
    • Get Documents of a Set
    • Get Uploaded Status of Documents in a Document Set
    • Get Set Reference Numbers List
  • FIELDS SETTING
    • Update Field Mapping
Powered by GitBook
On this page
  • Request Type
  • Request Body
  • Request Code Samples
  • Shell
  • Python
  • Java
  • Node.js
  • JavaScript (XMLHttpRequest)
  1. Fetch Documents

Get Extracted Results For Invoices In Between Date Range

Endpoint Name: getdocumentsbetweendates

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

Authorization: Bearer token as header

Request Type

Method

URL

POST

URL/access/klearstack/getdocumentsbetweendates

Request Body

Type

Params

Values

Description

POST

company_name

string

Name of the company

POST

start_date

string

Format : “DD/MM/YYYY”

POST

end_date

string

Format : “DD/MM/YYYY”

POST

page_index

integer

integer value, Page number

POST

items_per_page

integer

Results per page (Max 20)

Request Code Samples

Shell

  • Request Body

curl -X POST "URL/access/klearstack/getdocumentsbetweendates" \
  -H "Authorization: Bearer your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "company_name": "Replace_Company_Name_Here",
    "start_date": "DD/MM/YYYY",
    "end_date": "DD/MM/YYYY",
    "page_index": 1,
    "items_per_page": 10
  }'

Python

  • Request Body

import requests

# API URL
url = "URL/access/klearstack/getdocumentsbetweendates"

# Request payload
data = {
    "company_name": "Replace_Company_Name_Here",
    "start_date": "DD/MM/YYYY",
    "end_date": "DD/MM/YYYY",
    "page_index": 1,
    "items_per_page": 10
}

# Headers
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer your_token_here"
}

# Make the POST request
response = requests.post(url, json=data, headers=headers)

# Print the response
if response.status_code == 200:
    print(response.json())
else:
    print("Error:", response.text)

Java

  • Request Body

import okhttp3.*;

import java.io.IOException;

public class GetDocumentsBetweenDatesAPI {
    public static void main(String[] args) {
        OkHttpClient client = new OkHttpClient();

        // JSON payload
        String jsonPayload = "{ \"company_name\": \"Replace_Company_Name_Here\", " +
                "\"start_date\": \"DD/MM/YYYY\", " +
                "\"end_date\": \"DD/MM/YYYY\", " +
                "\"page_index\": 1, " +
                "\"items_per_page\": 10 }";

        RequestBody body = RequestBody.create(
            jsonPayload, MediaType.parse("application/json"));

        Request request = new Request.Builder()
            .url("URL/access/klearstack/getdocumentsbetweendates")
            .post(body)
            .addHeader("Content-Type", "application/json")
            .addHeader("Authorization", "Bearer your_token_here")
            .build();

        try (Response response = client.newCall(request).execute()) {
            if (response.isSuccessful()) {
                System.out.println("Response: " + response.body().string());
            } else {
                System.out.println("Error: " + response.body().string());
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Node.js

  • Request Body

var request = require('request');

const form_data = {
  'company_name': 'Replace_Company_Name_Here',
  'start_date': 'DD/MM/YYYY',
  'end_date': 'DD/MM/YYYY',
  'page_index': 1,
  'items_per_page': 10
};

const options = {
  url: 'URL/access/klearstack/getdocumentsbetweendates',
  json: form_data,
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer your_token_here'
  }
};

request.post(options, function(err, httpResponse, body) {
  if (err) {
    console.error('Request failed:', err);
    return;
  }

  console.log('Response:', body);
});

JavaScript (XMLHttpRequest)

  • Request Body

var payload = JSON.stringify({
    company_name: "Replace_Company_Name_Here",
    start_date: "DD/MM/YYYY",
    end_date: "DD/MM/YYYY",
    page_index: 1,
    items_per_page: 10
});

var xhr = new XMLHttpRequest();
xhr.open("POST", "URL/access/klearstack/getdocumentsbetweendates", true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Authorization", "Bearer your_token_here");

// Handle response
xhr.onreadystatechange = function () {
    if (xhr.readyState === XMLHttpRequest.DONE) {
        if (xhr.status === 200) {
            console.log("Response:", xhr.responseText);
        } else {
            console.error("Error:", xhr.responseText);
        }
    }
};

// Send request
xhr.send(payload);
PreviousGet Extracted Results For Invoices In a Batch IdNextGet Extracted Results For Invoices In a Set

Last updated 2 months ago