---
title: "Report Template"
source: /gcxone/api/report-template
locale: en
updated: 2026-09-04
---
Operations on report template resources. 3 endpoints, each relative to `https://api.nxgen.cloud/api/v1` and authenticated as described under [Authentication](/gcxone/api/authentication).

## GET /report-templates

Get all the report templates

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| hierarchyLevel | query | string | yes |  |

### Responses

| Status | Description | Body |
| --- | --- | --- |
| 200 | Success |  |
| 400 | Invalid input |  |
| 401 | Unauthorized |  |
| 403 | Forbidden |  |
| 404 | Not Found |  |

Example `200` response:

```json
{
  "data": [
    {
      "uniqueId": "f8715fd9a65b473580d787a63dca6a5e",
      "type": "HealthReport",
      "serviceProviderIds": [],
      "hierarchyLevel": "site",
      "template": "<!DOCTYPE html>",
      "isActive": true,
      "userLevel": false,
      "cronSchedule": "0 4 * * *",
      "emailSubject": "{{reportName}}",
      "emailBody": "Dear Customer,,<br><br>We hope this message finds you well.<br><br>We are pleased to inform you that the {{reportName}} is now available for download. Please find the details of the report <a href='{{fileUrl}}'>here</a><br><br>Please note that this link will remain active for the next seven days only. Kindly ensure that you download and review the report within this timeframe."
    }
  ]
}
```

## POST /report-templates/execute

Get report sample based on template

### Request body

```json
{
  "reportTemplateId": "string",
  "hierarchyId": "string",
  "startTime": "number",
  "endTime": "number",
  "onlySampleData": "boolean"
}
```

### Responses

| Status | Description | Body |
| --- | --- | --- |
| 200 | Success |  |
| 400 | Invalid input |  |
| 401 | Unauthorized |  |
| 403 | Forbidden |  |
| 404 | Not Found |  |

Example `200` response:

```json
{
  "data": {}
}
```

## GET /report-templates/{reportTemplateId}

Get report template by Id

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| reportTemplateId | path | string | yes |  |

### Responses

| Status | Description | Body |
| --- | --- | --- |
| 200 | Success |  |
| 400 | Invalid input |  |
| 401 | Unauthorized |  |
| 403 | Forbidden |  |
| 404 | Not Found |  |

Example `200` response:

```json
{
  "data": {
    "uniqueId": "f8715fd9a65b473580d787a63dca6a5e",
    "type": "HealthReport",
    "serviceProviderIds": [],
    "hierarchyLevel": "site",
    "template": "<!DOCTYPE html>",
    "isActive": true,
    "dataSources": [
      {
        "parameters": [
          "customerId"
        ],
        "_id": "6683e770d05d712a670cee7d",
        "query": "[{\"$match\":{\"customerId\":\"{{customerId}}\"}}]",
        "collectionName": "Sensors",
        "output": "response",
        "metadata": {
          "fieldsRequiringSignedUrl": [
            {
              "field": "s3ImagePath",
              "bucketName": "nxg-reference-img-upload-test"
            }
          ]
        }
      }
    ],
    "emailSubject": "{{reportName}}",
    "emailBody": "Dear Customer,,<br><br>We hope this message finds you well.<br><br>We are pleased to inform you that the {{reportName}} is now available for download. Please find the details of the report <a href='{{fileUrl}}'>here</a><br><br>Please note that this link will remain active for the next seven days only. Kindly ensure that you download and review the report within this timeframe."
  }
}
```