Skip to content

Copy a template

Request

Copies an existing template into new templates with the provided names and account IDs.

Security
basicAuth
Path
domain_namestringrequired

Domain name the template is associated with.

template_namestringrequired

The name of the source template

Bodyapplication/jsonrequired
requestsArray of objects(github.com-mailgun-temple-httpapi-TemplateCopyRequest)required

List of copy requests

source_versionsArray of strings

Versions to copy or all versions if empty.

curl -i -X PUT \
  -u '<username>:<password>' \
  'https://api.mailgun.net/v3/{domain_name}/templates/{template_name}/copy' \
  -H 'Content-Type: application/json' \
  -d '{
    "requests": [
      {
        "account_id": "account-id-1",
        "name": "new-template-name-1"
      },
      {
        "account_id": "account-id-2",
        "name": "new-template-name-2",
        "domain": "target-domain"
      }
    ]
  }'

Responses

A 200 response

Bodyapplication/json
messagestringrequired

Response message

failed_copiesArray of objects(github.com-mailgun-temple-httpapi-TemplateCopyRequest)required

Failed copy requests

errorstring

A error that occurred during copying

Response
{ "message": "Templates have been copied", "failed_copies": [ {}, {} ] }