ZapSMTP / Docs / Modules, images & timersResponse
Save a module
POST/v1/template-modules
Save rows as a module that every template of the account can insert.
Requires a full-access live key; test keys get 403 test_key_restricted.
Inserting a module copies its rows into the template: changing the module later does not change templates that already use it.
Body parameters
namestringrequired- Limits: trimmed, 1-200 characters → 422 missing_required_field
categorystring- Groups modules in the editor’s palette. Limits: trimmed, max 100 characters → 422 missing_required_field Default
"". designobjectrequired- The saved rows:
{"rows": [...]}with at least one row in the visual editor’s format (copy rows from a template’sdesign). Limits: max 1 MB → 422 invalid_parameter
Errors
restricted_api_keyHTTP 403test_key_restrictedHTTP 403- test-mode keys can send test email and read, not change the account: use a live key
payload_too_largeHTTP 413- request body too large
invalid_parameterHTTP 422- design must be {"rows": [...]} with at least one row (max 1 MB)
missing_required_fieldHTTP 422- name is required (max 200 chars), category max 100 chars
curl -X POST 'https://zapsmtp.xyz/v1/template-modules' \
-H "Authorization: Bearer $ZAP_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"name": "Footer",
"category": "Brand",
"design": {
"rows": [
{
"id": "r1",
"columns": [
{
"id": "c1",
"width": 100,
"blocks": [
{
"id": "b1",
"type": "text",
"html": "<p>Acme Inc. · 1 Market St, San Francisco</p>"
}
]
}
]
}
]
}
}'const res = await fetch('https://zapsmtp.xyz/v1/template-modules', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.ZAP_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "Footer",
"category": "Brand",
"design": {
"rows": [
{
"id": "r1",
"columns": [
{
"id": "c1",
"width": 100,
"blocks": [
{
"id": "b1",
"type": "text",
"html": "<p>Acme Inc. · 1 Market St, San Francisco</p>"
}
]
}
]
}
]
}
}),
});
// 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.post(
"https://zapsmtp.xyz/v1/template-modules",
headers={"Authorization": f"Bearer {os.environ['ZAP_API_KEY']}"},
json={
"name": "Footer",
"category": "Brand",
"design": {
"rows": [
{
"id": "r1",
"columns": [
{
"id": "c1",
"width": 100,
"blocks": [
{
"id": "b1",
"type": "text",
"html": "<p>Acme Inc. · 1 Market St, San Francisco</p>",
},
],
},
],
},
],
},
},
timeout=30,
)
res.raise_for_status()
print(res.json() if res.status_code != 204 else "deleted")<?php
$ch = curl_init('https://zapsmtp.xyz/v1/template-modules');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ZAP_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Footer',
'category' => 'Brand',
'design' => [
'rows' => [
[
'id' => 'r1',
'columns' => [
[
'id' => 'c1',
'width' => 100,
'blocks' => [
[
'id' => 'b1',
'type' => 'text',
'html' => '<p>Acme Inc. · 1 Market St, San Francisco</p>',
],
],
],
],
],
],
],
]),
]);
$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"
"strings"
)
func main() {
body := strings.NewReader(`{
"name": "Footer",
"category": "Brand",
"design": {
"rows": [
{
"id": "r1",
"columns": [
{
"id": "c1",
"width": 100,
"blocks": [
{
"id": "b1",
"type": "text",
"html": "<p>Acme Inc. · 1 Market St, San Francisco</p>"
}
]
}
]
}
]
}
}`)
req, err := http.NewRequest(
"POST",
"https://zapsmtp.xyz/v1/template-modules",
body,
)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("ZAP_API_KEY"))
req.Header.Set("Content-Type", "application/json")
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/template-modules')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = "Bearer #{ENV.fetch('ZAP_API_KEY')}"
req['Content-Type'] = 'application/json'
req.body = {
name: "Footer",
category: "Brand",
design: {
rows: [
{
id: "r1",
columns: [
{
id: "c1",
width: 100,
blocks: [
{
id: "b1",
type: "text",
html: "<p>Acme Inc. · 1 Market St, San Francisco</p>"
}
]
}
]
}
]
}
}.to_json
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/template-modules"))
.header("Authorization", "Bearer " + System.getenv("ZAP_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("""
{
"name": "Footer",
"category": "Brand",
"design": {
"rows": [
{
"id": "r1",
"columns": [
{
"id": "c1",
"width": 100,
"blocks": [
{
"id": "b1",
"type": "text",
"html": "<p>Acme Inc. · 1 Market St, San Francisco</p>"
}
]
}
]
}
]
}
}"""))
.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.Post, "https://zapsmtp.xyz/v1/template-modules");
request.Headers.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("ZAP_API_KEY"));
request.Content = new StringContent("""
{
"name": "Footer",
"category": "Brand",
"design": {
"rows": [
{
"id": "r1",
"columns": [
{
"id": "c1",
"width": 100,
"blocks": [
{
"id": "b1",
"type": "text",
"html": "<p>Acme Inc. · 1 Market St, San Francisco</p>"
}
]
}
]
}
]
}
}
""", Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");Set
ZAP_API_KEY in your environment.Response 201 Created
{
"id": "019a1f61-4e5f-7a60-8b71-8c9d0e1f2a3b",
"name": "Footer",
"category": "Brand",
"design": {
"rows": [
{
"id": "r1",
"columns": [
{
"id": "c1",
"width": 100,
"blocks": [
{
"id": "b1",
"type": "text",
"html": "<p>Acme Inc. · 1 Market St, San Francisco</p>"
}
]
}
]
}
]
},
"created_at": "2026-10-22T16:00:00Z",
"updated_at": "2026-10-22T16:00:00Z"
}