---
title: "Create Basic Details"
method: POST
path: "/api/MobileApp/templates/create_basic_details"
tags: ["MobileApp"]
---

# Create Basic Details

`POST /api/MobileApp/templates/create_basic_details`

## 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/create_basic_details`
- Auth: OAuth 2
  - Password
  - Token URL: `/auth/token`
- TypeScript: <https://skmtc.dev/leapsurgebi/apis/leapsurgeapi/docs/api/MobileApp/templates/create_basic_details/post.ts> (a function with typed inputs; its response is checked against the schema)

**Function**: `create_basic_details`

**Type**: API Endpoint (POST)

**Purpose**:  
Creates a new template with the given details and saves the initial template details.

**Endpoint**:  
`POST /api/templates/create_basic_details`

**Request Headers**:
- `Customer-Key` (str, required): A base64 encoded string containing `lscode` and `firmcode` for the customer. This must be decoded for database access.

**Request Body**:
- `template_data` (TemplateCreateRequest, required): Contains the template name, report code, format, email subject, email body, email CC and BCC, and status.

**Response**:
- Returns a JSON object containing the newly created template code, template name, format, email subject, email body, email CC and BCC, and status.

**Exceptions**:
- Handles exceptions related to invalid customer key format, missing `idx` for update/delete operations, and database errors, providing appropriate error messages.

**Steps**:
1. **Customer Key Decoding**:  
   Decodes the `Customer_Key` to extract the `lscode` and `firmcode`. Raises an error if the format is invalid.

2. **Input Validation**:  
   Validates the presence of `template_name`, `report_code`, `format`, `email_subject`, and `email_body` in the request body.

3. **Database Connection**:  
   Establishes a connection to the database using `custCursorConnection`.

4. **Template Creation**:  
   Creates a new template with the given details and saves the initial template details.

5. **Transaction Handling**:  
   Commits the transaction if all operations are successful, or rolls back in case of an error.

6. **Logging**:  
   Logs the API call with details of the operation.

7. **Response Construction**:  
   Returns a success message or error details based on the outcome of the operations.

## Headers

- `Customer-Key` string, required

## Request body

- TemplateCreateRequest
  - `id` string, nullable
  - `status` boolean, required
  - `report_type` integer
  - `template_name` string, required
  - `app_code` string, required
  - `format` string, required
  - `email_subject` string, required
  - `email_cc` string[], nullable
  - `email_bcc` string[], nullable
  - `email_body` string, nullable
  - `storage_type` integer
  - `storage_config` object, nullable
  - `is_container` boolean, nullable
  - `file_path` string, nullable
  - `file_name` string, nullable
  - `modified_by` string, nullable
  - `modified_on` string, date-time

## 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/create_basic_details/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)
