# Domain Templates This API allows you to store predefined templates at the domain level and use them to send messages using the Sending API. ## Get templates - [GET /v3/{domain_name}/templates](https://documentation.mailgun.com/docs/inboxready/api-reference/optimize/mailgun/domain-templates/get-v3--domain-name--templates.md): Returns a list of templates for the domain. ## Create a template - [POST /v3/{domain_name}/templates](https://documentation.mailgun.com/docs/inboxready/api-reference/optimize/mailgun/domain-templates/post-v3--domain-name--templates.md): Store a new template, including its name, description and (optionally) the template content. If the template content is provided, a new version is automatically created and becomes the active version. ## Delete all templates - [DELETE /v3/{domain_name}/templates](https://documentation.mailgun.com/docs/inboxready/api-reference/optimize/mailgun/domain-templates/delete-v3--domain-name--templates.md): Delete all templates and their versions for the domain. ## Get all template versions - [GET /v3/{domain_name}/templates/{template_name}/versions](https://documentation.mailgun.com/docs/inboxready/api-reference/optimize/mailgun/domain-templates/get-v3--domain-name--templates--template-name--versions.md): Returns a paginated list of template versions. ## Create a template version - [POST /v3/{domain_name}/templates/{template_name}/versions](https://documentation.mailgun.com/docs/inboxready/api-reference/optimize/mailgun/domain-templates/post-v3--domain-name--templates--template-name--versions.md): Adds a new template version. If the template doesn’t contain any other versions, the first version becomes active. A template can store up to 40 versions. ## Get template - [GET /v3/{domain_name}/templates/{template_name}](https://documentation.mailgun.com/docs/inboxready/api-reference/optimize/mailgun/domain-templates/get-v3--domain-name--templates--template-name-.md): Returns metadata information about the stored template specified in the url. If the active flag is provided, the content of the active version of the template is returned. If the version_name flag is provided, version information will be included as well. By default: the field is not provided. To see available versions other than the active version, use the API instead ## Update template - [PUT /v3/{domain_name}/templates/{template_name}](https://documentation.mailgun.com/docs/inboxready/api-reference/optimize/mailgun/domain-templates/put-v3--domain-name--templates--template-name-.md): Update the description of a template. ## Delete a template - [DELETE /v3/{domain_name}/templates/{template_name}](https://documentation.mailgun.com/docs/inboxready/api-reference/optimize/mailgun/domain-templates/delete-v3--domain-name--templates--template-name-.md): Delete the template specified in the url. NOTE: This method deletes all versions of the specified template. ## Get a version - [GET /v3/{domain_name}/templates/{template_name}/versions/{version_name}](https://documentation.mailgun.com/docs/inboxready/api-reference/optimize/mailgun/domain-templates/get-v3--domain-name--templates--template-name--versions--version-name-.md): Retrieve the information and content of the specified version of a template. ## Update a version - [PUT /v3/{domain_name}/templates/{template_name}/versions/{version_name}](https://documentation.mailgun.com/docs/inboxready/api-reference/optimize/mailgun/domain-templates/put-v3--domain-name--templates--template-name--versions--version-name-.md): Update information or content of the specific template version. Existing fields not included in the request will not be changed ## Delete a version - [DELETE /v3/{domain_name}/templates/{template_name}/versions/{version_name}](https://documentation.mailgun.com/docs/inboxready/api-reference/optimize/mailgun/domain-templates/delete-v3--domain-name--templates--template-name--versions--version-name-.md): Delete a specific template version. ## Copy a template - [PUT /v3/{domain_name}/templates/{template_name}/copy](https://documentation.mailgun.com/docs/inboxready/api-reference/optimize/mailgun/domain-templates/put-v3--domain-name--templates--template-name--copy.md): Copies an existing template into new templates with the provided names and account IDs. ## Copy a version - [PUT /v3/{domain_name}/templates/{template_name}/versions/{version_name}/copy/{new_version_name}](https://documentation.mailgun.com/docs/inboxready/api-reference/optimize/mailgun/domain-templates/put-v3--domain-name--templates--template-name--versions--version-name--copy--new-version-name-.md): Copies an existing version into a new version with the provided name. ## Rename a template - [PUT /v3/{domain_name}/templates/{template_name}/rename/{new_template_name}](https://documentation.mailgun.com/docs/inboxready/api-reference/optimize/mailgun/domain-templates/put-v3--domain-name--templates--template-name--rename--new-template-name-.md): Renames the specified template