> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Download reports with the Web API

> Download ABBYY FlexiCapture reports on operator workload, processing performance, and license consumption as CSV through the Web API GetCsv GET request.

You can use the Web API to download reports on operator workloads, processed documents, documents from specific clients, and other criteria. The API method parameters and the resulting CSV file are identical to those produced when you create reports in the Administration and Monitoring Console. For more information, see [Reports](/flexi-capture/web-stations/monitoring-console/reports).

To download reports, use a GET request with the following URI:

```http theme={null}
GET http://localhost/FlexiCapture12/Monitoring/Report/GetCsv?reportType=<reportType>&filterParametersJson=<filterParametersJson>
```

## Request parameters

Pass `reportType` and `filterParametersJson` in the query string.

### Report types

`reportType` accepts the following values:

| Value | Report                                 |
| ----- | -------------------------------------- |
| `1`   | General Operators report               |
| `3`   | Processing Performance report          |
| `9`   | Site Performance report                |
| `10`  | License Consumption by Tenants report  |
| `11`  | License Consumption by Projects report |

### Report parameters

`filterParametersJson` accepts the parameters used to generate the report. The set of parameters depends on the report type. For more information, see the parameters for each report type:

* [Parameters for General Operators report](/flexi-capture/api/reports/api-reports-operator)
* [Parameters for Processing Performance report](/flexi-capture/api/reports/api-reports-processing)
* [Parameters for Site Performance report](/flexi-capture/api/reports/api-reports-performance)
* [Parameters for License Consumption by Tenants report](/flexi-capture/api/reports/api-reports-consumptionbytenants)
* [Parameters for License Consumption by Projects report](/flexi-capture/api/reports/api-reports-consumptionbyprojects)

## Example script

The following PowerShell script demonstrates how to use this API to download a report.

```powershell theme={null}
# Auth parameters
$endpoint = "https://preprod01.flexicapture.com"
$tenant = "tenantName"
$user = "FCUserName"
$pass = "password"
$filePath = "c:\temp\report.csv"
# Report parameters
$reportType = 3
$jsonparameters = @"
[
    {
        "Name": "dateFrom",
        "Value": "2022-08-31T21:00:00.000Z"
    },
    {
        "Name": "dateTo",
        "Value": "2022-09-01T21:00:00.000Z"
    },
    {
        "Name": "projects",
        "Value": [
            5,
            6,
            7,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            17,
            19,
            20,
            28,
            81,
            221
        ]
    },
    {
        "Name": "aggregateByBatchTypes",
        "Value": true
    },
    {
        "Name": "groupByType",
        "Value": 1
    },
    {
        "Name": "grouping",
        "Value": "ProcessingStageName"
    },
    {
        "Name": "columns",
        "Value": [
            "ProjectId",
            "BatchTypeName",
            "ProcessedBatchs",
            "ProcessedDocs"
        ]
    }
]
"@
###################################################
clear
$ErrorActionPreference="stop"
#Getting authTicket for authorization from FlexiCapture SOAP API
$tenantSuffix=""
$tenantInUrl = ""
if (($tenant -ne $null) -or ($tenant -eq "")) {
    $tenantSuffix= "?Tenant="+$tenant
    $tenantInUrl = "/$tenant"
}
$URL = $endpoint+'/FlexiCapture12/Server/FCAuth/API/Soap'+$tenantSuffix
$SOAPRequest = @"
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soap:Body>
    <FindUser xmlns="urn:http://www.abbyy.com/FlexiCapture">
      <userLogin>$user</userLogin>
    </FindUser>
  </soap:Body>
</soap:Envelope>
"@
$pair = "$($user):$($pass)"
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$basicAuthValue = "Basic $encodedCreds"
$Headers = @{
    'SOAPAction' = '"#FindUser"'
    'Content-Type' = 'text/xml; charset=utf-8'
    'Authorization' = "$basicAuthValue"
}
$response = Invoke-WebRequest -Uri $URL `
    -Headers $Headers `
    -Body $SOAPRequest `
    -Method 'POST'
$authTicket = $response.Headers['AuthTicket']
#Creating auth Cookie
$session = [Microsoft.PowerShell.Commands.WebRequestSession]::new()
$cookie = [System.Net.Cookie]::new('FlexiCaptureTmpPrn', "Ticket=$authTicket")
$session.Cookies.Add($endpoint, $cookie)
# Request report via api and save it
$uriGet = $endpoint+ "/FlexiCapture12/Monitoring$tenantInUrl/Report/GetCSV?reportType=$reportType&filterParametersJson="
$uriGet += [uri]::EscapeDataString($jsonparameters)
$header = @{
    "Accept" = "*/*"
    "Accept-Encoding" = "gzip, deflate, br"
}
$response = Invoke-RestMethod -Uri $uriGet -Method 'GET' -Headers $header -WebSession $session -OutFile $filePath
```
