Skip to main content
PUT
https://api-dev.weir.ai/
/
mail
/
template
/
:id
curl -X PUT 'https://api.weir.ai/mail/template/tpl_123456789' \
  -H 'Authorization: Bearer YOUR_ADMIN_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Updated Welcome Email",
    "subject": "Welcome to Weir AI Platform",
    "body": "<html>Updated content...</html>"
  }'
{
  "data": {
    "templateId": "tpl_123456789",
    "updatedAt": "2024-01-22T15:30:00Z"
  },
  "message": "Template updated successfully",
  "status": "success"
}

Update Mail Template

Update an existing email template.
curl -X PUT 'https://api.weir.ai/mail/template/tpl_123456789' \
  -H 'Authorization: Bearer YOUR_ADMIN_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Updated Welcome Email",
    "subject": "Welcome to Weir AI Platform",
    "body": "<html>Updated content...</html>"
  }'
{
  "data": {
    "templateId": "tpl_123456789",
    "updatedAt": "2024-01-22T15:30:00Z"
  },
  "message": "Template updated successfully",
  "status": "success"
}

Path Parameters

id
string
required
Template ID to update.

Request Body

name
string
Updated template name.
subject
string
Updated email subject.
body
string
Updated HTML email body.

Usage Examples

const updateMailTemplate = async (templateId, updateData, accessToken) => {
  const response = await fetch(`https://api.weir.ai/mail/template/${templateId}`, {
    method: 'PUT',
    headers: {
      'Authorization': `Bearer ${accessToken}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(updateData)
  });
  if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
  return await response.json();
};