Skip to main content

Schedule email

Api call to subrite to schedule email

  • Method: POST
  • Route: {baseUrl}/api/v1/communications/email/schedule
  • Authorization: Bearer token (use the m2m token collected in ## configuration)
  • Body: See example below

Example of body :

{
"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
"hostName": "example.com" // Optional. See "Host name" below.
}

Host name

hostName is optional. When set, unsubscribe links generated for this email use the supplied hostname instead of the tenant's primary hostname. Use it when your tenant serves multiple brand domains so recipients land on the correct brand.

  • Must match the tenant's primary hostname or one of its registered additional hostnames. Foreign or unregistered hostnames are silently ignored and the tenant's primary hostname is used as a fallback.
  • DNS-safe characters only (a–z, 0–9, ., -, optional :port); IDN hostnames must be supplied in punycode form.
  • Omit the field to use the tenant's primary hostname.

Success API Response :

{
success: true,
message: 'Test emails sent successfully',
id: 8987
}

Scheduling Time

The scheduledAt field expects:

  • ISO 8601 datetime format
  • UTC timezone (e.g., "2025-03-26T05:14:25.064Z")
  • If timeZone is not provided, the system will treat the time as UTC
  • If timeZone is 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:

  • UTC
  • Europe/Oslo
  • Europe/London
  • Europe/Paris
  • Europe/Berlin
  • America/New_York
  • America/Los_Angeles
  • Asia/Tokyo
  • Asia/Shanghai
  • Australia/Sydney
  • Pacific/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"
}

Note: If you specify 05:14 UTC, it will be executed at:

  • 06:14 during winter time (UTC+1)
  • 07:14 during summer time (UTC+2)