> For the complete documentation index, see [llms.txt](https://docs.360dialog.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.360dialog.com/docs/messaging-api/api-reference/templates.md).

# 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.46.8"},"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"]}}}}
```

## List Message Templates

> Retrieve message templates. Returns paginated results with template details including status, category, components, and quality scores.

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.46.8"},"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.MessageTemplatesResponse":{"properties":{"data":{"items":{"$ref":"#/components/schemas/message_templates.MessageTemplate"},"type":"array","uniqueItems":false},"paging":{"$ref":"#/components/schemas/message_templates.MessageTemplatePaging"}},"type":"object"},"message_templates.MessageTemplate":{"properties":{"ad_account_id":{"type":"string"},"ad_adset_id":{"type":"string"},"ad_campaign_id":{"type":"string"},"ad_id":{"type":"string"},"bid_spec":{"$ref":"#/components/schemas/message_templates.TemplateBidSpec"},"category":{"type":"string"},"components":{"items":{"$ref":"#/components/schemas/message_templates.TemplateComponent"},"type":"array","uniqueItems":false},"correct_category":{"type":"string"},"cta_url_link_tracking_opted_out":{"type":"boolean"},"degrees_of_freedom_spec":{"additionalProperties":{},"type":"object"},"display_format":{"type":"string"},"health_status":{"$ref":"#/components/schemas/message_templates.MessageTemplateHealthStatus"},"id":{"type":"string"},"is_primary_device_delivery_only":{"type":"boolean"},"is_sms_fallback_enabled":{"type":"boolean"},"language":{"type":"string"},"last_updated_time":{"type":"integer"},"library_template_name":{"type":"string"},"message_send_ttl_seconds":{"type":"integer"},"name":{"type":"string"},"parameter_format":{"type":"string"},"previous_category":{"type":"string"},"quality_score":{"$ref":"#/components/schemas/message_templates.MessageTemplateQualityScore"},"rejected_reason":{"type":"string"},"source":{"type":"string"},"status":{"type":"string"},"sub_category":{"type":"string"}},"type":"object"},"message_templates.TemplateBidSpec":{"properties":{"bid_amount":{"type":"integer"},"bid_strategy":{"type":"string"}},"type":"object"},"message_templates.TemplateComponent":{"properties":{"add_security_recommendation":{"type":"boolean"},"buttons":{"items":{"$ref":"#/components/schemas/message_templates.TemplateComponentButton"},"type":"array","uniqueItems":false},"code_expiration_minutes":{"type":"integer"},"format":{"type":"string"},"text":{"type":"string"},"type":{"type":"string"}},"type":"object"},"message_templates.TemplateComponentButton":{"properties":{"autofill_text":{"type":"string"},"flow_action":{"type":"string"},"flow_id":{"type":"string"},"flow_json":{"type":"string"},"flow_name":{"type":"string"},"navigate_screen":{"type":"string"},"otp_type":{"type":"string"},"package_name":{"type":"string"},"phone_number":{"type":"string"},"signature_hash":{"type":"string"},"text":{"type":"string"},"type":{"type":"string"},"url":{"type":"string"}},"type":"object"},"message_templates.MessageTemplateHealthStatus":{"properties":{"can_send_message":{"type":"string"}},"type":"object"},"message_templates.MessageTemplateQualityScore":{"properties":{"date":{"type":"integer"},"reason":{"type":"string"},"reasons":{"items":{"type":"string"},"type":"array","uniqueItems":false},"score":{"type":"string"}},"type":"object"},"message_templates.MessageTemplatePaging":{"properties":{"cursors":{"$ref":"#/components/schemas/message_templates.MessageTemplatePagingCursors"},"next":{"type":"string"},"previous":{"type":"string"}},"type":"object"},"message_templates.MessageTemplatePagingCursors":{"properties":{"after":{"type":"string"},"before":{"type":"string"}},"type":"object"},"utils.ErrorResp":{"properties":{"error":{"type":"string"}},"type":"object"}}},"paths":{"/message_templates":{"get":{"description":"Retrieve message templates. Returns paginated results with template details including status, category, components, and quality scores.","operationId":"get-message-templates","parameters":[{"description":"Comma-separated list of fields to include (e.g. id,name,status,components)","in":"query","name":"fields","schema":{"type":"string"}},{"description":"Maximum number of templates to return per page","in":"query","name":"limit","schema":{"type":"integer"}},{"description":"Cursor for the next page of results","in":"query","name":"after","schema":{"type":"string"}},{"description":"Cursor for the previous page of results","in":"query","name":"before","schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/message_templates.MessageTemplatesResponse"}}},"description":"Templates retrieved 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"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Not found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Internal server error"}},"summary":"List Message Templates","tags":["Templates"]}}}}
```

## Create Message Template

> Create a new message template. Templates must be approved before they can be used to send messages. Supports cloning from the Meta Template Library.

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.46.8"},"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.MessageTemplateCreateRequestSchema":{"properties":{"allow_category_change":{"type":"boolean"},"category":{"type":"string"},"components":{"items":{"$ref":"#/components/schemas/message_templates.TemplateComponent"},"type":"array","uniqueItems":false},"cta_url_link_tracking_opted_out":{"type":"boolean"},"display_format":{"type":"string"},"is_primary_device_delivery_only":{"type":"boolean"},"language":{"type":"string"},"library_template_body_inputs":{"additionalProperties":{},"type":"object"},"library_template_button_inputs":{"items":{"additionalProperties":{},"type":"object"},"type":"array","uniqueItems":false},"library_template_name":{"type":"string"},"message_send_ttl_seconds":{"type":"integer"},"name":{"type":"string"},"parameter_format":{"type":"string"},"send_type":{"type":"string"},"sub_category":{"type":"string"}},"type":"object"},"message_templates.TemplateComponent":{"properties":{"add_security_recommendation":{"type":"boolean"},"buttons":{"items":{"$ref":"#/components/schemas/message_templates.TemplateComponentButton"},"type":"array","uniqueItems":false},"code_expiration_minutes":{"type":"integer"},"format":{"type":"string"},"text":{"type":"string"},"type":{"type":"string"}},"type":"object"},"message_templates.TemplateComponentButton":{"properties":{"autofill_text":{"type":"string"},"flow_action":{"type":"string"},"flow_id":{"type":"string"},"flow_json":{"type":"string"},"flow_name":{"type":"string"},"navigate_screen":{"type":"string"},"otp_type":{"type":"string"},"package_name":{"type":"string"},"phone_number":{"type":"string"},"signature_hash":{"type":"string"},"text":{"type":"string"},"type":{"type":"string"},"url":{"type":"string"}},"type":"object"},"message_templates.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 message template. Templates must be approved before they can be used to send messages. Supports cloning from the Meta Template Library.","operationId":"post-message-template","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/message_templates.MessageTemplateCreateRequestSchema","summary":"requestBody","description":"Message template payload"}}},"description":"Message template payload","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/message_templates.MessageTemplateCreateResponseSchema"}}},"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"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Forbidden"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Internal server error"}},"summary":"Create Message Template","tags":["Templates"]}}}}
```

## Delete Message Templates

> Delete message templates. Can delete by name (all languages), by specific template ID, or by multiple template IDs.

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.46.8"},"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.SuccessResponse":{"properties":{"success":{"type":"boolean"}},"type":"object"},"utils.ErrorResp":{"properties":{"error":{"type":"string"}},"type":"object"}}},"paths":{"/message_templates":{"delete":{"description":"Delete message templates. Can delete by name (all languages), by specific template ID, or by multiple template IDs.","operationId":"delete-message-templates","parameters":[{"description":"Template name to delete (deletes all languages if hsm_id not specified)","in":"query","name":"name","schema":{"type":"string"}},{"description":"Specific template ID to delete (used with name for single-language deletion)","in":"query","name":"hsm_id","schema":{"type":"string"}},{"description":"JSON array of template IDs to delete (max 100)","in":"query","name":"hsm_ids","schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/message_templates.SuccessResponse"}}},"description":"Templates deleted 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":"Delete Message Templates","tags":["Templates"]}}}}
```

## Archive Message Templates

> Archive one or more message templates for a WABA. Only approved or rejected templates can be archived. Archived templates are scheduled for deletion after 28 days.

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.46.8"},"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_archival.ArchiveMessageTemplatesRequest":{"properties":{"hsm_ids":{"items":{"type":"string"},"type":"array","uniqueItems":false}},"type":"object"},"message_templates_archival.ArchiveMessageTemplatesResponse":{"properties":{"archived_templates":{"items":{"type":"string"},"type":"array","uniqueItems":false},"failed_templates":{"additionalProperties":{"type":"string"},"type":"object"}},"type":"object"},"utils.ErrorResp":{"properties":{"error":{"type":"string"}},"type":"object"}}},"paths":{"/message_templates/archive":{"post":{"description":"Archive one or more message templates for a WABA. Only approved or rejected templates can be archived. Archived templates are scheduled for deletion after 28 days.","operationId":"post-archive-message-templates","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/message_templates_archival.ArchiveMessageTemplatesRequest","summary":"requestBody","description":"Template IDs to archive (up to 100)"}}},"description":"Template IDs to archive (up to 100)","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/message_templates_archival.ArchiveMessageTemplatesResponse"}}},"description":"Archive operation result"},"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":"Archive Message Templates","tags":["Templates"]}}}}
```

## Unarchive Message Templates

> Unarchive one or more archived message templates for a WABA within the 28-day window. Restores templates to their previous status (defaults to APPROVED if no previous status is available). Resets the inactivity clock.

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.46.8"},"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_archival.UnarchiveMessageTemplatesRequest":{"properties":{"hsm_ids":{"items":{"type":"string"},"type":"array","uniqueItems":false}},"type":"object"},"message_templates_archival.UnarchiveMessageTemplatesResponse":{"properties":{"failed_templates":{"additionalProperties":{"type":"string"},"type":"object"},"unarchived_templates":{"items":{"type":"string"},"type":"array","uniqueItems":false}},"type":"object"},"utils.ErrorResp":{"properties":{"error":{"type":"string"}},"type":"object"}}},"paths":{"/message_templates/unarchive":{"post":{"description":"Unarchive one or more archived message templates for a WABA within the 28-day window. Restores templates to their previous status (defaults to APPROVED if no previous status is available). Resets the inactivity clock.","operationId":"post-unarchive-message-templates","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/message_templates_archival.UnarchiveMessageTemplatesRequest","summary":"requestBody","description":"Template IDs to unarchive (up to 100)"}}},"description":"Template IDs to unarchive (up to 100)","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/message_templates_archival.UnarchiveMessageTemplatesResponse"}}},"description":"Unarchive operation result"},"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":"Unarchive Message Templates","tags":["Templates"]}}}}
```

## Get Message Template by ID

> Retrieve a specific message template by its ID with all available fields.

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.46.8"},"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.MessageTemplate":{"properties":{"ad_account_id":{"type":"string"},"ad_adset_id":{"type":"string"},"ad_campaign_id":{"type":"string"},"ad_id":{"type":"string"},"bid_spec":{"$ref":"#/components/schemas/message_templates.TemplateBidSpec"},"category":{"type":"string"},"components":{"items":{"$ref":"#/components/schemas/message_templates.TemplateComponent"},"type":"array","uniqueItems":false},"correct_category":{"type":"string"},"cta_url_link_tracking_opted_out":{"type":"boolean"},"degrees_of_freedom_spec":{"additionalProperties":{},"type":"object"},"display_format":{"type":"string"},"health_status":{"$ref":"#/components/schemas/message_templates.MessageTemplateHealthStatus"},"id":{"type":"string"},"is_primary_device_delivery_only":{"type":"boolean"},"is_sms_fallback_enabled":{"type":"boolean"},"language":{"type":"string"},"last_updated_time":{"type":"integer"},"library_template_name":{"type":"string"},"message_send_ttl_seconds":{"type":"integer"},"name":{"type":"string"},"parameter_format":{"type":"string"},"previous_category":{"type":"string"},"quality_score":{"$ref":"#/components/schemas/message_templates.MessageTemplateQualityScore"},"rejected_reason":{"type":"string"},"source":{"type":"string"},"status":{"type":"string"},"sub_category":{"type":"string"}},"type":"object"},"message_templates.TemplateBidSpec":{"properties":{"bid_amount":{"type":"integer"},"bid_strategy":{"type":"string"}},"type":"object"},"message_templates.TemplateComponent":{"properties":{"add_security_recommendation":{"type":"boolean"},"buttons":{"items":{"$ref":"#/components/schemas/message_templates.TemplateComponentButton"},"type":"array","uniqueItems":false},"code_expiration_minutes":{"type":"integer"},"format":{"type":"string"},"text":{"type":"string"},"type":{"type":"string"}},"type":"object"},"message_templates.TemplateComponentButton":{"properties":{"autofill_text":{"type":"string"},"flow_action":{"type":"string"},"flow_id":{"type":"string"},"flow_json":{"type":"string"},"flow_name":{"type":"string"},"navigate_screen":{"type":"string"},"otp_type":{"type":"string"},"package_name":{"type":"string"},"phone_number":{"type":"string"},"signature_hash":{"type":"string"},"text":{"type":"string"},"type":{"type":"string"},"url":{"type":"string"}},"type":"object"},"message_templates.MessageTemplateHealthStatus":{"properties":{"can_send_message":{"type":"string"}},"type":"object"},"message_templates.MessageTemplateQualityScore":{"properties":{"date":{"type":"integer"},"reason":{"type":"string"},"reasons":{"items":{"type":"string"},"type":"array","uniqueItems":false},"score":{"type":"string"}},"type":"object"},"utils.ErrorResp":{"properties":{"error":{"type":"string"}},"type":"object"}}},"paths":{"/message_templates/{template_id}":{"get":{"description":"Retrieve a specific message template by its ID with all available fields.","operationId":"get-message-template-by-id","parameters":[{"description":"Message template ID","in":"path","name":"template_id","required":true,"schema":{"type":"string"}},{"description":"Comma-separated list of fields to include (e.g. id,name,status,components)","in":"query","name":"fields","schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/message_templates.MessageTemplate"}}},"description":"Template retrieved 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":"Not found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Internal server error"}},"summary":"Get Message Template by ID","tags":["Templates"]}}}}
```

## Edit Message Template

> Update an existing message template. Only approved or rejected templates can be edited.

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.46.8"},"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.UpdateMessageTemplateRequestSchema":{"properties":{"allow_category_change":{"type":"boolean"},"category":{"type":"string"},"components":{"items":{"$ref":"#/components/schemas/message_templates.TemplateComponent"},"type":"array","uniqueItems":false},"cta_url_link_tracking_opted_out":{"type":"boolean"},"display_format":{"type":"string"},"is_primary_device_delivery_only":{"type":"boolean"},"message_send_ttl_seconds":{"type":"integer"},"parameter_format":{"type":"string"},"sub_category":{"type":"string"}},"type":"object"},"message_templates.TemplateComponent":{"properties":{"add_security_recommendation":{"type":"boolean"},"buttons":{"items":{"$ref":"#/components/schemas/message_templates.TemplateComponentButton"},"type":"array","uniqueItems":false},"code_expiration_minutes":{"type":"integer"},"format":{"type":"string"},"text":{"type":"string"},"type":{"type":"string"}},"type":"object"},"message_templates.TemplateComponentButton":{"properties":{"autofill_text":{"type":"string"},"flow_action":{"type":"string"},"flow_id":{"type":"string"},"flow_json":{"type":"string"},"flow_name":{"type":"string"},"navigate_screen":{"type":"string"},"otp_type":{"type":"string"},"package_name":{"type":"string"},"phone_number":{"type":"string"},"signature_hash":{"type":"string"},"text":{"type":"string"},"type":{"type":"string"},"url":{"type":"string"}},"type":"object"},"message_templates.SuccessResponse":{"properties":{"success":{"type":"boolean"}},"type":"object"},"utils.ErrorResp":{"properties":{"error":{"type":"string"}},"type":"object"}}},"paths":{"/message_templates/{template_id}":{"post":{"description":"Update an existing message template. Only approved or rejected templates can be edited.","operationId":"update-message-template","parameters":[{"description":"Message template ID to edit","in":"path","name":"template_id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/message_templates.UpdateMessageTemplateRequestSchema","summary":"requestBody","description":"Updated template fields"}}},"description":"Updated template fields","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/message_templates.SuccessResponse"}}},"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"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Internal server error"}},"summary":"Edit Message Template","tags":["Templates"]}}}}
```

## Compare Message Templates

> Compare two message templates by block rate, message send volume, and top block reason. Both templates must be in the same WhatsApp Business account and must have been sent at least 1,000 times in the specified timeframe. Lookback windows are limited to 7, 30, 60, and 90 days.

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.46.8"},"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.CompareMessageTemplateResponse":{"description":"Response payload for Meta's Template Comparison API","properties":{"data":{"items":{"$ref":"#/components/schemas/message_templates.CompareTemplateMetric"},"type":"array","uniqueItems":false}},"type":"object"},"message_templates.CompareTemplateMetric":{"description":"A single comparison metric entry. The populated value field depends on the metric type:","properties":{"metric":{"enum":["BLOCK_RATE","MESSAGE_SENDS","TOP_BLOCK_REASON"],"type":"string"},"number_values":{"items":{"$ref":"#/components/schemas/message_templates.CompareTemplateIntValue"},"type":"array","uniqueItems":false},"order_by_relative_metric":{"items":{"type":"string"},"type":"array","uniqueItems":false},"string_values":{"items":{"$ref":"#/components/schemas/message_templates.CompareTemplateStrValue"},"type":"array","uniqueItems":false},"type":{"enum":["RELATIVE","NUMBER_VALUES","STRING_VALUES"],"type":"string"}},"type":"object"},"message_templates.CompareTemplateIntValue":{"properties":{"key":{"type":"string"},"value":{"type":"integer"}},"type":"object"},"message_templates.CompareTemplateStrValue":{"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"},"message_templates.CompareTemplateErrorResponse":{"description":"Meta Graph API error response","properties":{"error":{"$ref":"#/components/schemas/message_templates.CompareTemplateAPIError"}},"type":"object"},"message_templates.CompareTemplateAPIError":{"properties":{"code":{"type":"integer"},"error_subcode":{"type":"integer"},"error_user_msg":{"type":"string"},"error_user_title":{"type":"string"},"fbtrace_id":{"type":"string"},"is_transient":{"type":"boolean"},"message":{"type":"string"},"type":{"type":"string"}},"type":"object"},"utils.ErrorResp":{"properties":{"error":{"type":"string"}},"type":"object"}}},"paths":{"/message_templates/{template_id}/compare":{"get":{"description":"Compare two message templates by block rate, message send volume, and top block reason. Both templates must be in the same WhatsApp Business account and must have been sent at least 1,000 times in the specified timeframe. Lookback windows are limited to 7, 30, 60, and 90 days.","operationId":"get-compare-message-templates","parameters":[{"description":"ID of the target WhatsApp Message Template","in":"path","name":"template_id","required":true,"schema":{"type":"string"}},{"description":"JSON array with the ID of the template to compare against (e.g. [1533406637136032])","in":"query","name":"template_ids","required":true,"schema":{"type":"string"}},{"description":"UNIX timestamp for the start of the comparison timeframe","in":"query","name":"start","required":true,"schema":{"type":"integer"}},{"description":"UNIX timestamp for the end of the comparison timeframe","in":"query","name":"end","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/message_templates.CompareMessageTemplateResponse"}}},"description":"Comparison results including block rate, send volume, and top block reason"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/message_templates.CompareTemplateErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/message_templates.CompareTemplateErrorResponse"}}},"description":"Unauthorized"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/utils.ErrorResp"}}},"description":"Internal server error"}},"summary":"Compare Message Templates","tags":["Templates"]}}}}
```

## Get Templates

> Deprecated: use GET /message\_templates instead.

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.46.8"},"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":{"deprecated":true,"description":"Deprecated: use GET /message_templates instead.","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

> Deprecated: use POST /message\_templates instead

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.46.8"},"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":{"deprecated":true,"description":"Deprecated: use POST /message_templates instead","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

> Deprecated: use DELETE /message\_templates instead

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.46.8"},"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":{"deprecated":true,"description":"Deprecated: use DELETE /message_templates instead","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

> Deprecated: use POST /message\_templates/{template\_id} instead

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.46.8"},"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":{"deprecated":true,"description":"Deprecated: use POST /message_templates/{template_id} instead","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

> Deprecated: use GET /message\_templates/:template\_id/compare instead.

```json
{"openapi":"3.1.0","info":{"title":"Messaging API","version":"1.46.8"},"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":{"deprecated":true,"description":"Deprecated: use GET /message_templates/:template_id/compare instead.","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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
