# Update Results of Approved Invoices with QuickBooks Enterprise Response

Endpoint Name : `updateqbestatus`

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.

### Request Type

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

### Request Body

<table data-header-hidden><thead><tr><th width="163"></th><th width="93"></th><th width="106.727294921875"></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><p>Name of the company</p><p><br></p></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>collection_name</td><td>string</td><td>No</td><td><p>Type of document to be processed - “Invoices”, “Receipts”, “PurchaseOrders”,“NACH”,“LoanAgreement” 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>QBE_response</td><td>string</td><td>Yes</td><td><p>Response of Quickbook to particular invoice.This will be a string of Json.</p><p>Ex. </p><p>“{"document_id":"6073ff72de02f2c94bca9cef","QBE_status": "successful","error_message": "ErrMsg","QBE_timestamp":"14/04/2021 12:32:49"}“</p></td></tr></tbody></table>

### Shell (cURL)

* Request Body

```sh
curl --location "URL/access/klearstack/updateqbestatus" \
  --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 'QBE_response={
    "document_id":"6073ff72de02f2c94bca9cef",
    "QBE_status":"successful",
    "error_message":"ErrMsg",
    "QBE_timestamp":"14/04/2021 12:32:49"
  }'
```

### Python

* Request Body

```python
import requests

url = "URL/access/klearstack/updateqbestatus"

payload = {'company_name': 'Replace_Company_Name_Here',
'username': 'Replace_User_Name_Here',
'password': 'Replace_Password_Here',
'document_type': 'Invoices',
'QBE_response': '{
    "document_id":"6073ff72de02f2c94bca9cef",
    "QBE_status":"successful",
    "error_message":"ErrMsg",
    "QBE_timestamp":"14/04/2021 12:32:49"
  }'}
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().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
  .addFormDataPart("company_name", "Replace_Your_Company_Name_Here")
  .addFormDataPart("username", "Replace_Your_Username_Here")
  .addFormDataPart("password", "Replace_Your_Password_Here")
  .addFormDataPart("document_type", "Invoices")
  .addFormDataPart("QBE_response", "{\n" +
    "    \"document_id\": \"Replace_Your_Document_ID_Here\",\n" +
    "    \"QBE_status\": \"Insert_Success_or_Fail\",\n" +
    "    \"error_message\": \"Insert_Error_Message_If_Any\",\n" +
    "    \"QBE_timestamp\": \"DD/MM/YYYY HH:mm:ss\"\n" +
    "  }")
  .build();
Request request = new Request.Builder()
  .url("URL/access/klearstack/updateqbestatus")
  .method("POST", body)
  .addHeader("Authorization", "Bearer Replace_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_Your_Company_Name_Here');
formData.append('username', 'Replace_Your_Username_Here');
formData.append('password', 'Replace_Your_Password_Here');
formData.append('document_type', 'Invoices');
formData.append('QBE_response', '{\r\n    "document_id": "Replace_Your_Document_ID_Here",\r\n    "QBE_status": "Insert_Success_or_Fail",\r\n    "error_message": "Insert_Error_Message_If_Any",\r\n    "QBE_timestamp": "DD/MM/YYYY HH:mm:ss"\r\n  }');

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'URL/access/klearstack/updateqbestatus',
  headers: { 
    'Authorization': 'Bearer Replace_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_Your_Company_Name_Here");
formData.append("username", "Replace_Your_Username_Here");
formData.append("password", "Replace_Your_Password_Here");
formData.append("document_type", "Invoices");
formData.append("QBE_response", "{\r\n    \"document_id\": \"Replace_Your_Document_ID_Here\",\r\n    \"QBE_status\": \"Insert_Success_or_Fail\",\r\n    \"error_message\": \"Insert_Error_Message_If_Any\",\r\n    \"QBE_timestamp\": \"DD/MM/YYYY HH:mm:ss\"\r\n  }");

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

xhr.send(formData);
```

### API Response

<table data-header-hidden><thead><tr><th width="112"></th><th></th></tr></thead><tbody><tr><td>Status</td><td>Example Response</td></tr><tr><td>200</td><td>“QBE status updated successfully”</td></tr><tr><td>200</td><td><p>if document id is not found.</p><p>“Document ID not found”</p></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/update-documents/update-results-of-approved-invoices-with-quickbooks-enterprise-response.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.
