Skip to main content

CreateEmailTemplate

Create an email template for sending emails later. Supports both rich text editor and drag-and-drop editor.

Request Information

  • Request Method: POST
  • Request Path: /api/v1/email/EmailTemplate
  • Content-Type: application/json

Request Parameters

Parameter NameTypeRequiredDescriptionExample Value
NamestringYesTemplate name"Welcome Email Template"
SubjectstringYesEmail subject"Welcome to USpeedo"
AbstractstringNoTemplate summary"New user welcome email"
TriggerTypeintYesTrigger type: 1-Verification code/Notification, 2-Marketing email1
EditorintYesEditor type: 1-Rich text editor, 2-Drag-and-drop editor1
HtmlContentstringYesHTML email content"Email content"
JsonContentstringNoJSON format content (for drag-and-drop editor)-
MaterialMD5arrayNoMaterial MD5 list["md5_1", "md5_2"]
VariableAttrstringNoTemplate variable attributes-
InTaskboolNoWhether to create in taskfalse

Notes

  • TriggerType: 1 represents verification code/notification emails, 2 represents marketing emails
  • Editor: 1 represents using rich text editor, 2 represents using drag-and-drop editor
  • When using drag-and-drop editor, the JsonContent field must be provided
  • MaterialMD5 is used to associate material resources used in emails

Request Example

curl -X POST "https://api.uspeedo.com/api/v1/email/EmailTemplate" \
-H "Content-Type: application/json" \
-H "Authorization: Basic $(echo -n 'ACCESSKEY_ID:ACCESSKEY_SECRET' | base64)" \
-d '{
"Name": "Welcome Email Template",
"Subject": "Welcome to USpeedo",
"Abstract": "New user welcome email",
"TriggerType": 1,
"Editor": 1,
"HtmlContent": "<html><body><h1>Welcome</h1><p>Dear {name}, welcome to USpeedo!</p></body></html>"
}'

Response Format

Success Response

{
"RetCode": 0,
"Message": "success",
"TemplateId": "template_123456"
}

Response Field Description

Field NameTypeDescription
RetCodeintReturn code, 0 indicates success
MessagestringReturn message
TemplateIdstringCreated template ID, used for subsequent email sending

Error Response

{
"RetCode": 215392,
"Message": "Invalid parameter [Name]"
}