Docs
API · templates

Update a template

Partial update — send only the fields you want to change. The rest are left untouched.

PATCH/v1/templates/{id}

01 Path parameters

idstringRequired
The template id to update.

02 Body parameters

All fields are optional; omitted fields keep their current value.

namestringOptional
New display name.
subjectstringOptional
New subject line.
htmlstring | nullOptional
New HTML body. Pass null to clear it.
textstring | nullOptional
New plain-text body. Pass null to clear it.
slugstringOptional
New slug. Must stay unique within the project.

03 Request

curl https://api.drin.run/v1/templates/tmpl_8XQ2k9 \
  -X PATCH \
  -H "Authorization: Bearer $DRIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "subject": "Your receipt — order {{orderId}}",
    "text": "Hi {{firstName}}, thanks for your order."
  }'

04 Response

Returns the full template with a refreshed updatedAt and a recomputed variables list.

200 OK
{
  "id": "tmpl_8XQ2k9",
  "slug": "order-receipt",
  "name": "Order Receipt",
  "subject": "Your receipt — order {{orderId}}",
  "html": "<p>Hi {{firstName}}, thanks for your order.</p>",
  "text": "Hi {{firstName}}, thanks for your order.",
  "variables": ["firstName", "orderId"],
  "createdAt": "2026-06-02T10:00:00.000Z",
  "updatedAt": "2026-06-02T11:30:00.000Z"
}
Slug collisionsChanging slug to one already taken in the project returns 409 conflict (template_slug_taken).