> ## 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.

# Create SMS Template

> This API creates an SMS template in MoEngage. It helps you upload templates created outside the MoEngage ecosystem to MoEngage and use them for campaign creation.

#### Rate Limit

The rate limit is **100 RPM**. You can upload a maximum of **100 templates per channel**.


## OpenAPI

````yaml /api/sms-templates/sms-templates.yaml post /custom-templates/sms
openapi: 3.0.3
info:
  title: MoEngage SMS Template API
  version: '1.0'
  description: >-
    API for creating, updating, and searching SMS templates 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: SMS Templates
    description: Operations to manage SMS templates.
paths:
  /custom-templates/sms:
    post:
      tags:
        - SMS Templates
      summary: Create SMS Template
      description: >-
        This API creates an SMS template in MoEngage. It helps you upload
        templates created outside the MoEngage ecosystem to MoEngage and use
        them for campaign creation.
      requestBody:
        required: true
        description: The details of the SMS template to be created.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSmsTemplateRequest'
            example:
              basic_details:
                message: >-
                  Hello {{UserAttribute['first_name']}}, your order is on its
                  way!
              meta_info:
                created_by: john.doe@example.com
                template_id: shipping_update_v1
                template_name: Shipping Update Template
                template_version: '1'
      responses:
        '200':
          description: >-
            Success. This response is returned when the template is created
            successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  external_template_id:
                    type: string
                    format: uuid
                    description: >-
                      This field contains the unique ID assigned to the newly
                      created template by MoEngage.
              examples:
                success:
                  summary: Successful Creation
                  value:
                    external_template_id: d05a44f0-a7cf-471a-bcb6-63054800a367
        '400':
          description: >-
            Bad Request. Returned when required parameters are missing, invalid,
            or duplicates exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                validation_failure:
                  summary: Validation Failure
                  value:
                    error:
                      code: 400 Bad Request
                      message: Validation failed because of invalid request data
                      details:
                        - code: NotSupported
                          target: '[''summary'']'
                          message: '[''summary''] are not expected in this request.'
                        - code: MissingValue
                          target: platform
                          message: Template Body is missing for ANDROID.
                      request_id: LMwPhRMB
                empty_name:
                  summary: Empty Template Name
                  value:
                    error:
                      code: 400 Bad Request
                      message: Validation failed because of invalid request data
                      details:
                        - code: MissingValue
                          target: template_name
                          message: >-
                            template_name value is required but value is passed
                            empty.
                      request_id: jUxStmFn
                missing_fields:
                  summary: Missing Mandatory Fields
                  value:
                    error:
                      code: 400 Bad Request
                      message: Validation failed because of invalid request data
                      details:
                        - code: MissingValue
                          target: title
                          message: title value is required but value is passed empty.
                      request_id: eYXFWciv
                duplicate:
                  summary: Duplicate Request
                  value:
                    error:
                      code: 400 Bad Request
                      message: Duplicate - template_id and template_version
                      details:
                        - code: InvalidValue
                          target: Duplicate - template_id and template_version
                          message: >-
                            template_id:basicios12 template_version:12 is
                            already present.
                      request_id: cLCcgLQj
                limit_breach:
                  summary: Max Template Limit Breach
                  value:
                    error:
                      code: 400 Bad Request
                      message: Maximum Template limit exceeded
                      details:
                        - code: NotSupported
                          target: Maximum Template limit exceeded
                          message: >-
                            You have already created maximum allowed template
                            allowed for client
                      request_id: eLeZXIlW
        '401':
          description: >-
            Authentication Failure. Returned when authorization parameters are
            missing.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                auth_required:
                  summary: Authentication Required
                  value:
                    title: Authentication required
                    description: MOE-APPKEY missing in Authentication Header
        '403':
          description: >-
            Unauthorized Access. Returned when authorization fails due to
            incorrect keys.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_secret:
                  summary: Invalid App Secret Key
                  value:
                    error:
                      code: 403 Forbidden
                      message: Authentication required
                      details:
                        - code: InvalidValue
                          target: APP_SECRET_KEY
                          message: Invalid APP_SECRET_KEY is provided.
                      request_id: oZEMYhqA
                invalid_appid:
                  summary: Invalid App ID
                  value:
                    error:
                      code: 403 Forbidden
                      message: Authentication required
                      details:
                        - code: InvalidValue
                          target: APP_ID
                          message: Invalid APP_ID is provided.
                      request_id: TWdrwUMN
        '415':
          description: Unsupported File Type. Content-Type header is missing or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unsupported_media:
                  summary: Unsupported Media Type
                  value:
                    title: Unsupported media type
                    description: Content type is not supported
        '429':
          description: Rate Limit Breach (100 RPM).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                rate_limit:
                  summary: Rate Limit Breach
                  value:
                    response_id: OUUkHvcn
                    type: custom_segment
                    error:
                      code: Too Many Requests
                      message: 'API rate limit breached. Current limit: n/m mins'
        '500':
          description: Internal Server Error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
              examples:
                server_error:
                  summary: Internal Server Error
                  value:
                    title: Internal Server Error
                    message: >-
                      An unexpected error was encountered while processing this
                      request. Please contact MoEngage Team
components:
  schemas:
    CreateSmsTemplateRequest:
      type: object
      required:
        - basic_details
        - meta_info
      properties:
        basic_details:
          type: object
          description: This field contains the basic details of the SMS template.
          required:
            - message
          properties:
            message:
              type: string
              description: This field contains the message of the template.
        meta_info:
          type: object
          description: This field contains information about the template being created.
          required:
            - created_by
            - template_id
            - template_name
            - template_version
          properties:
            created_by:
              type: string
              description: >-
                This field contains details about who created the template. You
                must provide this value.
            template_id:
              type: string
              description: >-
                This field contains the ID for the template and is unique. You
                must provide this value.
            template_name:
              type: string
              description: >-
                This field contains the name of the template. You must provide
                this value, and it will be used for identifying the template.
            template_version:
              type: string
              description: >-
                This field contains the version of the template. You must
                provide this value, and it will be used for tracking the
                template's version.
    ErrorResponse:
      type: object
      description: Standard error response format for 4xx errors.
      properties:
        error:
          type: object
          description: This field contains the reason for the request's failure.
          properties:
            code:
              type: string
              description: The HTTP status code and error type.
              example: 4xx Status Code
            message:
              type: string
              description: A description of the error.
              example: Brief description of the error.
            details:
              type: array
              description: >-
                This is a List of the error details objects. Each object
                contains the following information.
              items:
                type: object
                properties:
                  code:
                    type: string
                    example: ErrorCode
                  target:
                    type: string
                    example: Field Name
                  message:
                    type: string
                    example: Error description for this field.
            request_id:
              type: string
              description: This field contains the unique id pertaining to the request.
              example: Unique Request ID
    InternalServerError:
      type: object
      description: Schema for 500 Internal Server Error.
      properties:
        title:
          type: string
          example: Internal Server Error
        message:
          type: string
          example: >-
            An unexpected error was encountered while processing this request.
            Please contact MoEngage Team
  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).

````