Skip to content

Get a template

Fetch one template in full — bodies, defaults and discovered variables.

http
GET /v1/templates/{id}

Requires a Full access API key.

{id} is the template's id or its alias (the slug) — both resolve to the same template.

Path parameters

ParameterTypeRequiredDescription
idstringYesThe template id or its alias.

Example

bash
curl "https://api.sendgrail.com/v1/templates/$TEMPLATE_ID" \
  -H "Authorization: Bearer $SENDGRAIL_API_KEY"
js
const res = await fetch(
  `https://api.sendgrail.com/v1/templates/${id}`,
  { headers: { Authorization: `Bearer ${process.env.SENDGRAIL_API_KEY}` } },
);

const template = await res.json();

You can pass the alias just as well:

bash
curl "https://api.sendgrail.com/v1/templates/welcome-email" \
  -H "Authorization: Bearer $SENDGRAIL_API_KEY"

Response

json
{
  "object": "template",
  "id": "d3f8c2a1-6b47-4e9a-b25c-1f0e7a9d4c83",
  "alias": "welcome-email",
  "name": "Welcome email",
  "status": "published",
  "published_at": "2026-07-15T10:12:04+00:00",
  "created_at": "2026-07-15T09:58:41+00:00",
  "updated_at": "2026-07-15T10:12:04+00:00",
  "from": "Acme <hello@example.com>",
  "subject": "Welcome, {{{first_name}}}",
  "reply_to": null,
  "html": "<p>Hi {{{first_name}}}, your total is {{{price}}}.</p>",
  "text": null,
  "variables": [
    { "key": "first_name", "required": true, "fallback_value": null },
    { "key": "price", "required": false, "fallback_value": "25" }
  ]
}
FieldDescription
statusdraft or published. Only a published template can be sent.
published_atWhen it was first published — null while it's still a draft.
from / subject / reply_toThe defaults used at send, each overridable by the send payload. null when unset.
html / textThe bodies. text is null when you never set one; plain text is derived from the HTML at send instead.
variablesThe variables discovered from the body, each as { key, required, fallback_value }. fallback_value is null when the variable has no default.

Errors

A template belonging to another team answers 404, not 403 — an id or alias that isn't yours is one that doesn't exist, as far as your key is concerned.

json
{
  "message": "No template with the id or alias d3f8c2a1-6b47-4e9a-b25c-1f0e7a9d4c83.",
  "code": "not_found",
  "request_id": "8f2c1e64-1b17-4f8c-9f0e-3b6c1e0f5c31"
}

To send with this template, see Sending with a template.

Transactional email on your own domain.