---
title: "Update Template"
method: POST
path: "/api/MobileApp/templates/update"
tags: ["MobileApp"]
---

# Update Template

`POST /api/MobileApp/templates/update`

## Request

- Base URL: `https://api.leapsurgebi.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.leapsurgebi.com/api/MobileApp/templates/update`
- Auth: OAuth 2
  - Password
  - Token URL: `/auth/token`
- TypeScript: <https://skmtc.dev/leapsurgebi/apis/leapsurgeapi/docs/api/MobileApp/templates/update/post.ts> (a function with typed inputs; its response is checked against the schema)

**Function**: `update_template`
**Type**: API Endpoint (POST)

**Purpose**:  
Updates an existing template in the database.

**Request Body**:  
The request body should contain a JSON object with the following properties:
- `data`: A list of template data objects, each with the following properties:
    - `id`: The ID of the template to update.
    - `template_name`: The new name of the template.
    - `report_code`: The report code of the template.
    - `is_page`: A boolean indicating whether this template is a page.
    - `page_list`: A list of page IDs if `is_page` is True.
    - `status`: A boolean indicating whether the template is active or not.
    - `modified_by`: The ID of the user who modified the template.
    - `modified_on`: The date and time when the template was modified.

**Response**:  
The API returns a JSON object with a success message if the update is successful.

**Exceptions**:  
- Raises `JSONResponse` with a 400 status code if any of the template IDs do not exist.
- Raises `JSONResponse` with a 500 status code for any internal server errors.

## Request body

- TemplateDataRequest
  - `data` TemplateData[], required
    - `id` string, nullable
    - `status` boolean, required
    - `app_code` string, required
    - `template_name` string, required
    - `report_code` string, required
    - `is_page` boolean, required
    - `page_list` string[], nullable
    - `modified_by` string, nullable
    - `modified_on` string, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

## Changes

- **2026-09-24** `23b42df3193a`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/leapsurgebi/apis/leapsurgeapi/changes/api/MobileApp/templates/update/post.md)

---

[API](https://skmtc.dev/leapsurgebi/apis/leapsurgeapi.md) - [All operations](https://skmtc.dev/leapsurgebi/apis/leapsurgeapi/llms.txt) - [OpenAPI document](https://skmtc.dev/leapsurgebi/apis/leapsurgeapi/revisions/13653cb8ee76?raw)
