messaging_templates

Send a transactional email

Changed on

Send one transactional email from this template to one recipient. The template must be made transactional first. message_data fills the template's {{ variables.* }} placeholders. Transactional emails skip opt-outs and frequency caps. Send an Idempotency-Key header to retry safely without sending the email twice.

post/api/projects/{project_id}/messaging_templates/{id}/send/

Request

  • Base URL: https://us.posthog.com
  • URL: https://us.posthog.com/api/projects/{project_id}/messaging_templates/{id}/send/
  • Auth: HTTP bearer

Path parameters

idstring uuid required

A UUID string identifying this message template.

project_idstring required

Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.

Headers

Idempotency-Keystring

A unique key for this email, 1 to 255 visible ASCII characters. Retrying with the same key and the same request within 24 hours sends nothing new and returns the first send's message_id. Reusing a key for a different request returns a 422.

Request body

tostring email required

Email address of the recipient.

message_dataobject

Data for the template's Liquid placeholders, available as variables. For example {"reset_link": "https://..."} fills {{ variables.reset_link }}.

Response

Email queued

message_idstring required

ID of the queued send. Delivery and engagement are reported against the template asynchronously.

replayedboolean required

True when an earlier request with the same Idempotency-Key already queued this email. No new email was sent, and message_id is the earlier send's ID.

Changes

    • info

      added the new optional header request parameter Idempotency-Key

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the required property to the response with the status

    • info

      endpoint added