---
updatedAt: 2025-11-20T08:45:13.000Z
agentTools:
  projectIndex: https://partner-docs.gupshup.io/llms.txt
---

# Create Templates from the Template Library

API to create template from pre approved Meta Library Template. Use this API to quickly deploy industry-specific, pre-approved templates with customization options, significantly reducing template approval time.

## Request Parameters

| Key                 | Description                                              | Constraints                                                                                                                                                                                                             |
| :------------------ | :------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| PARTNER\_APP\_TOKEN | App Access Token issued post partner login               | Should be a valid partner app access token belonging to the passed appId                                                                                                                                                |
| elementName         | Name of element                                          | Meta library template name - Optional                                                                                                                                                                                   |
| category            | Category name                                            | Currently only UTILITY is supported                                                                                                                                                                                     |
| languageCode        | Language code of the meta library template               | [Supported Languages - WhatsApp Business Management API - Documentation - Meta for Developers](https://developers.facebook.com/docs/whatsapp/business-management-api/message-templates/supported-languages)  - Optional |
| libraryTemplateName | Name of meta library template used as base template      | Element name of meta library template                                                                                                                                                                                   |
| buttons             | Buttons list for new template                            | Buttons list of meta library template                                                                                                                                                                                   |
| appId               | App Id for the app that is linked to the Partner Account |                                                                                                                                                                                                                         |

## Sample Request

```curl
curl --location --request POST 'https://partner.gupshup.io/partner/app/:appId/template/metalibrary' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'elementName={{NEW_ELEMENT_NAME}}' \
--data-urlencode 'category=UTILITY' \
--data-urlencode 'languageCode={{LANGUAGE_CODE_OF_LIBRARY_TEMPLATE}}' \
--data-urlencode 'libraryTemplateName={{NAME_OF_LIBRARY_TEMPLATE}}' \
--data-urlencode 'buttons={{BUTTONS_IN_SAME_FORMAT_LIKE_LIBRARY_TEMPLATE}}}'
```

## Sample Response

```json
{
    "status": "success",
    "templates": {
        "buttonSupported": "URL",
        "category": "UTILITY",
        "containerMeta": "{\"data\":\"Hei, {{1}}\\n\\nDen nye kontoen din er opprettet.\\n\\nBekreft {{2}} for å fullføre profilen.\",\"buttons\":[{\"type\":\"URL\",\"text\":\"Bekreft konto\",\"url\":\"https://www.example.com/\"}],\"header\":\"Fullfør konfigurering av konto\",\"sampleText\":\"Hei, John\\n\\nDen nye kontoen din er opprettet.\\n\\nBekreft e-postadressen din for å fullføre profilen.\",\"sampleHeader\":\"Fullfør konfigurering av konto\",\"enableSample\":true,\"editTemplate\":false,\"allowTemplateCategoryChange\":false,\"addSecurityRecommendation\":false}",
        "createdOn": 1721897898300,
        "data": "Fullfør konfigurering av konto\nHei, {{1}}\n\nDen nye kontoen din er opprettet.\n\nBekreft {{2}} for å fullføre profilen. | [Bekreft konto,https://www.example.com/]",
        "elementName": "jul23libtest1_8",
        "externalId": "399568216474711",
        "id": "0cc281c9-dc45-4ea3-bf50-411e9b8ff9b3",
        "languageCode": "nb",
        "languagePolicy": "deterministic",
        "meta": "{\"example\":\"Hei, John\\n\\nDen nye kontoen din er opprettet.\\n\\nBekreft e-postadressen din for å fullføre profilen.\"}",
        "modifiedOn": 1721897898300,
        "namespace": "18cfa544_9c62_4dcd_b8f3_b3785d8c917c",
        "quality": "UNKNOWN",
        "status": "APPROVED",
        "templateType": "TEXT",
        "wabaId": "216141188246170"
    }
}
```

## Status Codes

| Status Code | Response                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | Comments                                                    |
| :---------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :---------------------------------------------------------- |
| **Success** |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |                                                             |
| 200         | `{       "status": "success",       "templates": {           "buttonSupported": "URL",           "category": "UTILITY",           "containerMeta": "{\"data\":\"Hei, {{1}}\\n\\nDen nye kontoen din er opprettet.\\n\\nBekreft {{2}} for å fullføre profilen.\",\"buttons\":[{\"type\":\"URL\",\"text\":\"Bekreft konto\",\"url\":\"https://www.example.com/\"}],\"header\":\"Fullfør konfigurering av konto\",\"sampleText\":\"Hei, John\\n\\nDen nye kontoen din er opprettet.\\n\\nBekreft e-postadressen din for å fullføre profilen.\",\"sampleHeader\":\"Fullfør konfigurering av konto\",\"enableSample\":true,\"editTemplate\":false,\"allowTemplateCategoryChange\":false,\"addSecurityRecommendation\":false}",           "createdOn": 1721897898300,           "data": "Fullfør konfigurering av konto\\nHei, {{1}}\\n\\nDen nye kontoen din er opprettet.\\n\\nBekreft {{2}} for å fullføre profilen. \| [Bekreft konto,https://www.example.com/]",           "elementName": "jul23libtest1_8",           "externalId": "399568216474711",           "id": "0cc281c9-dc45-4ea3-bf50-411e9b8ff9b3",           "languageCode": "nb",           "languagePolicy": "deterministic",           "meta": "{\"example\":\"Hei, John\\n\\nDen nye kontoen din er opprettet.\\n\\nBekreft e-postadressen din for å fullføre profilen.\"}",           "modifiedOn": 1721897898300,           "namespace": "18cfa544_9c62_4dcd_b8f3_b3785d8c917c",           "quality": "UNKNOWN",           "status": "APPROVED",           "templateType": "TEXT",           "wabaId": "216141188246170"       }   }` | Response on creation of template from meta library template |
| **Error**   |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |                                                             |
| 400         | `{       "status": "error",       "message": "Template Name is missing"   }`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | If elementName is not provided                              |
| 400         | `{       "status": "error",       "message": "Category is missing"   }`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | If category is not provided                                 |
| 400         | `{       "status": "error",       "message": "Language is missing"   }`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | If languageCode is not provided                             |
| 400         | `{       "status": "error",       "message": "Library Template Name is missing"   }`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | If libraryTemplateName is not provided                      |
| 400         | `{       "status": "error",       "message": "(#100) The parameter library_template_button_inputs[0]['type'] is required. - null, null"   }`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | If button type is not provided                              |
| 400         | `{       "status": "error",       "message": "Template Already exists with same namespace and elementName and languageCode"   }`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | If name of template already exists                          |
| 401         | `{       "message": "Authentication Failed",       "status": "error"   }`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |                                                             |
| 429         | `{     "status": "error",     "message": "Too Many Requests"   }`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | 10 Requests per Minute                                      |
| 500         | `{     "status": "error",     "message": "Internal Server Error"   }`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | For any Internal Error                                      |

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "Partner Portal API",
    "description": "Partner Portal API documentation",
    "license": {
      "name": "Apache 2.0",
      "url": "https://www.gupshup.io"
    },
    "version": "3.0.0-SNAPSHOT"
  },
  "externalDocs": {
    "description": "Gupshup Wiki Documentation",
    "url": "https://www.gupshup.io/partner/docs"
  },
  "servers": [
    {
      "url": "https://partner.gupshup.io/partner",
      "description": "Generated server url"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Partner's Linked Application",
      "description": "API's for partners linked applications"
    }
  ],
  "paths": {
    "/app/{appId}/template/metalibrary": {
      "post": {
        "tags": [
          "Partner's Linked Application"
        ],
        "summary": "Create template from template library",
        "operationId": "createTemplateFromLibrary_3",
        "parameters": [
          {
            "name": "appId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "requestParams",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/MultiValueMapStringString"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateTemplateLibrary"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - no permissions to access resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "ErrorResponse": {
        "required": [
          "entity",
          "status"
        ],
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "description": "Status Code",
            "format": "int32"
          },
          "message": {
            "type": "string",
            "description": "Error message describing the reason "
          },
          "details": {
            "type": "string",
            "description": "Developer specific error details "
          },
          "code": {
            "type": "string",
            "description": "Internal Error Code",
            "default": "PP-ERR-XXX"
          },
          "entity": {
            "type": "object",
            "description": "Response Object"
          }
        },
        "description": "Error"
      },
      "MultiValueMapStringString": {
        "type": "object",
        "properties": {
          "all": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "writeOnly": true
          },
          "empty": {
            "type": "boolean"
          }
        },
        "additionalProperties": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "CreateTemplateLibrary": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "templates": {
            "$ref": "#/components/schemas/Templates"
          }
        }
      },
      "Templates": {
        "type": "object",
        "properties": {
          "buttonSupported": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "containerMeta": {
            "type": "string"
          },
          "createdOn": {
            "type": "integer",
            "format": "int64"
          },
          "data": {
            "type": "string"
          },
          "elementName": {
            "type": "string"
          },
          "externalId": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "languageCode": {
            "type": "string"
          },
          "languagePolicy": {
            "type": "string"
          },
          "meta": {
            "type": "string"
          },
          "modifiedOn": {
            "type": "integer",
            "format": "int64"
          },
          "namespace": {
            "type": "string"
          },
          "quality": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "templateType": {
            "type": "string"
          },
          "wabaId": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```