> For the complete documentation index, see [llms.txt](https://docs.madconnect.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.madconnect.ai/deployment-options/madconnect-apis/reporting.md).

# Reporting

The reporting APIs allow pulling of reports on both Account and Connection level.

#### **Get Admin Report** <a href="#get-admin-report" id="get-admin-report"></a>

This API allows fetching of reports on the organization level. The API provides aggregated reports for the sub-accounts under the organization.

```
GET /es/v2/reports/admin
```

**Query parameters**

```
&q=keyword
&size=10
&offset=0
&startDate  // unix date in sec
&endDate	// unix date in sec
```

**Response**

```
{
  "statusCode": 0,
  "statusMessage": "string",
  "response": [
    {
      "accountId": "string",
      "accountName": "string",
      "connections": 0,
      "avgDailyVolume": 0,
      "avgMonthlyVolume": 0,
      "totalVolume": 0,
      "totalVolumeBytes": 0,
      "monthCount": 0
    }
  ]
}
```

**Attributes:**

| Attribute        | Description                                                         | Possible Values                |
| ---------------- | ------------------------------------------------------------------- | ------------------------------ |
| accountId        | Unique identifier for the account                                   | UUID (16-character identifier) |
| accountName      | Name of the account                                                 | String (e.g., account name)    |
| connections      | Number of active connections for the account                        | Integer (e.g., 0, 1000, etc.)  |
| avgDailyVolume   | Average daily volume used across all connections for the account    | Integer (e.g., 0, 1000, etc.)  |
| avgMonthlyVolume | AAverage monthly volume used across all connections for the account | Integer (e.g., 0, 1000, etc.)  |
| totalVolume      | Total volume used across all connections for the account            | Integer (e.g., 0, 1000, etc.)  |
| totalVolumeBytes | Total volume used across all connections for the account in bytes   | Integer (e.g., 0, 1000, etc.)  |
| monthCount       | Number of months for which data is available                        | Integer (e.g., 0, 1000, etc.)  |

**Sample Curl:**

```
curl --location '<host>/es/v2/reports/admin?q=&size=10&offset=0&startDate=1727725031&endDate=1743277031' \
--header 'Authorization: Bearer c076dc2e-d0c2-4d4d-ab13-e4e3dd555fc0'
```

#### **Get Connections Report** <a href="#get-connections-report" id="get-connections-report"></a>

This API allows fetching of reports on the sub-account level. The API provides a report on each of the active connections in the sub-account.

```
GET /es/v2/reports/connection
```

**Query parameters**

```
&accountId=<sub_account_id> // Required for fetching reports in sub-accounts
&q=keyword
&size=10
&offset=0
```

**Response**

```
{
  "statusCode": 0,
  "statusMessage": "string",
  "response": [
    {
      "connectionName": "string",
      "connectionId": "string",
      "status": "string",
      "totalVolume": 0
    }
  ]
}
```

**Attributes:**

| Attribute      | Description                          | Possible Values                                      |
| -------------- | ------------------------------------ | ---------------------------------------------------- |
| connectionName | Name of the account                  | String (e.g., connection name)                       |
| connectionId   | Unique identifier for the connection | UUID (16-character identifier)                       |
| status         | Status of the connection             | `in-progress,active,disabled,deleted,broken,offline` |
| totalVolume    | Total volume used by the connection  | Integer (e.g., 0, 1000, etc.)                        |

**Sample Curl:**

```
curl --location '<host>/es/v2/reports/connection?accountId=a3ba4fbd9d51df11&q=&size=10&offset=0' \
--header 'Authorization: Bearer c076dc2e-d0c2-4d4d-ab13-e4e3dd555fc0'
```

#### **Get Connection Report (Batch vise)** <a href="#get-connection-report-batch-vise" id="get-connection-report-batch-vise"></a>

This API allows fetching of a report for a given connection. The API provides details on the individual data transfers in a connection.

```
GET /es/v2/reports/connection/<connection_id>
```

**Query parameters**

```
&accountId=<sub_account_id> // Required for fetching reports in sub-accounts

&q=keyword
&size=10
&offset=0
```

**Response**

```
{
  "statusCode": 0,
  "statusMessage": "string",
  "response": [
    {
      "startTime": 0,
      "endTime": 0,
      "batchId": "string",
      "status": "string",
      "operation": "string",
      "totalRowsProcessed": 0,
      "deliveredRows": 0,
      "failedRows": 0
    }
  ]
}
```

**Attributes:**

| Attribute          | Description                                    | Possible Values                              |
| ------------------ | ---------------------------------------------- | -------------------------------------------- |
| startTime          | Batch start time                               | Unix timestamp (seconds)                     |
| endTime            | Batch end time                                 | Unix timestamp (seconds)                     |
| batchId            | Unique identifier for the batch                | UUID (32-character identifier)               |
| status             | Status of the batch                            | `initialization,in-progress,success,failure` |
| operation          | Operation type of the data transfer            | `individual,batch`                           |
| totalRowsProcessed | Total number of rows processed for transfer    | Integer (e.g., 0, 1000, etc.)                |
| deliveredRows      | Total number of rows delivered during transfer | Integer (e.g., 0, 1000, etc.)                |
| failedRows         | Total number of rows failed during transfer    | Integer (e.g., 0, 1000, etc.)                |

**Sample Curl::**

```
curl --location '<host>/es/v2/reports/connection/849b79953b98fe11?accountId=a3ba4fbd9d51df11&q=&size=10&offset=0' \
--header 'Authorization: Bearer c076dc2e-d0c2-4d4d-ab13-e4e3dd555fc9'
```

#### **Download Report** <a href="#download-report" id="download-report"></a>

This API allows to download a report for,

* All active connections in a sub-account
* Individual connection with batch level details

```
GET /es/v2/reports/download
```

**Query parameters**

```
&accountId=<sub_account_id> // Required for fetching reports in sub-accounts
&connectionId=<connection_id>// Optional - pull batch level data for a connection
&startDate  // unix date in sec
&endDate	// unix date in sec

```

**Response:**

```
Attached file to response
```

**Sample Curl:**

```
curl --location '<host>/es/v2/reports/download?accountId=a3ba4fbd9d51df11&connectionId=849b79953b98fe11&startDate=0&endDate=0' \
--header 'Authorization: Bearer c076dc2e-d0c2-4d4d-ab13-e4e3dd555fc0'
```
