> For a complete documentation index, fetch https://docs.voximplant.ai/llms.txt

# GetHistoryReports

POST https://api.voximplant.com/platform_api/GetHistoryReports

Gets the list of history reports and their statuses. The method returns info about the reports made via [GetCallHistoryAsync], [GetTransactionHistoryAsync], [GetAuditLogAsync] and [GetBriefCallHistory] asynchronous methods. Note that the **file_size** field in response is valid only for the video calls.

Allowed roles: `Owner`, `Admin`, `Developer`, `Supervisor`, `Accountant`, `Support`, `Payer`.

**Example request:** Get all the reports.

Reference: https://docs.voximplant.ai/api-reference/management-api/reference/history/get-history-reports

## Authentication

- `Authorization` header (bearer token, required) — Voximplant Management API uses signed JWT tokens generated from your service-account private key. Pass the token in the `Authorization` header as a Bearer value: ``` Authorization: Bearer $VOXIMPLANT_TOKEN ``` See [Authorization](/api-reference/management-api/authorization) for ready-to-copy snippets in bash, Python, Node.js and Go that turn your `credentials.json` into a token.

## Request

### Query parameters

- `history_report_id` (integer, optional) — The history report ID to filter
- `history_type` (list of string, optional) — The history report type list separated by semicolons (;). Use the 'all' value to select all history report types. The following values are possible: calls, calls_brief, transactions, audit, call_list, transactions_on_hold
- `created_from` (string, optional) — The UTC creation from date filter in 24-h format: YYYY-MM-DD HH:mm:ss
- `created_to` (string, optional) — The UTC creation to date filter in 24-h format: YYYY-MM-DD HH:mm:ss
- `is_completed` (boolean, optional) — Whether the report is completed
- `desc_order` (boolean, optional, default: false) — Whether to get records in the descent order
- `count` (integer, optional, default: 20) — The max returning record count
- `offset` (integer, optional, default: 0) — The first **N** records are skipped in the output
- `application_id` (list of integer, optional) — The application ID to filter. Can be a list separated by semicolons (;). Use the 'all' value to select all applications

## Response

### 200

Successful response

- `result` (list of HistoryReportType, optional)
- `total_count` (integer, optional) — The total found reports count
- `count` (integer, optional) — The returned reports count

## Types

### HistoryReportType

The history report info.

- `history_report_id` (integer, optional) — The call history report ID
- `history_type` (string, optional) — The history report type. The following values are possible: calls, transactions, audit, call_list
- `created` (string, optional) — Timestamp in YYYY-MM-DD HH:mm:ss format. The creation time in the UTC timezone in 24-h format: YYYY-MM-DD HH:mm:ss
- `format` (string, optional) — The report format type. The following values are possible: csv
- `completed` (string, optional) — Timestamp in YYYY-MM-DD HH:mm:ss format. The UTC completion time in 24-h format: YYYY-MM-DD HH:mm:ss. The report is completed if the field exists
- `file_name` (string, optional) — The report file name
- `file_size` (double, optional) — The report file size
- `download_size` (double, optional) — The gzipped report size to download
- `download_count` (integer, optional) — The download attempt count
- `last_downloaded` (string, optional) — Timestamp in YYYY-MM-DD HH:mm:ss format. The last download UTC time in 24-h format: YYYY-MM-DD HH:mm:ss. The report is completed if the field exists
- `store_until` (string, optional) — Date string as returned by the Management API. Store the report until the date in the following format: YYYY-MM-DD. The report is completed if the field exists
- `filters` (map from string to any, optional) — The report order filters (the saved [GetCallHistory], [GetTransactionHistory] parameters)
- `calculated_data` (HistoryReportTypeCalculatedData, optional) — The calculated report data (the specific report data, see [CalculatedCallHistoryDataType], [CalculatedTransactionHistoryDataType])
- `error` (HistoryReportTypeError, optional)

### HistoryReportTypeCalculatedData

The calculated report data (the specific report data, see [CalculatedCallHistoryDataType], [CalculatedTransactionHistoryDataType])

- `session_count` (integer, optional)
- `total_session_count` (integer, optional)
- `transaction_count` (integer, optional)
- `total_transaction_count` (integer, optional)
- `start_balance` (string, optional)
- `end_balance` (string, optional)
- `account_id` (integer, optional)

### HistoryReportTypeError

- `code` (integer, optional)
- `msg` (string, optional)

## Examples

**Response**

```json
{
  "result": [
    {
      "history_report_id": 34,
      "history_type": "calls",
      "created": "2015-10-07 18:40:01",
      "format": "csv",
      "completed": "2015-10-07 18:40:02",
      "error": {
        "code": 24,
        "msg": "No disc space"
      }
    },
    {
      "history_report_id": 35,
      "history_type": "calls",
      "created": "2015-10-07 18:40:05",
      "format": "csv",
      "completed": "2015-10-07 18:40:06",
      "file_name": "call_history_2015-09-07_(12_of_12).csv",
      "file_size": 2511,
      "download_size": 687,
      "download_count": 1,
      "last_downloaded": "2015-10-07 18:40:18",
      "store_until": "2015-10-14",
      "calculated_data": {
        "session_count": 12,
        "total_session_count": 12
      }
    },
    {
      "history_report_id": 36,
      "history_type": "transactions",
      "created": "2015-10-07 18:40:10",
      "format": "csv",
      "completed": "2015-10-07 18:40:11",
      "file_name": "transaction_history_2015-09-07_(10.2_8.15).csv",
      "file_size": 3511,
      "download_size": 698,
      "download_count": 2,
      "last_downloaded": "2015-10-07 18:40:19",
      "store_until": "2015-10-14",
      "calculated_data": {
        "transaction_count": 120,
        "total_transaction_count": 120,
        "start_balance": "10.2 USD",
        "end_balance": "8.15 USD",
        "account_id": 1
      }
    },
    {
      "history_report_id": 37,
      "history_type": "transactions",
      "created": "2015-10-07 18:40:15",
      "format": "csv"
    }
  ],
  "total_count": 7,
  "count": 3
}
```

**SDK Code**

```python Example 1
import requests

url = "https://api.voximplant.com/platform_api/GetHistoryReports"

headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Example 1
const url = 'https://api.voximplant.com/platform_api/GetHistoryReports';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Example 1
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.voximplant.com/platform_api/GetHistoryReports"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Example 1
require 'uri'
require 'net/http'

url = URI("https://api.voximplant.com/platform_api/GetHistoryReports")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java Example 1
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.voximplant.com/platform_api/GetHistoryReports")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Example 1
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.voximplant.com/platform_api/GetHistoryReports', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp Example 1
using RestSharp;

var client = new RestClient("https://api.voximplant.com/platform_api/GetHistoryReports");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Example 1
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.voximplant.com/platform_api/GetHistoryReports")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```