Menu

Expand
Rate this page:

Transactional Templates

An HTML template that can establish a consistent design for transactional emails.

Each parent account, as well as each Subuser, can create up to 300 different transactional templates. Templates are specific to the parent account or Subuser, meaning templates created on a parent account will not be accessible from the parent's Subuser accounts.

Transactional templates are templates created specifically for transactional email and are not to be confused with Marketing Campaigns designs. For more information about transactional templates, please see our Dynamic Transactional Templates documentation.

Create a transactional template.

POST /v3/templates

Base url: https://api.sendgrid.com

This endpoint allows you to create a transactional template.

Authentication

  • API Key

Headers

Authorization
string
default: Bearer <<YOUR_API_KEY_HERE>>
required
on-behalf-of
string

The on-behalf-of header allows you to make API calls from a parent account on behalf of the parent's Subusers or customer accounts. You will use the parent account's API key when using this header. When making a call on behalf of a customer account, the property value should be "account-id" followed by the customer account's ID (e.g., on-behalf-of: account-id <account-id>). When making a call on behalf of a Subuser, the property value should be the Subuser's username (e.g., on-behalf-of: <subuser-username>). See On Behalf Of for more information.

default: None

Request Body

object
name
string

The name for the new transactional template.

maxLength: 100
required
generation
string

Defines whether the template supports dynamic replacement.

default: legacyAllowed Values: legacy, dynamic
{
  "name": "example_name",
  "generation": "dynamic"
}

Responses

object
id
string

The ID of the transactional template.

format: uuidmaxLength: 36minLength: 36
required
name
string

The name for the transactional template.

maxLength: 100
required
generation
string

Defines the generation of the template.

Allowed Values: legacy, dynamic
required
updated_at
string

The date and time that this transactional template version was updated.

pattern: ^(\d{4}-\d{2}-\d{2}) ((\d{2}):(\d{2}):(\d{2}))$
required
versions
array[object]

The different versions of this transactional template.

id
string

ID of the transactional template version.

format: uuid
template_id
string

ID of the transactional template.

active
integer

Set the version as the active version associated with the template. Only one version of a template can be active. The first version created for a template will automatically be set to Active.

Allowed Values: 0, 1
name
string

Name of the transactional template version.

maxLength: 100
subject
string

Subject of the new transactional template version.

maxLength: 255
updated_at
string

The date and time that this transactional template version was updated.

generate_plain_content
boolean

If true, plain_content is always generated from html_content. If false, plain_content is not altered.

default: True
html_content
string

The HTML content of the Design.

plain_content
string

Plain text content of the Design.

editor
string

The editor used in the UI.

Allowed Values: code, design
thumbnail_url
string

A Thumbnail preview of the template's html content.

warning
object
message
string

Warning message for the user

{
  "id": "0c314114-a2b7-4523-8cbc-a293d7d19007",
  "name": "example_name",
  "updated_at ": "2021-04-28 13:12:46",
  "warning": {
    "message": "Sample warning message"
  },
  "generation": "legacy",
  "versions": []
}
Loading Code Sample...
        
        

        Create a transactional template.

        Rate this page:

        Need some help?

        We all do sometimes. Get help now from the Twilio SendGrid Support Team.

        Running into a coding hurdle? Lean on the wisdom of the crowd by browsing the SendGrid tag on Stack Overflow or visiting Twilio's Stack Overflow Collective.

        Loading Code Sample...
              
              
              

              Thank you for your feedback!

              Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

              Sending your feedback...
              🎉 Thank you for your feedback!
              Something went wrong. Please try again.

              Thanks for your feedback!

              thanks-feedback-gif