> ## Documentation Index
> Fetch the complete documentation index at: https://moengage.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Update In-app Template

> This API updates an In-app template as per your requirements.



## OpenAPI

````yaml /api/in-app-templates/in-app-templates.yaml put /custom-templates/inapp
openapi: 3.0.3
info:
  title: MoEngage In-app Template API
  version: '1.0'
  description: >-
    API for creating, updating, and searching In-app templates (Self-Handled and
    HTML) within the MoEngage platform.
servers:
  - url: https://api-{dc}.moengage.com/v1.0
    description: MoEngage Custom Templates API Server
    variables:
      dc:
        default: '01'
        description: >-
          The ‘dc’ in the API Endpoint URL refers to the MoEngage Data Center
          (DC). MoEngage hosts each customer in a different DC. You can find
          your DC number and replace the value of ‘dc’ in the URL by referring
          to the DC and API endpoint mapping
          [here](/api/introduction#data-centers). Your MoEngage Data Center (DC)
          can be 01, 02, 03, 04, 05, 06, or 101.
security:
  - basicAuth: []
tags:
  - name: In-app Templates
    description: Operations to manage In-app templates.
paths:
  /custom-templates/inapp:
    put:
      tags:
        - In-app Templates
      summary: Update In-app Template
      description: This API updates an In-app template as per your requirements.
      requestBody:
        required: true
        description: The updated details for the In-app template.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateInAppTemplateRequest'
            example:
              external_template_id: 4a1afbc5-4c31-4f19-8c23-793e27af01aa
              update_campaigns: false
              basic_details:
                payload: <html><body><h1>Hello Updated World!</h1></body></html>
                inapp_template_type: INAPP_HTML
              meta_info:
                template_name: My Updated HTML Promo
                updated_by: jane.doe@example.com
      responses:
        '200':
          description: Template updated successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  external_template_id:
                    type: string
                    format: uuid
                    description: >-
                      This field contains the unique ID corresponding to a
                      successful custom template update. This template ID is
                      used as header input for updates, searches, or any kind of
                      template modifications in a later stage.
                    example: 4a1afbc5-4c31-4f19-8c23-793e27af01aa
        '400':
          description: >-
            Bad Request. This response is returned when the required parameters
            are missing from the request, when the provided parameters are
            invalid, or when a template already exists with the same version,
            name, or ID.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 400 Bad Request
                  message: Validation failed because of invalid request data
                  details:
                    - code: MissingValue
                      target: updated_by
                      message: updated_by attribute is missing in meta_info.
                  request_id: cjUaLVrE
        5XX:
          description: >-
            Internal Server Error. This response is returned when the system
            runs into an unexpected error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    UpdateInAppTemplateRequest:
      type: object
      required:
        - external_template_id
        - basic_details
        - meta_info
      properties:
        external_template_id:
          type: string
          format: uuid
          description: >-
            The external template ID needs to be updated. This field contains
            the unique identifier that is generated during the creation of the
            template.
        update_campaigns:
          type: boolean
          default: false
          description: >-
            This field contains a flag used to update all campaigns currently
            using the template to the newer version. When true, all running
            campaigns with this template will be updated. When false, no change
            will be made to the template used in existing campaigns.
        basic_details:
          type: object
          description: Details about the template, including its payload and template type.
          required:
            - payload
            - inapp_template_type
          properties:
            payload:
              type: string
              description: The updated stringified JSON or HTML content.
            inapp_template_type:
              type: string
              enum:
                - SELF_HANDLED
                - INAPP_HTML
        meta_info:
          type: object
          description: >-
            This field will update template information, such as the name of the
            template and the update's details.
          required:
            - template_name
            - updated_by
          properties:
            template_name:
              type: string
              description: The name of the template being updated.
            updated_by:
              type: string
              format: email
              description: The email ID of the person updating the template.
    ErrorResponse:
      type: object
      description: This field contains the reason for the request's failure.
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: >-
                This field contains the error code that provides a brief
                explanation of the error and is a string. For example, 400 - Bad
                Request, 401- Authentication required, and so on. This field is
                present in the response only in the case of errors.
            message:
              type: string
              description: >-
                This field describes why the request has failed and is a String.
                For example, in the case of a duplicate request (400- Bad
                Request), the following message will be present: 'Duplicate -
                template_id and template_version'.
            details:
              type: array
              description: This is a List of the error details objects.
              items:
                type: object
                properties:
                  code:
                    type: string
                    description: Descriptive Error Code
                  target:
                    type: string
                    description: >-
                      Denotes the field causing the issue or a brief description
                      of the error message in some cases
                  message:
                    type: string
                    description: Descriptive Error Message
            request_id:
              type: string
              description: This field contains the unique ID pertaining to the request.
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: >
        Authentication is done via Basic Auth. This requires a base64-encoded
        string of your credentials in the format 'username:password'.


        - **Username**: Use your MoEngage workspace ID (also known as the App
        ID). You can find it in the MoEngage dashboard at **Settings** >
        **Account** > **APIs** > **Workspace ID (earlier app id)**.

        - **Password**: Use your API Key, which you can find within the
        **Campaign report/Business events/Custom templates/Catalog API/Inform
        Report** tile.


        For more information on authentication and getting your credentials,
        refer
        [here](https://www.moengage.com/docs/api/introduction#getting-your-credentials).

````