# Templates

Endpoints for managing WhatsApp message templates

## Get Message Template Library

> Retrieve message templates from the template library for a WABA.

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.41.0"},"tags":[{"name":"Templates","description":"Endpoints for managing WhatsApp message templates"}],"servers":[{"description":"Production server","url":"https://waba-v2.360dialog.io"}],"security":[{"D360-API-KEY":[]}],"components":{"securitySchemes":{"D360-API-KEY":{"description":"API Key for Messaging API authentication. Send your API key in the D360-API-KEY header.","in":"header","name":"D360-API-KEY","type":"apiKey"}},"schemas":{"message_templates_library.GetMessageTemplateLibraryResponse":{"description":"Response payload containing a list of templates from the library","properties":{"data":{"items":{"$ref":"#/components/schemas/message_templates_library.MessageTemplateLibraryItem"},"type":"array","uniqueItems":false},"paging":{"$ref":"#/components/schemas/message_templates_library.PagingInfo"}},"type":"object"},"message_templates_library.MessageTemplateLibraryItem":{"properties":{"body":{"type":"string"},"body_param_types":{"items":{"type":"string"},"type":"array","uniqueItems":false},"body_params":{"items":{"type":"string"},"type":"array","uniqueItems":false},"buttons":{"items":{"$ref":"#/components/schemas/message_templates_library.TemplateLibraryButton"},"type":"array","uniqueItems":false},"category":{"type":"string"},"header":{"type":"string"},"industry":{"items":{"type":"string"},"type":"array","uniqueItems":false},"language":{"type":"string"},"name":{"type":"string"},"topic":{"type":"string"},"usecase":{"type":"string"}},"type":"object"},"message_templates_library.TemplateLibraryButton":{"properties":{"phone_number":{"type":"string"},"text":{"type":"string"},"type":{"type":"string"},"url":{"$ref":"#/components/schemas/message_templates_library.TemplateLibraryButtonURL"}},"type":"object"},"message_templates_library.TemplateLibraryButtonURL":{"properties":{"base_url":{"type":"string"},"url_suffix_example":{"type":"string"}},"type":"object"},"message_templates_library.PagingInfo":{"properties":{"cursors":{"$ref":"#/components/schemas/message_templates_library.PagingCursors"},"next":{"type":"string"}},"type":"object"},"message_templates_library.PagingCursors":{"properties":{"after":{"type":"string"},"before":{"type":"string"}},"type":"object"},"utils.ErrorResp":{"properties":{"error":{"type":"string"}},"type":"object"}}},"paths":{"/message_template_library":{"get":{"description":"Retrieve message templates from the template library for a WABA.","operationId":"get-message-template-library","responses":{"200":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/message_templates_library.GetMessageTemplateLibraryResponse"},"type":"array"}}},"description":"Template library retrieved successfully"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Unauthorized"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Internal server error"}},"summary":"Get Message Template Library","tags":["Templates"]}}}}
```

## Create WhatsApp Message Template (Library Import Optional)

> Create a new WhatsApp message template for a WABA account. Templates can be created from scratch or imported from the Meta Template Library. See Meta docs: <https://developers.facebook.com/documentation/business-messaging/whatsapp/templates/template-library>

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.41.0"},"tags":[{"name":"Templates","description":"Endpoints for managing WhatsApp message templates"}],"servers":[{"description":"Production server","url":"https://waba-v2.360dialog.io"}],"security":[{"D360-API-KEY":[]}],"components":{"securitySchemes":{"D360-API-KEY":{"description":"API Key for Messaging API authentication. Send your API key in the D360-API-KEY header.","in":"header","name":"D360-API-KEY","type":"apiKey"}},"schemas":{"message_templates_library.MessageTemplateCreateRequestSchema":{"properties":{"category":{"type":"string"},"language":{"type":"string"},"library_template_button_inputs":{"items":{"$ref":"#/components/schemas/message_templates_library.LibraryTemplateButtonInput"},"type":"array","uniqueItems":false},"library_template_name":{"type":"string"},"name":{"type":"string"}},"type":"object"},"message_templates_library.LibraryTemplateButtonInput":{"properties":{"phone_number":{"type":"string"},"type":{"type":"string"},"url":{"properties":{"base_url":{"type":"string"},"url_suffix_example":{"type":"string"}},"type":"object"}},"type":"object"},"message_templates_library.MessageTemplateCreateResponseSchema":{"properties":{"category":{"type":"string"},"id":{"type":"string"},"status":{"type":"string"}},"type":"object"},"utils.ErrorResp":{"properties":{"error":{"type":"string"}},"type":"object"}}},"paths":{"/message_templates":{"post":{"description":"Create a new WhatsApp message template for a WABA account. Templates can be created from scratch or imported from the Meta Template Library. See Meta docs: https://developers.facebook.com/documentation/business-messaging/whatsapp/templates/template-library","operationId":"post-message-template","requestBody":{"content":{"application/json":{"schema":{"oneOf":[{"type":"object"},{"$ref":"#/components/schemas/message_templates_library.MessageTemplateCreateRequestSchema","summary":"requestBody","description":"Message template payload"}]}}},"description":"Message template payload","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/message_templates_library.MessageTemplateCreateResponseSchema"}}},"description":"Template created / submitted successfully"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Unauthorized"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Internal server error"}},"summary":"Create WhatsApp Message Template (Library Import Optional)","tags":["Templates"]}}}}
```

## Get Templates

> Retrieve message templates

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.41.0"},"tags":[{"name":"Templates","description":"Endpoints for managing WhatsApp message templates"}],"servers":[{"description":"Production server","url":"https://waba-v2.360dialog.io"}],"security":[{"D360-API-KEY":[]}],"components":{"securitySchemes":{"D360-API-KEY":{"description":"API Key for Messaging API authentication. Send your API key in the D360-API-KEY header.","in":"header","name":"D360-API-KEY","type":"apiKey"}},"schemas":{"utils.ErrorResp":{"properties":{"error":{"type":"string"}},"type":"object"}}},"paths":{"/v1/configs/templates":{"get":{"description":"Retrieve message templates","operationId":"get-templates","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"Templates retrieved successfully"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Unauthorized"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Internal server error"}},"summary":"Get Templates","tags":["Templates"]}}}}
```

## Create Template

> Create a new message template. More information about the template creation payload can be found in the 360 Dialog documentation: <https://docs.360dialog.com/docs/waba-messaging/template-messaging>.

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.41.0"},"tags":[{"name":"Templates","description":"Endpoints for managing WhatsApp message templates"}],"servers":[{"description":"Production server","url":"https://waba-v2.360dialog.io"}],"security":[{"D360-API-KEY":[]}],"components":{"securitySchemes":{"D360-API-KEY":{"description":"API Key for Messaging API authentication. Send your API key in the D360-API-KEY header.","in":"header","name":"D360-API-KEY","type":"apiKey"}},"schemas":{"utils.ErrorResp":{"properties":{"error":{"type":"string"}},"type":"object"}}},"paths":{"/v1/configs/templates":{"post":{"description":"Create a new message template. More information about the template creation payload can be found in the 360 Dialog documentation: https://docs.360dialog.com/docs/waba-messaging/template-messaging.","operationId":"create-template","requestBody":{"content":{"application/json":{"schema":{"type":"object"}},"text/plain":{"schema":{"title":"requestBody","type":"object"}}},"description":"Template creation payload","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"Template created successfully"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Unauthorized"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Internal server error"}},"summary":"Create Template","tags":["Templates"]}}}}
```

## Delete Template

> Delete a message template by template name. More information about template deletion can be found in the 360 Dialog documentation: <https://docs.360dialog.com/docs/waba-messaging/template-messaging#delete-a-template>.

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.41.0"},"tags":[{"name":"Templates","description":"Endpoints for managing WhatsApp message templates"}],"servers":[{"description":"Production server","url":"https://waba-v2.360dialog.io"}],"security":[{"D360-API-KEY":[]}],"components":{"securitySchemes":{"D360-API-KEY":{"description":"API Key for Messaging API authentication. Send your API key in the D360-API-KEY header.","in":"header","name":"D360-API-KEY","type":"apiKey"}},"schemas":{"utils.ErrorResp":{"properties":{"error":{"type":"string"}},"type":"object"}}},"paths":{"/v1/configs/templates/{template_name}":{"delete":{"description":"Delete a message template by template name. More information about template deletion can be found in the 360 Dialog documentation: https://docs.360dialog.com/docs/waba-messaging/template-messaging#delete-a-template.","operationId":"delete-template","parameters":[{"description":"Template name","in":"path","name":"template_name","required":true,"schema":{"type":"string"}},{"description":"Template id on Meta. If specified, name is ignored. Example: 1423298775400","in":"query","name":"external_id","schema":{"type":"string"}},{"description":"Template id on HUB. If specified, name and external_id are ignored. Example: exampleWT","in":"query","name":"id","schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"Template deleted successfully"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Bad request - empty template name"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Template not found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Internal server error"}},"summary":"Delete Template","tags":["Templates"]}}}}
```

## Update WhatsApp Message Template

> Update an existing WhatsApp message template

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.41.0"},"tags":[{"name":"Templates","description":"Endpoints for managing WhatsApp message templates"}],"servers":[{"description":"Production server","url":"https://waba-v2.360dialog.io"}],"security":[{"D360-API-KEY":[]}],"components":{"securitySchemes":{"D360-API-KEY":{"description":"API Key for Messaging API authentication. Send your API key in the D360-API-KEY header.","in":"header","name":"D360-API-KEY","type":"apiKey"}},"schemas":{"utils.ErrorResp":{"properties":{"error":{"type":"string"}},"type":"object"}}},"paths":{"/v1/configs/templates/{whats_app_message_template_id}":{"post":{"description":"Update an existing WhatsApp message template","operationId":"update-template","parameters":[{"description":"WhatsApp Message Template ID","in":"path","name":"whats_app_message_template_id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}},"text/plain":{"schema":{"title":"requestBody","type":"object"}}},"description":"Template update payload","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}},"description":"Template updated successfully"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Template not found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Internal server error"}},"summary":"Update WhatsApp Message Template","tags":["Templates"]}}}}
```

## Compare Template

> Compare template information by template ID using Meta API. Returns template details and comparison results.

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.41.0"},"tags":[{"name":"Templates","description":"Endpoints for managing WhatsApp message templates"}],"servers":[{"description":"Production server","url":"https://waba-v2.360dialog.io"}],"security":[{"D360-API-KEY":[]}],"components":{"securitySchemes":{"D360-API-KEY":{"description":"API Key for Messaging API authentication. Send your API key in the D360-API-KEY header.","in":"header","name":"D360-API-KEY","type":"apiKey"}},"schemas":{"compare_templates.CompareTemplateResponse":{"description":"Response payload containing template comparison results","properties":{"category":{"type":"string"},"compare":{"$ref":"#/components/schemas/compare_templates.TemplateComparison"},"id":{"type":"string"},"language":{"type":"string"},"name":{"type":"string"},"status":{"type":"string"}},"type":"object"},"compare_templates.TemplateComparison":{"properties":{"has_differences":{"type":"boolean"},"summary":{"type":"string"}},"type":"object"},"utils.ErrorResp":{"properties":{"error":{"type":"string"}},"type":"object"}}},"paths":{"/{template_id}/compare":{"get":{"description":"Compare template information by template ID using Meta API. Returns template details and comparison results.","operationId":"compare-template","parameters":[{"description":"Template ID","in":"path","name":"template_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/compare_templates.CompareTemplateResponse"}}},"description":"Template comparison completed successfully"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Unauthorized"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Internal server error"}},"summary":"Compare Template","tags":["Templates"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.360dialog.com/docs/messaging-api/api-reference/templates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
