---
updatedAt: 2025-11-20T08:01:18.000Z
agentTools:
  projectIndex: https://partner-docs.gupshup.io/llms.txt
---

# Enable template analytics setting

This API endpoint enables or disables template analytics settings for a partner application. Template analytics must be enabled before you can retrieve analytics data using the GET template analytics API.

## Request Parameters

| Key           | Description                                     | Value                   | Type    | Required/Optional | Constraints                                |
| :------------ | :---------------------------------------------- | :---------------------- | :------ | :---------------- | :----------------------------------------- |
| Authorization | Access Token for the application                | `{{PARTNER_APP_TOKEN}}` | String  | Required          | Should be a valid Partner App Access Token |
| APP\_ID       | App ID to fetch the access token                | `{{APP_ID}}`            | String  | Required          | The ID should be a valid app ID of Gupshup |
| enable        | Flag to enable template analytics setting       | True/False              | Boolean | Required          |                                            |
| enableOnUi    | Flag to enable template analytics setting on UI | True/False              | Boolean | Optional          |                                            |

## Sample Request

```curl
curl --location --request POST '{{BASE_URL}}/partner/app/{{APP_ID}}/template/analytics' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'enable=true' \
--data-urlencode 'enableOnUi=true'
```

## Sample Response

```
{
    "status": "success"
}
```

## Status Codes

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Status Code
      </th>

      <th>
        Response
      </th>

      <th>
        Comments
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        **Success**
      </td>

      <td>

      </td>

      <td>

      </td>
    </tr>

    <tr>
      <td>
        200
      </td>

      <td>
        `{ "status": "success" }`
      </td>

      <td>
        Successful response
      </td>
    </tr>

    <tr>
      <td>
        **Error**
      </td>

      <td>

      </td>

      <td>

      </td>
    </tr>

    <tr>
      <td>
        400
      </td>

      <td>
        `{ "status": "error", "message": "Bad Request" }`
      </td>

      <td>
        Bad request
      </td>
    </tr>

    <tr>
      <td>
        429
      </td>

      <td>
        `{ "status": "error", "message": "Too Many Requests" }`
      </td>

      <td>
        10 Requests per Minute
      </td>
    </tr>

    <tr>
      <td>
        500
      </td>

      <td>
        `{ "status": "error", "message": "Internal server error. Please try again later and If Issue still persist than contact Gupshup Dev Support" }`
      </td>

      <td>
        For any Internal Error
      </td>
    </tr>

    <tr>
      <td>
        401
      </td>

      <td>
        `{
          "status": "error",
          "message": "Unauthorised access to the resource. Please review request parameters and headers and retry"
        }`

      </td>

      <td>
        Inavalid/Missing Token or appId.
      </td>
    </tr>
  </tbody>
</Table>

<br />

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Partner Release 8.5 Apis",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://partner.gupshup.io"
    }
  ],
  "tags": [
    {
      "name": "Template Analytics"
    }
  ],
  "paths": {
    "/partner/app/{appId}/template/analytics": {
      "post": {
        "tags": [
          "Template Analytics"
        ],
        "summary": "Enable template analytics setting",
        "description": "API to confirm template analytics on Meta",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "enable"
                ],
                "properties": {
                  "enable": {
                    "type": "boolean",
                    "example": "true",
                    "description": "flag to enable template analytics on Meta"
                  },
                  "enableOnUi": {
                    "type": "boolean",
                    "description": "flag to enable template analytics on UI.\n\noptional(Default: false)",
                    "example": "true"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "Your app token, please refer [**Get access token api**](https://docs.gupshup.io/reference/get_partner-app-appid-token) to get the token from partner documentation.",
            "example": "sk_61b3021c97214370b341f8baaae0xxxx",
            "required": true
          },
          {
            "name": "appId",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Unique identifier of the app.",
            "example": "9e97650d-xxxx-xxxx-xxxx-4cdf47c3fa68"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "stauts": {
                      "type": "string",
                      "example": "sucess"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Authentication Failed"
                    },
                    "status": {
                      "type": "string",
                      "example": "error"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "You do not have the required permissions to access this API"
                    },
                    "status": {
                      "type": "integer",
                      "example": 403
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Internal server error. Please try again later and If Issue still persist than contact Gupshup Dev Support"
                    },
                    "status": {
                      "type": "integer",
                      "example": 500
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```