Schedule email by ID
Schedule an email by its ID. Only scheduledAt is required, and timeZone is optional (UTC is used when it is left out). The response includes the communication data.
ReferenceView as Markdown
Schedule an email by its ID through Subrite.
- Method:
POST - Route:
{baseUrl}/api/v1/communications/:id/email/schedule - Authorization: Bearer token (use the M2M token from Setup)
- Body: see the example below
Example body#
Only scheduledAt is required.
{
"communicationType": "marketing", // Possible values: "marketing" or "information"
"name": "sample name",
"senderId": 2, // Use sender ID from Step 2 response
"consentId": null,
"segmentId": 1, // Use segment ID from Step 3 response
"subject": "email subject",
"emailPreviewText": "sample",
"emailContent": "<div>hello world</div>",
"scheduledAt": "2025-03-26T05:14:25.064Z", // Set norway time
"timeZone": "Europe/Oslo" // Optional: If not provided, UTC will be used
}In the example, the senderId comes from the step 2 response and the segmentId from the step 3 response on the Setup page.
Success response#
{
success: true,
message: 'Test emails sent successfully',
id: 8987,
communication: {communicationData}
}Scheduling time#
The scheduledAt field expects:
- ISO 8601 datetime format
- UTC timezone (for example
2025-03-26T05:14:25.064Z) - If
timeZoneis not provided, the system will treat the time as UTC - If
timeZoneis provided, the system will convert the time from the specified timezone to UTC
Timezone support#
The timeZone field accepts any valid IANA timezone string supported by the date-fns-tz library. Common examples include:
UTCEurope/OsloEurope/LondonEurope/ParisEurope/BerlinAmerica/New_YorkAmerica/Los_AngelesAsia/TokyoAsia/ShanghaiAustralia/SydneyPacific/Auckland
For a complete list of supported timezones, refer to the IANA Time Zone Database.
Example:
{
"scheduledAt": "2025-03-26T05:14:25.064Z",
"timeZone": "Europe/Oslo"
}