# Templates This API allows you to store predefined templates 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/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/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/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/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/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/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. ## Update template - [PUT /v3/{domain_name}/templates/{template_name}](https://documentation.mailgun.com/docs/inboxready/api-reference/optimize/mailgun/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/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/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/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/templates/delete-v3--domain-name--templates--template-name--versions--version-name-.md): Delete a specific template version. ## 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/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.