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"
}
Admin APIs - Mail
Update Mail Template
Update an existing email template
PUT
/
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
string
required
Template ID to update.
Request Body
string
Updated template name.
string
Updated email subject.
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();
};
import requests
def update_mail_template(template_id, update_data, access_token):
response = requests.put(
f'https://api.weir.ai/mail/template/{template_id}',
headers={
'Authorization': f'Bearer {access_token}',
'Content-Type': 'application/json'
},
json=update_data
)
response.raise_for_status()
return response.json()
Was this page helpful?