Email Templates

Create an email template

Creates an email template of the account: the email a scheduled delivery is sent as, reused by every schedule that names it with email_template_key.

IT SENDS NOTHING. Writing a template puts no mail in anybody's inbox -- only a schedule does -- and it does not count against the daily email budget of the account.

THE SENDER HAS TO BE THE ACCOUNT'S. sender_email and reply_to_email have to be the address of a user of the account or share the domain of one, which is the rule /v1/schedules/create applies and the application does not: a template written through an API key would otherwise send mail as anybody.

THE BODY IS STORED AS IT IS. It is not sanitized: a template is a whole HTML document and the application never paints it -- it travels by email. What is refused is the content the platform blocks for a delivery, the same check a schedule goes through.

PLACEHOLDERS. The subject and the body can carry %%REPORT_TITLE%%, %%CURRENT_PERIOD%%, %%PAST_PERIOD%%, %%EXECUTION_DATE%%, %%CUSTOM_VAR_1%% to %%CUSTOM_VAR_5%%, %%REPORT_LINK%% and %%AI_SUMMARY%% (body only), replaced when the email goes out. %%REPORT_LINK%% is required in the body of a delivery sent in the link format, which /v1/schedules/create checks and this endpoint does not: a template does not know which deliveries will use it.

if_version is not accepted, and the call is never confirmed: its inverse is /v1/email-templates/delete.

Every write endpoint reads dry_run and idempotency_key; see the Write guarantees section of the introduction.

post/email-templates/create

Request

  • Base URL: https://api.reportingninja.com/v1
  • URL: https://api.reportingninja.com/v1/email-templates/create
  • Auth: HTTP bearer

Request body

namestring required

How the template is listed in the account. 2 to 50 characters, with no character above the Basic Multilingual Plane.

internal_notesstring nullable

A note for the account's own staff, at most 250 characters. An empty string takes it away.

format'plain_text' | 'html' required

Whether the body is HTML or plain text.

senderstring required

The name the email is sent under.

sender_emailstring required

The From: address. It has to be the address of a user of this account or share the domain of one, which the application does not ask for: this API sends mail on behalf of the account.

reply_to_emailstring required

Where a reply goes. The same rule as sender_email.

subjectstring required

The subject of the email. It can carry the substitution variables of a delivery; %%AI_SUMMARY%% is blanked in a subject.

bodystring required

The body of the email, HTML or plain text according to format. It is stored exactly as it is sent -- it is NOT sanitized -- and it can carry the substitution variables of a delivery. The Basic Multilingual Plane is not asked of it: the body may carry any character, emoji included.

email_template_keystring nullable

Accepted and ignored: it is part of what a read publishes and a creation has no column for, so the object /v1/email-templates/get answers can be sent straight back. It comes back as a READ_ONLY_FIELD_IGNORED warning.

dry_runboolean

Validate everything and write nothing.

idempotency_keystring

Replays the answer of an identical call for 24 hours.

Response

The call succeeded. This endpoint reports its errors with a real HTTP status, so a 200 always carries status=ok.

status'ok' required

Changes

No recorded changes to this operation across all 1 revision of this API.