/templates/email

Use this resource to create, update, delete, show, or list email templates.

Secured By: Authentication Token
Description:

List email templates.

Responses with more than 50 records will be paginated to 50 records per response, unless otherwise specified.

Headers

Name Required Type Description
X-AUTH-TOKEN * string

An authentication token provided to you by GovDelivery.

Status

Headers

Name Type Description
Link string

Appropriate pagination link relations. Can include "first", "last", "prev", and "next" relations.

Example

< /templates/email?page=1>; rel="first",
< /templates/email?page=2>; rel="prev",
< /templates/email?page=4>; rel="next",
< /templates/email?page=5>; rel="last"

Body

Format: application/json

Example
[
  {
    "id": "1",
    "uuid" : "new_template-2",
    "body": "Template 2",
    "subject": "This is the template 2 subject.",
    "link_tracking_parameters": "test=ok&hello=world",
    "macros": {
      "MACRO1": "1"
    },
    "open_tracking_enabled": true,
    "click_tracking_enabled": true,
    "created_at": "2012-10-31T20:04:46Z",
    "message_type_code": "salutations",
    "_links": {
      "self": "/templates/email/new_template-2",
      "account": "/accounts/1",
      "from_address": "/from_addresses/1"
    }
  },
  {
    "id": "2",
    "uuid" : "2",
    "body": "hello world",
    "subject": "This is the template 3 subject.",
    "link_tracking_parameters": "template=1&foo=bar",
    "macros": {
      "MACRO2": "3"
    },
    "open_tracking_enabled": true,
    "click_tracking_enabled": false,
    "message_type_code": "salutations",
    "created_at": "2012-12-28T20:04:46Z",
    "_links": {
      "self": "/templates/email/2",
      "account": "/accounts/1",
      "from_address": "/from_addresses/1"
    }
  }
]
Schema
Array of objects that may include:
Name Type Description
id string

The id of the template

Example

1
uuid string

The id of the template

Example

new-template_1
body string

Content of the template

Example

Hi
subject string

The subject of the template.

Example

This is an email.
link_tracking_parameters string

The parameters to be appended to links for tracking purposes. It should be url query encoded.

Example

test=ok&hello=world
macros object

Macros to resolve.

Example

{
  "GD_TOPIC": "Test topic"
}
open_tracking_enabled boolean

Whether open tracking is enabled for the email template.

Example

true
click_tracking_enabled boolean

Whether click tracking is enabled for the email template.

Example

true
message_type_code string

The code of the message_type

Example

salutations
created_at string

The date and time when the template was created.

Example

2013-01-30T17:45:27Z
_links object

An object that defines links to related objects.

Properties

{
  "self": {
    "description": "Relative URI of the object",
    "type": "string",
    "example": "/inbound/sms/2"
  },
  "account": {
    "description": "Relative URI of the account.",
    "type": "string",
    "example": "/account/2"
  },
  "from_address": {
    "description": "Relative URI of the from address.",
    "type": "string",
    "example": "/from_addresses/2"
  },
  "message_type": {
    "description": "Relative URI of the message type.",
    "type": "string",
    "example": "/message_types/2"
  }
}
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Email Templates",
  "description": "A list of email templates.",
  "type": "array",
  "items": {
    "title": "Email Template",
    "type": "object",
    "properties": {
      "id": {
        "description": "The id of the template",
        "type": "string",
        "example": "1"
      },
      "uuid": {
        "description": "The id of the template",
        "type": "string",
        "example": "new-template_1"
      },
      "body": {
        "description": "Content of the template",
        "type": "string",
        "example": "Hi"
      },
      "subject": {
        "description": "The subject of the template.",
        "type": "string",
        "example": "This is an email."
      },
      "link_tracking_parameters": {
        "description": "The parameters to be appended to links for tracking purposes. It should be url query encoded.",
        "type": "string",
        "example": "test=ok&hello=world"
      },
      "macros": {
        "description": "Macros to resolve.",
        "type": "object",
        "example": "{\"GD_TOPIC\": \"Test topic\"}"
      },
      "open_tracking_enabled": {
        "description": "Whether open tracking is enabled for the email template.",
        "type": "boolean",
        "example": "true"
      },
      "click_tracking_enabled": {
        "description": "Whether click tracking is enabled for the email template.",
        "type": "boolean",
        "example": "true"
      },
      "message_type_code": {
        "description": "The code of the message_type",
        "type": "string",
        "example": "salutations"
      },
      "created_at": {
        "description": "The date and time when the template was created.",
        "type": "string",
        "example": "2013-01-30T17:45:27Z"
      },
      "_links": {
        "title": "Relational Links",
        "description": "An object that defines links to related objects.",
        "type": "object",
        "properties": {
          "self": {
            "description": "Relative URI of the object",
            "type": "string",
            "example": "/inbound/sms/2"
          },
          "account": {
            "description": "Relative URI of the account.",
            "type": "string",
            "example": "/account/2"
          },
          "from_address": {
            "description": "Relative URI of the from address.",
            "type": "string",
            "example": "/from_addresses/2"
          },
          "message_type": {
            "description": "Relative URI of the message type.",
            "type": "string",
            "example": "/message_types/2"
          }
        }
      }
    }
  }
}

Body

Format: application/json

Example
{
  "error": "Invalid authentication token"
}
Secured By: Authentication Token
Description:

Create an email template.

Headers

Name Required Type Description
X-AUTH-TOKEN * string

An authentication token provided to you by GovDelivery.

Body

Format: application/json

Example
{
  "uuid" : "new_template-2",
  "body": "hello world",
  "subject": "This is a subject.",
  "link_tracking_parameters": "test=ok&hello=world",
  "macros": {
    "HI": "WORLD"
  },
  "open_tracking_enabled": true,
  "click_tracking_enabled": true,
  "message_type_code": "salutations",
  "_links": {
    "from_address": "2"
  }
}
Schema
Object that may include:
Name Required Type Description
uuid string

A unique identifier (by account) that can be used to look up and reference the template. Note the unique constraint is not case-sensitive. If none is provided it defaults to the id assigned by the database.

Example

new-template_v2
body * string

Template body will comprise email content.

Example

[HELLO]
subject * string

Subject associated with the template.

Example

Test Subject from TMS Templates!
link_tracking_parameters string

Link tracking parameters associated with the template.

Example

hello=world&test=true
macros string

Macros associated with the template.

Example

{
  "HELLO": "WORLD"
}
open_tracking_enabled boolean

Whether open tracking is enabled for this template.

click_tracking_enabled boolean

Whether click tracking is enabled for this template.

Example

true
message_type_code string

The unique identifier of the Message Type to associate with this template. A Message Type will be created if it doesn't exist. The Message Type's label will be generated from this value, and can be updated via the Message Type resource.

_links string

The links to be associated with this template.

Possible parameters are:

  • from_address
    • Required: No
    • Id of the from address to associate to the template.

Example

{
  "from_address": "1"
}
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "/templates/email",
  "description": "Create an email template.",
  "type": "object",
  "properties": {
    "uuid": {
      "description": "A unique identifier (by account) that can be used to look up and reference the template. Note the unique constraint is not case-sensitive. If none is provided it defaults to the id assigned by the database.",
      "type": "string",
      "example": "new-template_v2"
    },
    "body": {
      "description": "Template body will comprise email content.",
      "type": "string",
      "example": "[HELLO]"
    },
    "subject": {
      "description": "Subject associated with the template.",
      "type": "string",
      "example": "Test Subject from TMS Templates!"
    },
    "link_tracking_parameters": {
      "description": "Link tracking parameters associated with the template.",
      "type": "string",
      "example": "hello=world&test=true"
    },
    "macros": {
      "description": "Macros associated with the template.",
      "type": "string",
      "example": "{\n  \"HELLO\": \"WORLD\"\n}\n"
    },
    "open_tracking_enabled": {
      "description": "Whether open tracking is enabled for this template.",
      "type": "boolean",
      "example": false
    },
    "click_tracking_enabled": {
      "description": "Whether click tracking is enabled for this template.",
      "type": "boolean",
      "example": true
    },
    "message_type_code": {
      "description": "The unique identifier of the Message Type to associate\nwith this template. A Message Type will be created if it doesn't\nexist. The Message Type's label will be generated from this value,\nand can be updated via the Message Type resource.\n",
      "type": "string"
    },
    "_links": {
      "description": "The links to be associated with this template.\n\nPossible parameters are:\n\n- from_address\n  - Required: No\n  - Id of the from address to associate to the template.\n",
      "type": "string",
      "example": "{\n  \"from_address\": \"1\"\n}\n"
    }
  },
  "required": [
    "body",
    "subject"
  ]
}
Form Parameters
Name Required Type Description
uuid string

A unique identifier (by account) that can be used to look up and reference the template. Note the unique constraint is not case-sensitive. If none is provided it defaults to the id assigned by the database.

Example

new-template_v2
body * string

Template body will comprise email content.

Example

[HELLO]
subject * string

Subject associated with the template.

Example

Test Subject from TMS Templates!
link_tracking_parameters string

Link tracking parameters associated with the template.

Example

hello=world&test=true
macros string

Macros associated with the template.

Example

{
  "HELLO": "WORLD"
}
open_tracking_enabled boolean

Whether open tracking is enabled for this template.

click_tracking_enabled boolean

Whether click tracking is enabled for this template.

Example

true
message_type_code string

The unique identifier of the Message Type to associate with this template. A Message Type will be created if it doesn't exist. The Message Type's label will be generated from this value, and can be updated via the Message Type resource.

_links string

The links to be associated with this template.

Possible parameters are:

  • from_address
    • Required: No
    • Id of the from address to associate to the template.

Example

{
  "from_address": "1"
}

Status

Body

Format: application/json

Example
{
  "id": "1",
  "uuid": "template-1",
  "body": "hello world",
  "subject": "This is a subject.",
  "link_tracking_parameters": "test=ok&hello=world",
  "macros": {
    "HI": "WORLD"
  },
  "open_tracking_enabled": true,
  "click_tracking_enabled": true,
  "created_at": "2012-10-31T20:04:46Z",
  "_links": {
    "self": "/templates/email/template-1",
    "account": "/accounts/1",
    "from_address": "/from_addresses/1"
  }
}
Schema
Object that may include:
Name Type Description
id string

The id of the template

Example

1
uuid string

The id of the template

Example

new-template_1
body string

Content of the template

Example

Hi
subject string

The subject of the template.

Example

This is an email.
link_tracking_parameters string

The parameters to be appended to links for tracking purposes. It should be url query encoded.

Example

test=ok&hello=world
macros object

Macros to resolve.

Example

{
  "GD_TOPIC": "Test topic"
}
open_tracking_enabled boolean

Whether open tracking is enabled for the email template.

Example

true
click_tracking_enabled boolean

Whether click tracking is enabled for the email template.

Example

true
message_type_code string

The code of the message_type

Example

salutations
created_at string

The date and time when the template was created.

Example

2013-01-30T17:45:27Z
_links object

An object that defines links to related objects.

Properties

{
  "self": {
    "description": "Relative URI of the object",
    "type": "string",
    "example": "/inbound/sms/2"
  },
  "account": {
    "description": "Relative URI of the account.",
    "type": "string",
    "example": "/account/2"
  },
  "from_address": {
    "description": "Relative URI of the from address.",
    "type": "string",
    "example": "/from_addresses/2"
  },
  "message_type": {
    "description": "Relative URI of the message type.",
    "type": "string",
    "example": "/message_types/2"
  }
}
{
  "title": "Email Template",
  "type": "object",
  "properties": {
    "id": {
      "description": "The id of the template",
      "type": "string",
      "example": "1"
    },
    "uuid": {
      "description": "The id of the template",
      "type": "string",
      "example": "new-template_1"
    },
    "body": {
      "description": "Content of the template",
      "type": "string",
      "example": "Hi"
    },
    "subject": {
      "description": "The subject of the template.",
      "type": "string",
      "example": "This is an email."
    },
    "link_tracking_parameters": {
      "description": "The parameters to be appended to links for tracking purposes. It should be url query encoded.",
      "type": "string",
      "example": "test=ok&hello=world"
    },
    "macros": {
      "description": "Macros to resolve.",
      "type": "object",
      "example": "{\"GD_TOPIC\": \"Test topic\"}"
    },
    "open_tracking_enabled": {
      "description": "Whether open tracking is enabled for the email template.",
      "type": "boolean",
      "example": "true"
    },
    "click_tracking_enabled": {
      "description": "Whether click tracking is enabled for the email template.",
      "type": "boolean",
      "example": "true"
    },
    "message_type_code": {
      "description": "The code of the message_type",
      "type": "string",
      "example": "salutations"
    },
    "created_at": {
      "description": "The date and time when the template was created.",
      "type": "string",
      "example": "2013-01-30T17:45:27Z"
    },
    "_links": {
      "title": "Relational Links",
      "description": "An object that defines links to related objects.",
      "type": "object",
      "properties": {
        "self": {
          "description": "Relative URI of the object",
          "type": "string",
          "example": "/inbound/sms/2"
        },
        "account": {
          "description": "Relative URI of the account.",
          "type": "string",
          "example": "/account/2"
        },
        "from_address": {
          "description": "Relative URI of the from address.",
          "type": "string",
          "example": "/from_addresses/2"
        },
        "message_type": {
          "description": "Relative URI of the message type.",
          "type": "string",
          "example": "/message_types/2"
        }
      }
    }
  }
}

Body

Format: application/json

Example
{
  "error": "Invalid authentication token"
}