API · Templates
Update Template
Update a template draft without changing the published version (requires full access). The current version ID changes when the draft is edited and stays the same when published.
PATCH
/templates/{id}Full accessRequest parameters
| Parameter | Type | Description |
|---|---|---|
idpath · required | string | Template id or alias. |
namebody · optional | string | null | Template name, up to 256 characters. |
aliasbody · optional | string | null | Unique template alias, up to 128 characters, generated when omitted on creation. |
frombody · optional | string | null | Sender address, up to 512 characters, optionally formatted as Name <sender@example.com>. |
subjectbody · optional | string | null | Email subject, up to 998 characters. |
reply_tobody · optional | string | (string)[] | Up to 50 valid reply-to addresses, supplied as a string or array. |
htmlbody · optional | string | null | HTML content, up to 256 KiB, with variable values escaped when rendered. |
textbody · optional | string | null | Plain text content, up to 256 KiB, derived from HTML when omitted on creation; an explicit empty string stays empty. |
variablesbody · optional | (object)[]Up to 50 items | Up to 50 unique string or number variable definitions, overriding inferred inline variables. |
variables[].keybody · required | stringMatches /^[A-Za-z_][A-Za-z0-9_]*$/ | Unique identifier of up to 50 characters, excluding FIRST_NAME, LAST_NAME, EMAIL, RESEND_UNSUBSCRIBE_URL, contact, and this. |
variables[].typebody · required | "string" | "number" | Variable type: string or number. |
variables[].fallback_valuebody · optional | string | number | Default matching the variable type, with string defaults limited to 2000 characters. |
Request example
Set OPENSEND_BASE_URL=https://api.example.com and OPENSEND_API_KEY=os_replace_me on your server.
bash
curl -X PATCH "$OPENSEND_BASE_URL/templates/YOUR_id" \
-H "Authorization: Bearer $OPENSEND_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"html":"<p>Updated.</p>"}'Response
200 · application/json. Example IDs stand for IDs returned by your installation.
json
{
"object": "template",
"id": "YOUR_ID"
}Behavior and errors
A template has one mutable draft and one published snapshot. Sends must use the published snapshot. There is no historical version API.
Use a full-access credential. Resource IDs belong to your team; an unknown or foreign resource returns 404. See authentication, errors, rate limits, and compatibility for the shared contract.