# Reporting

*For more details, please refer to the Reporting feature.*

{% content-ref url="../../../features/key-features/reporting" %}
[reporting](https://docs.datasentinel.io/manual/features/key-features/reporting)
{% endcontent-ref %}

To use the Reporting API, it's necessary to generate an access token.

{% content-ref url="access-token" %}
[access-token](https://docs.datasentinel.io/manual/implementation/platform-usage/api-reference/access-token)
{% endcontent-ref %}

{% hint style="info" %}
A comprehensive toolkit, with practical usage examples, is accessible on [GitHub](https://github.com/datasentinel/datasentinel_toolkit).

This  toolkit comes pre-installed as a default component within the on-premises platform, located at `/datasentinel/soft/datasentinel_toolkit`.
{% endhint %}

## **Reports**

## Session History

<mark style="color:green;">`POST`</mark> `https://<<platform-server>>/ds-api/activity/session-history-report`

Create a Session History report in PDF format.\
\
For more details, refer to [Session History Feature](https://docs.datasentinel.io/manual/features/key-features/session-history).

#### Headers

| Name                                         | Type   | Description            |
| -------------------------------------------- | ------ | ---------------------- |
| user-token<mark style="color:red;">\*</mark> | String | Generated Access Token |

#### Request Body

| Name                                   | Type    | Description                                                                                                                                                                                                                                                                                                                                 |
| -------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| utc\_time                              | Boolean | <p>When set to <strong>false,</strong> the considered timezone will rely on the platform's timezone.<br><br>Default: <strong>true</strong></p>                                                                                                                                                                                              |
| from<mark style="color:red;">\*</mark> |         | <p>Begin time<br><br>Date format:</p><p>YYYY-MM-DD</p><p>YYYY-MM-DD HH:MI </p><p>YYYY-MM-DD HH:MI:SS</p>                                                                                                                                                                                                                                    |
| to<mark style="color:red;">\*</mark>   | String  | <p>End time<br><br>Date format:</p><p>YYYY-MM-DD</p><p>YYYY-MM-DD HH:MI </p><p>YYYY-MM-DD HH:MI:SS</p>                                                                                                                                                                                                                                      |
| filters                                | Array   | <p>Array of Tags<br><br>{ </p><p>“tag” : Tag name, </p><p>“value”: Tag value</p><p>}</p>                                                                                                                                                                                                                                                    |
| database                               | String  | <p>Enables the ability to focus on a specific database</p><p></p><p>Default: <strong>All</strong></p>                                                                                                                                                                                                                                       |
| group                                  | String  | <p>The grouping dimension, namely <strong>wait\_event\_type</strong> is consistently calculated. </p><p></p><p>You have the option to include an additional dimension (aka Tag).<br>Refer to <a href="../../../features/tips-and-hints/tags">Tags section</a> for more details</p><p></p><p>Default: <strong>wait\_event\_type</strong></p> |
| sub\_group                             | String  | <p>The grouping dimension, namely <strong>wait\_event</strong> is consistently calculated. </p><p></p><p>You have the option to include an additional dimension (aka Tag).<br>Refer to <a href="../../../features/tips-and-hints/tags">Tags section</a> for more details</p>                                                                |
| limit                                  | Number  | <p>Restrict the count of displayed lines within the report.</p><p></p><p>Default: <strong>20</strong></p>                                                                                                                                                                                                                                   |

**Response**

{% tabs %}
{% tab title="201: Created " %}
Generate the report and deliver it through email if the option is specified.
{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}

{% tab title="500: Internal Server Error Internal error" %}

{% endtab %}
{% endtabs %}

## Top Queries

<mark style="color:green;">`POST`</mark> `https://<<platform-server>>/ds-api/activity/top-queries-report`

Create a Top Queries report in PDF format.\
\
For more details, refer to [Top Queries Feature](https://docs.datasentinel.io/manual/features/key-features/top-queries).

#### Headers

| Name                                         | Type   | Description            |
| -------------------------------------------- | ------ | ---------------------- |
| user-token<mark style="color:red;">\*</mark> | String | Generated Access Token |

#### Request Body

| Name                                      | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ----------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| utc\_time                                 | Boolean | <p>When set to <strong>false,</strong> the considered timezone will rely on the platform's timezone.<br><br>Default: <strong>true</strong></p>                                                                                                                                                                                                                                                                                                                                                                |
| from<mark style="color:red;">\*</mark>    |         | <p>Begin time<br><br>Date format:</p><p>YYYY-MM-DD</p><p>YYYY-MM-DD HH:MI </p><p>YYYY-MM-DD HH:MI:SS</p>                                                                                                                                                                                                                                                                                                                                                                                                      |
| to<mark style="color:red;">\*</mark>      | String  | <p>End time<br><br>Date format:</p><p>YYYY-MM-DD</p><p>YYYY-MM-DD HH:MI </p><p>YYYY-MM-DD HH:MI:SS</p>                                                                                                                                                                                                                                                                                                                                                                                                        |
| filters<mark style="color:red;">\*</mark> | Array   | <p>Array of Tags<br><br>{ </p><p>“tag” : Tag name, </p><p>“value”: Tag value</p><p>}</p>                                                                                                                                                                                                                                                                                                                                                                                                                      |
| database                                  | String  | <p>Enables the ability to focus on a specific database</p><p></p><p>Default: <strong>All</strong></p>                                                                                                                                                                                                                                                                                                                                                                                                         |
| by                                        | String  | <p>The grouping dimension.</p><p></p><p>Default: <strong>total\_time</strong></p><p></p><p>The available options for the grouping dimension are:</p><p>calls </p><p>local\_blks\_dirtied </p><p>local\_blks\_hit </p><p>local\_blks\_read </p><p>local\_blks\_written </p><p>rows </p><p>shared\_blks\_dirtied shared\_blks\_hit </p><p>shared\_blks\_read shared\_blks\_written temp\_blks\_read temp\_blks\_written </p><p>total\_time </p><p>blk\_read\_time </p><p>blk\_write\_time </p><p>wal\_bytes</p> |
| limit                                     | Number  | <p>Restrict the count of displayed lines within the report.</p><p></p><p>Default: <strong>20</strong></p>                                                                                                                                                                                                                                                                                                                                                                                                     |

**Response**

{% tabs %}
{% tab title="201: Created " %}
Generate the report and deliver it through email if the option is specified.
{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}

{% tab title="500: Internal Server Error Internal error" %}

{% endtab %}
{% endtabs %}

## Top Tables

<mark style="color:green;">`POST`</mark> `https://<<platform-server>>/ds-api/activity/table-report`

Create a Top Tables report in PDF format.\
\
For more details, refer to [Top Tables Feature](https://docs.datasentinel.io/manual/features/key-features/top-tables).

#### Headers

| Name                                         | Type   | Description            |
| -------------------------------------------- | ------ | ---------------------- |
| user-token<mark style="color:red;">\*</mark> | String | Generated Access Token |

#### Request Body

| Name                                   | Type    | Description                                                                                                                                                                                                                                                                                        |
| -------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| utc\_time                              | Boolean | <p>When set to <strong>false,</strong> the considered timezone will rely on the platform's timezone.<br><br>Default: <strong>true</strong></p>                                                                                                                                                     |
| from<mark style="color:red;">\*</mark> |         | <p>Begin time<br><br>Date format:</p><p>YYYY-MM-DD</p><p>YYYY-MM-DD HH:MI </p><p>YYYY-MM-DD HH:MI:SS</p>                                                                                                                                                                                           |
| to<mark style="color:red;">\*</mark>   | String  | <p>End time<br><br>Date format:</p><p>YYYY-MM-DD</p><p>YYYY-MM-DD HH:MI </p><p>YYYY-MM-DD HH:MI:SS</p>                                                                                                                                                                                             |
| filters                                | Array   | <p>Array of Tags<br><br>{ </p><p>“tag” : Tag name, </p><p>“value”: Tag value</p><p>}</p>                                                                                                                                                                                                           |
| database                               | String  | <p>Enables the ability to focus on a specific database</p><p></p><p>Default: <strong>All</strong></p>                                                                                                                                                                                              |
| by                                     | String  | <p>The table grouping dimension.</p><p></p><p>Default: <strong>heap\_blks\_read</strong></p><p></p><p>The available options for the grouping dimension are:</p><p>heap\_blks\_hit </p><p>heap\_blks\_read </p><p>idx\_blks\_hit </p><p>idx\_blks\_read </p><p>idx\_scan </p><p>idx\_tup\_fetch</p> |
| limit                                  | Number  | <p>Restrict the count of displayed lines within the report.</p><p></p><p>Default: <strong>20</strong></p>                                                                                                                                                                                          |
| index\_by                              | String  | <p>The index grouping dimension.</p><p></p><p>Default: <strong>idx\_blks\_read</strong></p><p></p><p>The available options for the grouping dimension are:</p><p>idx\_blks\_hit</p><p>idx\_blks\_read</p><p>idx\_scan</p><p>idx\_tup\_fetch</p><p>idx\_tup\_read</p><p>size</p>                    |

**Response**

{% tabs %}
{% tab title="201: Created " %}
Generate the report and deliver it through email if the option is specified.
{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}

{% tab title="500: Internal Server Error Internal error" %}

{% endtab %}
{% endtabs %}

## Instance

<mark style="color:green;">`POST`</mark> `https://<<platform-server>>/ds-api/activity/instance-report`

Create an Instance report in PDF format.\
\
For more details, refer to [Cluster & System Metrics Feature](https://docs.datasentinel.io/manual/features/key-features/cluster-and-system-metrics).

#### Headers

| Name                                         | Type   | Description            |
| -------------------------------------------- | ------ | ---------------------- |
| user-token<mark style="color:red;">\*</mark> | String | Generated Access Token |

#### Request Body

| Name                                   | Type    | Description                                                                                                                                    |
| -------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| utc\_time                              | Boolean | <p>When set to <strong>false,</strong> the considered timezone will rely on the platform's timezone.<br><br>Default: <strong>true</strong></p> |
| from<mark style="color:red;">\*</mark> |         | <p>Begin time<br><br>Date format:</p><p>YYYY-MM-DD</p><p>YYYY-MM-DD HH:MI </p><p>YYYY-MM-DD HH:MI:SS</p>                                       |
| to<mark style="color:red;">\*</mark>   | String  | <p>End time<br><br>Date format:</p><p>YYYY-MM-DD</p><p>YYYY-MM-DD HH:MI </p><p>YYYY-MM-DD HH:MI:SS</p>                                         |
| filters                                | Array   | <p>Array of Tags<br><br>{ </p><p>“tag” : Tag name, </p><p>“value”: Tag value</p><p>}</p>                                                       |
| database                               | String  | <p>Enables the ability to focus on a specific database</p><p></p><p>Default: <strong>All</strong></p>                                          |

**Response**

{% tabs %}
{% tab title="201: Created " %}
Generate the report and deliver it through email if the option is specified.
{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}

{% tab title="500: Internal Server Error Internal error" %}

{% endtab %}
{% endtabs %}

## Server

<mark style="color:green;">`POST`</mark> `https://<<platform-server>>/ds-api/activity/server-report`

Create an Server report in PDF format.\
\
For more details, refer to [Cluster & System Metrics Feature](https://docs.datasentinel.io/manual/features/key-features/cluster-and-system-metrics).

#### Headers

| Name                                         | Type   | Description            |
| -------------------------------------------- | ------ | ---------------------- |
| user-token<mark style="color:red;">\*</mark> | String | Generated Access Token |

#### Request Body

| Name                                   | Type    | Description                                                                                                                                    |
| -------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| utc\_time                              | Boolean | <p>When set to <strong>false,</strong> the considered timezone will rely on the platform's timezone.<br><br>Default: <strong>true</strong></p> |
| from<mark style="color:red;">\*</mark> |         | <p>Begin time<br><br>Date format:</p><p>YYYY-MM-DD</p><p>YYYY-MM-DD HH:MI </p><p>YYYY-MM-DD HH:MI:SS</p>                                       |
| to<mark style="color:red;">\*</mark>   | String  | <p>End time<br><br>Date format:</p><p>YYYY-MM-DD</p><p>YYYY-MM-DD HH:MI </p><p>YYYY-MM-DD HH:MI:SS</p>                                         |
| filters                                | Array   | <p>Array of Tags<br><br>{ </p><p>“tag” : Tag name, </p><p>“value”: Tag value</p><p>}</p>                                                       |

**Response**

{% tabs %}
{% tab title="201: Created " %}
Generate the report and deliver it through email if the option is specified.
{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}

{% tab title="500: Internal Server Error Internal error" %}

{% endtab %}
{% endtabs %}

## Query Details

<mark style="color:green;">`POST`</mark> `https://<<platform-server>>/ds-api/activity/query-report`

Create an report based on a query identifier in PDF format.<br>

#### Headers

| Name                                         | Type   | Description            |
| -------------------------------------------- | ------ | ---------------------- |
| user-token<mark style="color:red;">\*</mark> | String | Generated Access Token |

#### Request Body

| Name                                             | Type    | Description                                                                                                                                    |
| ------------------------------------------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| utc\_time                                        | Boolean | <p>When set to <strong>false,</strong> the considered timezone will rely on the platform's timezone.<br><br>Default: <strong>true</strong></p> |
| from<mark style="color:red;">\*</mark>           |         | <p>Begin time<br><br>Date format:</p><p>YYYY-MM-DD</p><p>YYYY-MM-DD HH:MI </p><p>YYYY-MM-DD HH:MI:SS</p>                                       |
| to<mark style="color:red;">\*</mark>             | String  | <p>End time<br><br>Date format:</p><p>YYYY-MM-DD</p><p>YYYY-MM-DD HH:MI </p><p>YYYY-MM-DD HH:MI:SS</p>                                         |
| filters                                          | Array   | <p>Array of Tags<br><br>{ </p><p>“tag” : Tag name, </p><p>“value”: Tag value</p><p>}</p>                                                       |
| database                                         | String  | <p>Enables the ability to focus on a specific database</p><p></p><p>Default: <strong>All</strong></p>                                          |
| query\_md5\_id<mark style="color:red;">\*</mark> | String  | <p>Query internal identifier computed by Datasentinel and displayed on the user interface.</p><p><br></p>                                      |

**Response**

{% tabs %}
{% tab title="201: Created " %}
Generate the report and deliver it through email if the option is specified.
{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}

{% tab title="500: Internal Server Error Internal error" %}

{% endtab %}
{% endtabs %}

## Data Size

<mark style="color:green;">`POST`</mark> `https://<<platform-server>>/ds-api/activity/data-size-report`

Produce a report of table and index sizes.

#### Headers

| Name                                         | Type   | Description            |
| -------------------------------------------- | ------ | ---------------------- |
| user-token<mark style="color:red;">\*</mark> | String | Generated Access Token |

#### Request Body

| Name                                   | Type    | Description                                                                                                                                    |
| -------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| utc\_time                              | Boolean | <p>When set to <strong>false,</strong> the considered timezone will rely on the platform's timezone.<br><br>Default: <strong>true</strong></p> |
| from<mark style="color:red;">\*</mark> |         | <p>Begin time<br><br>Date format:</p><p>YYYY-MM-DD</p><p>YYYY-MM-DD HH:MI </p><p>YYYY-MM-DD HH:MI:SS</p>                                       |
| to<mark style="color:red;">\*</mark>   | String  | <p>End time<br><br>Date format:</p><p>YYYY-MM-DD</p><p>YYYY-MM-DD HH:MI </p><p>YYYY-MM-DD HH:MI:SS</p>                                         |
| filters                                | Array   | <p>Array of Tags<br><br>{ </p><p>“tag” : Tag name, </p><p>“value”: Tag value</p><p>}</p>                                                       |
| database                               | String  | <p>Enables the ability to focus on a specific database</p><p></p><p>Default: <strong>All</strong></p>                                          |

**Response**

{% tabs %}
{% tab title="201: Created " %}
Generate the report and deliver it through email if the option is specified.
{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}

{% tab title="500: Internal Server Error Internal error" %}

{% endtab %}
{% endtabs %}

## Full Report

<mark style="color:green;">`POST`</mark> `https://<<platform-server>>/ds-api/activity/full-report`

Generate a report that incorporates all the previously mentioned report sections.<br>

#### Headers

| Name                                         | Type   | Description            |
| -------------------------------------------- | ------ | ---------------------- |
| user-token<mark style="color:red;">\*</mark> | String | Generated Access Token |

#### Request Body

| Name                                   | Type    | Description                                                                                                                                    |
| -------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| utc\_time                              | Boolean | <p>When set to <strong>false,</strong> the considered timezone will rely on the platform's timezone.<br><br>Default: <strong>true</strong></p> |
| from<mark style="color:red;">\*</mark> |         | <p>Begin time<br><br>Date format:</p><p>YYYY-MM-DD</p><p>YYYY-MM-DD HH:MI </p><p>YYYY-MM-DD HH:MI:SS</p>                                       |
| to<mark style="color:red;">\*</mark>   | String  | <p>End time<br><br>Date format:</p><p>YYYY-MM-DD</p><p>YYYY-MM-DD HH:MI </p><p>YYYY-MM-DD HH:MI:SS</p>                                         |
| filters                                | Array   | <p>Array of Tags<br><br>{ </p><p>“tag” : Tag name, </p><p>“value”: Tag value</p><p>}</p>                                                       |
| database                               | String  | <p>Enables the ability to focus on a specific database</p><p></p><p>Default: <strong>All</strong></p>                                          |

**Response**

{% tabs %}
{% tab title="500: Internal Server Error Internal error" %}

{% endtab %}

{% tab title="201: Created " %}
Generate the report and deliver it through email if the option is specified.
{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}
{% endtabs %}

## Email Reports

To enable direct email transmission of reports, you should include the following parameters:

* **report\_type**: "email"
* **subject**: \[Optional] Default: "\[Datasentinel] <\<Report Type>> report"
  * The subject line for the email.
* **recipients**: An array of email addresses.
  * You can specify multiple email addresses here.
