Transactional Messages API

These are the Transactional Messages endpoints of the Keila API. For Keila Cloud, the base URL is https://app.keila.io.

All endpoints, unless stated differently, require Bearer authentication.

Transactional Messages are sent to a single recipient and used for things like receipts, account confirmations, or password resets.

post /api/v1/messages

Send a transactional message

Sends a one-off transactional email.

You can use an existing contact as the recipient by supplying the contact_id or external_contact_id field.

Alternatively, you can specify recipient_email to send the message to a recipient who might not be in your contact list. If there is a matching contact in your project, the message will be linked to that contact and contact data will be available in the message.

The message body must either come from the referenced template (via template_id) or be supplied in the request (e.g. mjml_body, html_body, or text_body depending on type).

Request body

  • dataobject
    • assignsobject

      Values made available to Liquid interpolation in the subject and body.

      Example: {"magic_link":"https://example.com/..."}

    • bccstring | string[]

      BCC recipients as an RFC 5322 address list (see cc).

      Example: "jane@example.com"

    • ccstring | string[]

      CC recipients as an RFC 5322 address list, e.g. Jane <jane@example.com>, john@example.com. May also be given as a JSON array of such strings.

      Example: "Jane <jane@example.com>, john@example.com"

    • contact_idstring

      Example: "nc_12345"

    • external_contact_idstring

      Example: "customer-1234"

    • html_bodystring

      Example: "<p>Hi {{ contact.first_name }}, thanks for your order.</p>"

    • html_contentobject

      Map of named content slots for HTML templates that declare slots.

      Example: {"main":"<p>Hi {{ contact.first_name }}!</p>"}

    • mjml_bodystring

      Example: "<mjml><mj-body><mj-section><mj-column><mj-text>Hi!</mj-text></mj-column></mj-section></mj-body></mjml>"

    • mjml_contentobject

      Map of named content slots for MJML templates that declare slots.

      Example: {"main":"<mj-section><mj-column><mj-text>Hi {{ contact.first_name }}!</mj-text></mj-column></mj-section>"}

    • recipient_emailstring

      Example: "jane.doe@example.com"

    • recipient_namestring

      Example: "Jane Doe"

    • sender_idstring required

      Example: "ms_12345"

    • subjectstring

      Example: "Your order is confirmed"

    • template_idstring

      Example: "ntpl_12345"

    • text_bodystring

      Example: "Hi {{ contact.first_name }}, thanks for your order."

    • text_contentobject

      Map of named content slots for text templates that declare slots.

      Example: {"main":"Hi {{ contact.first_name }}!"}

    • type"text" | "html" | "mjml" required

      Example: "html"

Responses

200 Message response

  • dataobject
    • idstring

      Message ID

      Example: "nmr_12345"

    • recipient_emailstring

      Example: "jane.doe@example.com"

    • subjectstring

      Example: "Your order is confirmed"

post /api/v1/messages/actions/render

Render a transactional message

Renders a transactional message without sending it and returns the rendered subject, html_body, and text_body.

Takes the same parameters as the endpoint for sending a message.

Request body

  • dataobject
    • assignsobject

      Values made available to Liquid interpolation in the subject and body.

      Example: {"magic_link":"https://example.com/..."}

    • bccstring | string[]

      BCC recipients as an RFC 5322 address list (see cc).

      Example: "jane@example.com"

    • ccstring | string[]

      CC recipients as an RFC 5322 address list, e.g. Jane <jane@example.com>, john@example.com. May also be given as a JSON array of such strings.

      Example: "Jane <jane@example.com>, john@example.com"

    • contact_idstring

      Example: "nc_12345"

    • external_contact_idstring

      Example: "customer-1234"

    • html_bodystring

      Example: "<p>Hi {{ contact.first_name }}, thanks for your order.</p>"

    • html_contentobject

      Map of named content slots for HTML templates that declare slots.

      Example: {"main":"<p>Hi {{ contact.first_name }}!</p>"}

    • mjml_bodystring

      Example: "<mjml><mj-body><mj-section><mj-column><mj-text>Hi!</mj-text></mj-column></mj-section></mj-body></mjml>"

    • mjml_contentobject

      Map of named content slots for MJML templates that declare slots.

      Example: {"main":"<mj-section><mj-column><mj-text>Hi {{ contact.first_name }}!</mj-text></mj-column></mj-section>"}

    • recipient_emailstring

      Example: "jane.doe@example.com"

    • recipient_namestring

      Example: "Jane Doe"

    • sender_idstring required

      Example: "ms_12345"

    • subjectstring

      Example: "Your order is confirmed"

    • template_idstring

      Example: "ntpl_12345"

    • text_bodystring

      Example: "Hi {{ contact.first_name }}, thanks for your order."

    • text_contentobject

      Map of named content slots for text templates that declare slots.

      Example: {"main":"Hi {{ contact.first_name }}!"}

    • type"text" | "html" | "mjml" required

      Example: "html"

Responses

200 Renderer output

  • dataobject
    • html_bodystring

      Example: "<p>Hi {{ contact.first_name }}, thanks for your order.</p>"

    • subjectstring

      Example: "Your order is confirmed"

    • text_bodystring

      Example: "Hi {{ contact.first_name }}, thanks for your order."