ZapSMTP / Docs / TemplatesResponse
Retrieve a template
GET/v1/templates/{id}
Retrieve a template by id or alias.
Requires a full-access key.
id is what template.id takes when you send; the alias works too. published is the version sends use (null until the first publish).
published.variable_schema is null for a template last published before variable schemas existed: its sends need every variable, as before, until it is published again.
Path parameters
idstringrequired- Template id (UUID) or alias
Errors
restricted_api_keyHTTP 403not_foundHTTP 404- template not found
curl 'https://zapsmtp.xyz/v1/templates/welcome' \
-H "Authorization: Bearer $ZAP_API_KEY"const res = await fetch('https://zapsmtp.xyz/v1/templates/welcome', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.ZAP_API_KEY}`,
},
});
// 204 No Content (e.g. a delete) has no body
const data = res.status === 204 ? null : await res.json();
if (!res.ok) throw new Error(`${data.name}: ${data.message}`);
console.log(data);import os
import requests
res = requests.get(
"https://zapsmtp.xyz/v1/templates/welcome",
headers={"Authorization": f"Bearer {os.environ['ZAP_API_KEY']}"},
timeout=30,
)
res.raise_for_status()
print(res.json() if res.status_code != 204 else "deleted")<?php
$ch = curl_init('https://zapsmtp.xyz/v1/templates/welcome');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ZAP_API_KEY'),
],
]);
$data = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
if ($status >= 400) {
throw new RuntimeException($data['message']);
}
print_r($data);package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest(
"GET",
"https://zapsmtp.xyz/v1/templates/welcome",
nil,
)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("ZAP_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(res.Status, string(out))
}require 'net/http'
require 'json'
uri = URI('https://zapsmtp.xyz/v1/templates/welcome')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = "Bearer #{ENV.fetch('ZAP_API_KEY')}"
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
puts res.code, (JSON.parse(res.body) unless res.body.to_s.empty?)import java.net.URI;
import java.net.http.*;
public class ZapRequest {
public static void main(String[] args) throws Exception {
var request = HttpRequest.newBuilder(URI.create("https://zapsmtp.xyz/v1/templates/welcome"))
.header("Authorization", "Bearer " + System.getenv("ZAP_API_KEY"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://zapsmtp.xyz/v1/templates/welcome");
request.Headers.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("ZAP_API_KEY"));
var response = await http.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");Set
ZAP_API_KEY in your environment.Response 200 OK
{
"id": "019a1f23-7f80-7192-8b3c-4d5e6f7a8b9c",
"name": "Receipt",
"alias": "receipt",
"subject": "Your receipt for {{order_id}}",
"html": "<p>Hi {{name}}, thanks for order {{order_id}}.</p>",
"text": "Hi {{name}}, thanks for order {{order_id}}.",
"from": "Acme <billing@acme.com>",
"variables": {
"name": "Jane",
"order_id": "A-1042"
},
"variable_schema": [
{
"name": "order_id",
"type": "string",
"required": true,
"example": "A-1042",
"description": "Order number shown to the customer"
},
{
"name": "name",
"type": "string",
"required": false,
"default": "there",
"example": "Jane"
}
],
"design": null,
"created_at": "2026-10-21T16:10:00Z",
"updated_at": "2026-10-21T16:10:00Z",
"object": "template",
"variable_names": [
"order_id",
"name"
],
"status": "published",
"has_unpublished_changes": false,
"published_at": "2026-10-21T16:12:00Z",
"published": {
"subject": "Your receipt for {{order_id}}",
"html": "<p>Hi {{name}}, thanks for order {{order_id}}.</p>",
"text": "Hi {{name}}, thanks for order {{order_id}}.",
"from": "Acme <billing@acme.com>",
"design": null,
"variable_schema": [
{
"name": "order_id",
"type": "string",
"required": true,
"example": "A-1042",
"description": "Order number shown to the customer"
},
{
"name": "name",
"type": "string",
"required": false,
"default": "there",
"example": "Jane"
}
]
}
}