Duplicate a template
Copy one of your templates, as the Templates screen's Duplicate does: the same subject, preview line, body (editor document and HTML), type and library…
https://app.usenotix.dev/api/v1/templates/{templateId}/duplicateNeeds a full access key. Sending access keys cannot call this. Key permissions lists the extra rules some calls have.
Copy one of your templates, as the Templates screen's Duplicate does: the same subject, preview line, body (editor document and HTML), type and library origin, under a new id, named after the original with " (Copy)" unless you give name. The original is unchanged. Send no body, or a JSON body with only name; a body sent as anything but JSON answers 400. Another team's template, or an id that does not exist, answers 404. Nothing is sent.
Who can call it
Full access keys, and live AI keys: a copy only ever creates a new template owned by your team, and never changes, renames or deletes an existing one. Templates carry no domain, so a key limited to one domain may too. Read only and send-only keys answer 403 SCOPE_DENIED. Every copy is recorded in the key's audit log (GET /v1/audit-log) with the new template's id and where it came from.
The team can create or copy 60 templates a minute through the API (POST /v1/templates and both copies count together), and 120 template writes a minute counting the dashboard's own, so the dashboard always keeps room. Past either the answer is 429 with Retry-After. When Notix cannot count them the answer is 503 SERVICE_UNAVAILABLE (try again shortly), never a 429.
Path parameters
Body parameters
The copy's name. Defaults to the original's name with " (Copy)".
At most 200 characters.
Headers
Bearer followed by your API key.
Errors
A field the route does not know, a name out of bounds, or a body that is not sent as JSON.
`SCOPE_DENIED`: a read only or send-only key.
No template with this id for the calling team.
The team created or copied 60 templates through the API in the last minute, or wrote 120 templates counting the dashboard's own writes.
Notix cannot count the team's calls just now; try again shortly.
Every error has the same shape. See all error codes.
curl -X POST "https://app.usenotix.dev/api/v1/templates/<templateId>/duplicate" \
-H "Authorization: Bearer $NOTIX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Acme"
}'
import { Notix } from "notix-js";
const notix = new Notix(process.env.NOTIX_API_KEY);
const { data, error } = await notix.templates.duplicate("tpl_123", { name: "Receipt v2" });
{
"id": "cm5t3mplat3id0000",
"name": "Order receipt",
"subject": "Your order {{orderId}}",
"type": "TRANSACTIONAL",
"html": "<p>Thanks for your order.</p>"
}