The transactional templates API lets you programmatically create and manage templates for your transactional email.

Each user can have up to 300 templates.

Transactional templates are account and subuser specific. Templates created on a parent account will not be accessible from the subuser accounts.


POST

Create a template.

URI Parameter Required Requirements Description
name Yes String. max 100 characters Name of the new template

Request

1
POST https://api.sendgrid.com/v3/templates HTTP/1.1

Response

1
2
3
4
5
6
7
HTTP/1.1 201 OK

{
  "id": "733ba07f-ead1-41fc-933a-3976baa23716",
  "name": "example_name",
  "versions": []
}

GET

Retrieve all templates.

Request

1
GET https://api.sendgrid.com/v3/templates HTTP/1.1

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
  "templates": [
    {
      "id": "e8ac01d5-a07a-4a71-b14c-4721136fe6aa",
      "name": "example template name",
      "versions": [
        {
          "id": "5997fcf6-2b9f-484d-acd5-7e9a99f0dc1f",
          "template_id": "9c59c1fb-931a-40fc-a658-50f871f3e41c",
          "active": 1,
          "name": "example version name",
          "updated_at": "2014-03-19 18:56:33",
          "editor": "design"
        }
      ]
    }
  ]
}

GET

Retrieve a single template.

Request

1
GET https://api.sendgrid.com/v3/templates/:template_id HTTP/1.1

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
  "id": "e8ac01d5-a07a-4a71-b14c-4721136fe6aa",
  "name": "example template name",
  "versions": [
    {
      "id": "de37d11b-082a-42c0-9884-c0c143015a47",
      "user_id": 1234,
      "template_id": "d51480ba-ca3f-465c-bc3e-ceb71d73c38d",
      "active": 1,
      "name": "example version",
      "html_content": "<%body%><strong>Click to Reset</strong>",
      "plain_content": "Click to Reset<%body%>",
      "editor": "code",
      "subject": "<%subject%>",
      "updated_at": "2014-05-22 20:05:21"
    }
  ]
}

PATCH

Edit a template.

URI Parameter Required Requirements Description
name Yes String. Max 100 characters Name of the new template

Request

1
PATCH https://api.sendgrid.com/v3/templates/:template_id HTTP/1.1

Response

1
2
3
4
5
6
7
HTTP/1.1 200 OK

{
  "id": "733ba07f-ead1-41fc-933a-3976baa23716",
  "name": "new_example_name",
  "versions": []
}

DELETE

Delete a template.

Request

1
DELETE https://api.sendgrid.com/v3/templates/:template_id HTTP/1.1

Response

1
HTTP/1.1 204 NO CONTENT (OK)