---
updatedAt: 2025-04-03T10:11:47.000Z
agentTools:
  projectIndex: https://partner-docs.gupshup.io/llms.txt
---

# Document

## Request Parameters

<Table align={["left","left","left","left","left","left"]}>
  <thead>
    <tr>
      <th style={{ textAlign: "left" }}>
        Key
      </th>

      <th style={{ textAlign: "left" }}>
        Description
      </th>

      <th style={{ textAlign: "left" }}>
        Value
      </th>

      <th style={{ textAlign: "left" }}>
        Data Type
      </th>

      <th style={{ textAlign: "left" }}>
        Required/Optional
      </th>

      <th style={{ textAlign: "left" }}>
        Constraints
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td style={{ textAlign: "left" }}>
        Authorization
      </td>

      <td style={{ textAlign: "left" }}>
        Access Token for the application
      </td>

      <td style={{ textAlign: "left" }}>
        \{\{PARTNER\_APP\_TOKEN}}
      </td>

      <td style={{ textAlign: "left" }}>
        String
      </td>

      <td style={{ textAlign: "left" }}>
        Required
      </td>

      <td style={{ textAlign: "left" }}>
        Should be a valid Partner App Access Token
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        elementName
      </td>

      <td style={{ textAlign: "left" }}>
        The name of a template. Element name is unique for a WABAs namespace.
      </td>

      <td style={{ textAlign: "left" }}>
        \{\{ELEMENT\_NAME}}
      </td>

      <td style={{ textAlign: "left" }}>
        String
      </td>

      <td style={{ textAlign: "left" }}>
        Required
      </td>

      <td style={{ textAlign: "left" }}>
        elementName (not more than 180 char.) Mandatory fields
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        languageCode
      </td>

      <td style={{ textAlign: "left" }}>
        Language code for the template. Refer to all the language codes [here](https://support.gupshup.io/hc/en-us/articles/360013321939).
      </td>

      <td style={{ textAlign: "left" }}>
        \{\{LANGUAGE\_CODE}}
      </td>

      <td style={{ textAlign: "left" }}>
        String
      </td>

      <td style={{ textAlign: "left" }}>
        Optional
      </td>

      <td style={{ textAlign: "left" }}>
        languageCode default value : `en_US`
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        content
      </td>

      <td style={{ textAlign: "left" }}>
        The body of the template. Character limit: 1028. For "Authentication" category the first line should be - \{\{1}} is your verification code.
      </td>

      <td style={{ textAlign: "left" }}>
        \{\{CONTENT}}
      </td>

      <td style={{ textAlign: "left" }}>
        String
      </td>

      <td style={{ textAlign: "left" }}>
        Required
      </td>

      <td style={{ textAlign: "left" }}>
        content (not more than 1024 char.)
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        category
      </td>

      <td style={{ textAlign: "left" }}>
        The category of your template.
      </td>

      <td style={{ textAlign: "left" }}>
        \{\{CATEGORY}}
      </td>

      <td style={{ textAlign: "left" }}>
        String
      </td>

      <td style={{ textAlign: "left" }}>
        Required
      </td>

      <td style={{ textAlign: "left" }}>

      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        vertical
      </td>

      <td style={{ textAlign: "left" }}>
        TEXT
      </td>

      <td style={{ textAlign: "left" }}>
         \{\{VERTICAL}}
      </td>

      <td style={{ textAlign: "left" }}>
        String
      </td>

      <td style={{ textAlign: "left" }}>
        Required
      </td>

      <td style={{ textAlign: "left" }}>
        vertical (not more than 180 char.)
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        footer
      </td>

      <td style={{ textAlign: "left" }}>
        Footer of the template.
      </td>

      <td style={{ textAlign: "left" }}>
        \{\{FOOTER}}
      </td>

      <td style={{ textAlign: "left" }}>
        String
      </td>

      <td style={{ textAlign: "left" }}>
        Optional
      </td>

      <td style={{ textAlign: "left" }}>

      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        templateType
      </td>

      <td style={{ textAlign: "left" }}>
        DOCUMENT
      </td>

      <td style={{ textAlign: "left" }}>
        \{\{TEMPLATE\_TYPE}}
      </td>

      <td style={{ textAlign: "left" }}>
        String
      </td>

      <td style={{ textAlign: "left" }}>
        Required
      </td>

      <td style={{ textAlign: "left" }}>

      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        example
      </td>

      <td style={{ textAlign: "left" }}>
        Template Example
      </td>

      <td style={{ textAlign: "left" }}>
        \{\{EXAMPLE}}
      </td>

      <td style={{ textAlign: "left" }}>
        String
      </td>

      <td style={{ textAlign: "left" }}>
        Required
      </td>

      <td style={{ textAlign: "left" }}>

      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        exampleMedia
      </td>

      <td style={{ textAlign: "left" }}>
        Handle Id required to generate media templates
      </td>

      <td style={{ textAlign: "left" }}>
        \{\{ENABLE\_MEDIA}}
      </td>

      <td style={{ textAlign: "left" }}>
        String
      </td>

      <td style={{ textAlign: "left" }}>
        Required
      </td>

      <td style={{ textAlign: "left" }}>
        This is handleId.  

        Generate handleId here
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        enableSample
      </td>

      <td style={{ textAlign: "left" }}>
        Required for creating all types of templates
      </td>

      <td style={{ textAlign: "left" }}>
        \{\{ENABLE\_SAMPLE}}
      </td>

      <td style={{ textAlign: "left" }}>
        true/false
      </td>

      <td style={{ textAlign: "left" }}>
        Optional
      </td>

      <td style={{ textAlign: "left" }}>
        if enableSample is true then exampleMedia
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        allowTemplateCategoryChange
      </td>

      <td style={{ textAlign: "left" }}>
        Boolean value. If True, Meta will automatically update the category of the template as per the template content. Default value is False.
      </td>

      <td style={{ textAlign: "left" }}>
        \{\{ALLOW\_TEMPLATE\_CATEGORY\_CHANGE}}
      </td>

      <td style={{ textAlign: "left" }}>
        Boolean
      </td>

      <td style={{ textAlign: "left" }}>
        Optional
      </td>

      <td style={{ textAlign: "left" }}>

      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        appId
      </td>

      <td style={{ textAlign: "left" }}>
        App ID to fetch the access token
      </td>

      <td style={{ textAlign: "left" }}>
        \{\{APP\_ID}}
      </td>

      <td style={{ textAlign: "left" }}>
        String
      </td>

      <td style={{ textAlign: "left" }}>
        Required
      </td>

      <td style={{ textAlign: "left" }}>
        The Id should be a valid app Id of Gupshup  

        The App must be associated with the account that owns the PARTNER\_APP\_TOKEN being used
      </td>
    </tr>
  </tbody>
</Table>

## Sample Request

```curl
curl --location --request POST 'https://partner.gupshup.io/partner/app/{{APP_ID}}/templates' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'elementName={{ELEMENT_NAME}}' \
--data-urlencode 'languageCode={{LANGUAGE_CODE}}' \
--data-urlencode 'content={{CONTENT}}' \
--data-urlencode 'footer={{FOOTER}}' \
--data-urlencode 'category={{CATEGORY}}' \
--data-urlencode 'templateType={{TEMPLATE_TYPE}}' \
--data-urlencode 'vertical={{VERTICAL}}' \
--data-urlencode 'example={{EXAMPLE}}' \
--data-urlencode 'exampleMedia={{EXAMPLE_MEDIA}}' \
--data-urlencode 'enableSample={{ENABLE_SAMPLE}}' \
--data-urlencode 'allowTemplateCategoryChange={{ALLOW_TEMPLATE_CATEGORY_CHANGE}}'
```

## Sample Response

```json
{
    "status": "success",
    "template": {
        "appId": "a41b30f4-d202-4fdb-911e-3a8fbfbfb797",
        "category": "MARKETING",
        "containerMeta": "{\"appId\":\"a41b30f4-d202-4fdb-911e-3a8fbfbfb797\",\"data\":\"Hi {{1}}\",\"footer\":\"This is the footer\",\"sampleText\":\"Hi User\",\"sampleMedia\":\"4::aW1hZ2UvcadG5n:ARYaMMMA2QvIXuQZdPjWVXTOqfoBU3n0L1Ftyg4w57yxi9nD105yQDvW2nu3-HNo9HGefxZ-Ig-HAi3YSsckwIsOEUwxSPatsxT0Niob30E63A:e:1634884682:2281283925530161:100033655335566:ARaBAxW-1L-ZRu6SMSg\",\"enableSample\":true,\"editTemplate\":false,\"allowTemplateCategoryChange\":true,\"addSecurityRecommendation\":false}",
        "createdOn": 1716276856702,
        "data": "Hi {{1}}\nThis is the footer",
        "elementName": "document_element",
        "id": "d618eaf1-355a-47de-a927-9e99ee13faec",
        "languageCode": "en",
        "languagePolicy": "deterministic",
        "meta": "{\"example\":\"Hi User\"}",
        "modifiedOn": 1716276856702,
        "namespace": "9c7fe92f_2a48_40ec_83d0_69c62a772433",
        "priority": 1,
        "quality": "UNKNOWN",
        "retry": 0,
        "stage": "NONE",
        "status": "PENDING",
        "templateType": "DOCUMENT",
        "vertical": "Ticket updated",
        "wabaId": "104505526065633"
    }
}
```

## Status Codes

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

      <th style={{ textAlign: "left" }}>
        Response
      </th>

      <th style={{ textAlign: "left" }}>
        Comments
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td style={{ textAlign: "left" }}>
        **Success**
      </td>

      <td style={{ textAlign: "left" }}>

      </td>

      <td style={{ textAlign: "left" }}>

      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        200
      </td>

      <td style={{ textAlign: "left" }}>
        \{\
            "status": "success",\
            "template": \{\
                "appId": "a41b30f4-d202-4fdb-911e-3a8fbfbfb797",\
                "category": "MARKETING",\
                "containerMeta": "\{\"appId\":\"a41b30f4-d202-4fdb-911e-3a8fbfbfb797\",\"data\":\"Hi \{\{1}}\",\"footer\":\"This is the footer\",\"sampleText\":\"Hi User\",\"sampleMedia\":\"4::aW1hZ2UvcadG5n:ARYaMMMA2QvIXuQZdPjWVXTOqfoBU3n0L1Ftyg4w57yxi9nD105yQDvW2nu3-HNo9HGefxZ-Ig-HAi3YSsckwIsOEUwxSPatsxT0Niob30E63A:e:1634884682:2281283925530161:100033655335566:ARaBAxW-1L-ZRu6SMSg\",\"enableSample\":true,\"editTemplate\":false,\"allowTemplateCategoryChange\":true,\"addSecurityRecommendation\":false}",\
                "createdOn": 1716276856702,\
                "data": "Hi \{\{1}}\\nThis is the footer",\
                "elementName": "document\_element",\
                "id": "d618eaf1-355a-47de-a927-9e99ee13faec",\
                "languageCode": "en",\
                "languagePolicy": "deterministic",\
                "meta": "\{\"example\":\"Hi User\"}",\
                "modifiedOn": 1716276856702,\
                "namespace": "9c7fe92f\_2a48\_40ec\_83d0\_69c62a772433",\
                "priority": 1,\
                "quality": "UNKNOWN",\
                "retry": 0,\
                "stage": "NONE",\
                "status": "PENDING",\
                "templateType": "DOCUMENT",\
                "vertical": "Ticket updated",\
                "wabaId": "104505526065633"\
            }\
        }
      </td>

      <td style={{ textAlign: "left" }}>

      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        **Error**
      </td>

      <td style={{ textAlign: "left" }}>

      </td>

      <td style={{ textAlign: "left" }}>

      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        429
      </td>

      <td style={{ textAlign: "left" }}>
        \{\
          "status": "error",\
          "message": "Too Many Requests"\
        }
      </td>

      <td style={{ textAlign: "left" }}>

      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        500
      </td>

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

      <td style={{ textAlign: "left" }}>

      </td>
    </tr>
  </tbody>
</Table>

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Create Document Type Template",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://partner.gupshup.io"
    }
  ],
  "paths": {
    "/partner/app/{appId}/templates": {
      "post": {
        "tags": [
          "default"
        ],
        "summary": "Create Document Type Template",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "elementName",
                  "category",
                  "templateType",
                  "content",
                  "example",
                  "vertical",
                  "exampleMedia"
                ],
                "properties": {
                  "elementName": {
                    "type": "string",
                    "description": "The name of a template. Element name is unique for a WABAs namespace.",
                    "example": "document_element"
                  },
                  "languageCode": {
                    "type": "string",
                    "description": "Language code for the template. Refer to all the language codes here.",
                    "example": "en"
                  },
                  "content": {
                    "type": "string",
                    "description": "The body of the template.",
                    "example": "Hi {{1}}"
                  },
                  "footer": {
                    "type": "string",
                    "description": "Footer of the template.",
                    "example": "This is the footer"
                  },
                  "category": {
                    "type": "string",
                    "description": "Category of the template",
                    "example": "MARKETING"
                  },
                  "templateType": {
                    "type": "string",
                    "description": "Type of the Template",
                    "example": "DOCUMENT"
                  },
                  "vertical": {
                    "type": "string",
                    "description": "Vertical (not more than 180 char.)",
                    "example": "Ticket updated"
                  },
                  "example": {
                    "type": "string",
                    "description": "Template example",
                    "example": "Hi User"
                  },
                  "exampleMedia": {
                    "type": "string",
                    "description": "Handle Id required to generate media templates",
                    "example": "4::aW1hZ2UvcadG5n:ARYaMMMA2QvIXuQZdPjWVXTOqfoBU3n0L1Ftyg4w57yxi9nD105yQDvW2nu3-HNo9HGefxZ-Ig-HAi3YSsckwIsOEUwxSPatsxT0Niob30E63A:e:1634884682:2281283925530161:100033655335566:ARaBAxW-1L-ZRu6SMSg"
                  },
                  "enableSample": {
                    "type": "boolean",
                    "description": "Boolean value",
                    "example": "true"
                  },
                  "allowTemplateCategoryChange": {
                    "type": "boolean",
                    "description": "Boolean value. If True, Meta will automatically update the category of the template as per the template content. Default value is 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": {
                    "status": {
                      "type": "string",
                      "example": "success"
                    },
                    "template": {
                      "type": "object",
                      "properties": {
                        "appId": {
                          "type": "string",
                          "example": "a41b30f4-d202-4fdb-911e-3a8fbfbfb797"
                        },
                        "category": {
                          "type": "string",
                          "example": "MARKETING"
                        },
                        "containerMeta": {
                          "type": "string",
                          "example": {
                            "appId": "a41b30f4-d202-4fdb-911e-3a8fbfbfb797",
                            "data": "Hi {{1}}",
                            "footer": "This is the footer",
                            "sampleText": "Hi User",
                            "sampleMedia": "4::aW1hZ2UvcadG5n:ARYaMMMA2QvIXuQZdPjWVXTOqfoBU3n0L1Ftyg4w57yxi9nD105yQDvW2nu3-HNo9HGefxZ-Ig-HAi3YSsckwIsOEUwxSPatsxT0Niob30E63A:e:1634884682:2281283925530161:100033655335566:ARaBAxW-1L-ZRu6SMSg",
                            "enableSample": true,
                            "editTemplate": false,
                            "allowTemplateCategoryChange": true,
                            "addSecurityRecommendation": false
                          }
                        },
                        "createdOn": {
                          "type": "integer",
                          "format": "int64",
                          "example": "1716276856702"
                        },
                        "data": {
                          "type": "string",
                          "example": "Hi {{1}} This is the footer"
                        },
                        "elementName": {
                          "type": "string",
                          "example": "document_element"
                        },
                        "id": {
                          "type": "string",
                          "example": "d618eaf1-355a-47de-a927-9e99ee13faec"
                        },
                        "languageCode": {
                          "type": "string",
                          "example": "en"
                        },
                        "languagePolicy": {
                          "type": "string",
                          "example": "deterministic"
                        },
                        "meta": {
                          "type": "string",
                          "example": {
                            "example": "Hi User"
                          }
                        },
                        "modifiedOn": {
                          "type": "integer",
                          "format": "int64",
                          "example": "1716276856702"
                        },
                        "namespace": {
                          "type": "string",
                          "example": "9c7fe92f_2a48_40ec_83d0_69c62a772433"
                        },
                        "priority": {
                          "type": "integer",
                          "format": "int32",
                          "example": "1"
                        },
                        "quality": {
                          "type": "string",
                          "example": "UNKNOWN"
                        },
                        "retry": {
                          "type": "integer",
                          "format": "int32",
                          "example": "0"
                        },
                        "stage": {
                          "type": "string",
                          "example": "NONE"
                        },
                        "status": {
                          "type": "string",
                          "example": "PENDING"
                        },
                        "templateType": {
                          "type": "string",
                          "example": "DOCUMENT"
                        },
                        "vertical": {
                          "type": "string",
                          "example": "Ticket updated"
                        },
                        "wabaId": {
                          "type": "string",
                          "example": "104505526065633"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Too Many Requests"
                    },
                    "status": {
                      "type": "string",
                      "example": "error"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Internal server error"
                    },
                    "status": {
                      "type": "string",
                      "example": "error"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```