# Get Results of Invoices Accessible By A Specific User

Endpoint Name: getuserdocuments

Request type : `POST`

Authorization : Bearer token as header

Endpoint Details : This API is used to get the results of all the invoices uploaded by that particular user of a company.

### Request Type

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

### Request Body

<table data-header-hidden><thead><tr><th width="159"></th><th width="96"></th><th width="90.27276611328125"></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>approve_flag</td><td>string</td><td>No</td><td>If approve_flag is true, then it returns the invoices which are approved.</td></tr><tr><td>save_flag</td><td>string</td><td>No</td><td>If save_flag is true, then it returns the invoices which are saved.</td></tr></tbody></table>

## Request Code Samples

### Shell

* Request body

```sh
curl --location "URL/access/klearstack/getuserdocuments" \
  --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 "approve_flag=true" \
  --form "save_flag=false"
```

### Python

* Request body

```python
import requests

url = "URL/access/klearstack/getuserdocuments"

payload = {'company_name': 'Replace_Company_Name_Here',
'username': 'Replace_User_Name_Here',
'password': 'Replace_Password_Here',
'approve_flag': 'true',
'save_flag': 'false'}
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("approve_flag", "true")
    .addFormDataPart("save_flag", "false")
    .build();

Request request = new Request.Builder()
    .url("URL/access/klearstack/getuserdocuments")
    .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('approve_flag', 'true');
formData.append('save_flag', 'false');

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'URL/access/klearstack/getuserdocuments',
  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("approve_flag", "true");
formData.append("save_flag", "false");

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

xhr.send(formData);
```

### API Response

|             |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Status Code | Response                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| 200         | { "result": \[ \[ \[ "6912b53742d6a9c1aa134424", "Document\_id" ], \[ 1, "Is\_Approved" ], \[ 1, "Is\_Approved" ], \[ 0.8624999978870219, "overall\_confidence" ], \[ "1.500", "Full\_Box\_Equivalent", 0.90377812915278, { "page\_index": 2 } ], \[ "55413.0", "Inv\_Total", 0.984644436694877, { "page\_index": 1 }, \[ 1045, 630, 1104, 645 ] ], \[ "Flora Concept Llc", "Inv\_Supplier", 0.75, { "page\_index": 1 }, \[ 524, 43, 819, 63 ] ], \[ "SOLD TO TRADEWINDS INTL LLC ADDRESS : 2506 PIONEER AVE VISTA CA 92081 SHIPMENT DATE: : 2025/07/26 AWB : 369-95018663 AWBH : BOG - 06717056 FARM NAME : THE ELITE FLOWER S.A.S. C.I.", "Shipto\_Party\_Address", 0.9, { "page\_index": 1 }, \[ 92, 253, 577, 570 ] ], \[ "SOLD TO TRADEWINDS INTL LLC", "Shipto\_Party\_Name", 0.9, { "page\_index": 1 }, \[ 92, 255, 452, 271 ] ], \[ "Redacted", "Sign\_Exist\_Flag", 0.99, { "page\_index": 1 }, \[ 0, 0, 0, 0 ] ], \[ "Redacted", "Sign\_Exist\_Flag", 0.99, { "page\_index": 2 }, \[ 0, 0, 0, 0 ] ], \[ "BOGOTA", "Inv\_Origin", 0.945851113595394, { "page\_index": 1 }, \[ 929, 251, 1009, 267 ] ], \[ "26-Jul-2025", "Inv\_Date", 0.47145548871914267, { "page\_index": 1 }, \[ 1240, 69, 1312, 81 ] ], \[ "SOLD TO TRADEWINDS INTL LLC", "Inv\_Customer", 0.75, { "page\_index": 1 }, \[ 201, 253, 452, 271 ] ], \[ "1882271", "Inv\_Number", 1, { "is\_modified": 1 }, { "page\_index": 1 }, \[ 1227, 163, 1378, 214 ] ], \[ "ADDRESS : 2506 PIONEER AVE VISTA , CA 92081,", "Inv\_Customer\_Address", 0.885890521716398, { "page\_index": 1 }, \[ 92, 551, 253, 302 ] ] ] ], "status": "complete" } |
| 403         | Forbidden: Client Error                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| 501         | Server Error                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |


---

# 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-invoices-accessible-by-a-specific-user.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.
