Edit email
Update an email by its ID with a PATCH request. All fields are optional and only the fields you send are changed. The old route /communications/email/edit/:id is deprecated.
ReferenceView as Markdown
Edit an email in Subrite.
- Method:
PATCH - Route:
{baseUrl}/api/v1/communications/:id/email/edit(get the:idfrom the email list) - Authorization: Bearer token (use the M2M token from Setup)
- Body: see the example below
Request body#
All fields are optional in the update request. Only the fields included in the request body will be updated; other fields will remain unchanged.
Example request body#
{
// Optional fields - include only what you want to update
"communicationType": "marketing", // Optional: "marketing" or "information"
"name": "coming from external", // Optional: template name
"senderId": 2, // Optional: sender ID
"consentId": null, // Optional: consent ID
"segmentId": 1, // Optional: segment ID
"subject": "email subject", // Optional: email subject
"emailPreviewText": "sample", // Optional: preview text
"emailContent": "<div>hello world</div>" // Optional: email HTML content
}Usage notes#
- Include only the fields you want to update
- Omitted fields will retain their existing values
- Partial updates are supported
- All fields are optional
Example partial update#
// Only updating email content and subject
{
"subject": "Updated Subject",
"emailContent": "<div>New content</div>"
}Success response#
{
"id": 156,
"name": "yy",
"communicationType": "information",
"smsContent": null,
"subject": "demo test",
"emailEditorRawContent": null,
"emailPreviewText": "demo preview data",
"template": null,
"status": "ready",
"communicationChannel": "email",
"createdAt": "2025-03-24T11:33:08.872Z",
"updatedAt": "2025-03-25T16:15:39.170Z",
"senderId": 1,
"sender": "mitsiden-email",
"segmentId": 1,
"segmentName": "Bangladeshi members",
"consentId": null,
"tenantId": 1,
"adminUserId": null,
"scheduledAt": null,
"completedAt": null,
"emailHtmlPreview": null,
"deliveryMethod": "API"
}