SpiderMail Templates
2 endpoints from the published OpenAPI import.
Update Template
Update an existing template.
Only provided fields are updated.
Note: PATCH /mail/templates/{id} in mail.py is a second, independent update handler. Both are live and reached by different callers — the agent surfaces (@spideriq/core, the skill schema, the CLI) use PUT; the dashboard's useUpdateTemplate uses PATCH. This one additionally validates Jinja2 syntax, rejects a duplicate name with 409, and unsets sibling defaults when is_default is set.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
template_id | path | integer | true |
Try it
Examples
cURL
curl -X PUT 'https://spideriq.ai/api/v1/mail/templates/{template_id}' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{
"name": "string",
"description": "string",
"template_type": "signature",
"html_source": "string",
"text_source": "string",
"variables": [
"string"
],
"is_active": true,
"is_default": true
}'Python
import httpx
resp = httpx.put(
"https://spideriq.ai/api/v1/mail/templates/{template_id}",
headers={"Authorization": "Bearer <token>", "Content-Type": "application/json"},
json={"name": "string", "description": "string", "template_type": "signature", "html_source": "string", "text_source": "string", "variables": ["string"], "is_active": true, "is_default": true},
)
resp.raise_for_status()
print(resp.json())JavaScript
const resp = await fetch("https://spideriq.ai/api/v1/mail/templates/{template_id}", {
method: "PUT",
headers: { "Authorization": "Bearer <token>", "Content-Type": "application/json" },
body: JSON.stringify({"name": "string", "description": "string", "template_type": "signature", "html_source": "string", "text_source": "string", "variables": ["string"], "is_active": true, "is_default": true})
});
const data = await resp.json();
console.log(data);Go
package main
import (
"net/http"
"strings"
)
func main() {
body := strings.NewReader(`{"name": "string", "description": "string", "template_type": "signature", "html_source": "string", "text_source": "string", "variables": ["string"], "is_active": true, "is_default": true}`)
req, _ := http.NewRequest("PUT", "https://spideriq.ai/api/v1/mail/templates/{template_id}", body)
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
}Responses
| Status | Description |
|---|---|
200 | Successful Response |
422 | Validation Error |
Preview Template
Preview a template with sample data.
Renders the template with provided variables and returns the result. Useful for testing templates before using them in emails.
The request body accepts variables (current) or template_data (legacy) — MailTemplatePreviewRequest aliases both onto the same field.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
template_id | path | integer | true |
Try it
Examples
cURL
curl -X POST 'https://spideriq.ai/api/v1/mail/templates/{template_id}/preview' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{
"variables": {
"body": "Thank you for your interest in our services.",
"company_name": "Acme Corp",
"name": "John Doe"
}
}'Python
import httpx
resp = httpx.post(
"https://spideriq.ai/api/v1/mail/templates/{template_id}/preview",
headers={"Authorization": "Bearer <token>", "Content-Type": "application/json"},
json={"variables": {"body": "Thank you for your interest in our services.", "company_name": "Acme Corp", "name": "John Doe"}},
)
resp.raise_for_status()
print(resp.json())JavaScript
const resp = await fetch("https://spideriq.ai/api/v1/mail/templates/{template_id}/preview", {
method: "POST",
headers: { "Authorization": "Bearer <token>", "Content-Type": "application/json" },
body: JSON.stringify({"variables": {"body": "Thank you for your interest in our services.", "company_name": "Acme Corp", "name": "John Doe"}})
});
const data = await resp.json();
console.log(data);Go
package main
import (
"net/http"
"strings"
)
func main() {
body := strings.NewReader(`{"variables": {"body": "Thank you for your interest in our services.", "company_name": "Acme Corp", "name": "John Doe"}}`)
req, _ := http.NewRequest("POST", "https://spideriq.ai/api/v1/mail/templates/{template_id}/preview", body)
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
}Responses
| Status | Description |
|---|---|
200 | Successful Response |
422 | Validation Error |