Event-driven email API

Send the event.
Prepare the email.

Connect confirmed product events to approved email workflows. Your code supplies the facts; barua renders the message.

EVENT → APPROVED PLAY → EMAILFor receipts and defined order updates.

This endpoint accepts product events. It does not accept a recipient and arbitrary HTML for a direct send. Usually within hours. Check the timing limits ↓

JavaScript · Complete test request
const response = await fetch(
  "https://barua.ai/api/integrations/v1/events",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.BARUA_TEST_KEY}`,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({ records: [{
      event_id: "order_delayed:shp_9f2a:2026-10-21",
      name: "order_delayed",
      external_id: "nt_u_8812",
      occurred_at: "2026-10-14T14:40:00Z",
      properties: {
        order_id: "48213",
        order_name: "#48213",
        shipment_id: "shp_9f2a",
        carrier: "Bring",
        eta_date: "2026-10-21",
        tracking_number: "370412345678",
        tracking_url: "https://northtrail.example/orders/48213/tracking",
        line_items: [
          { name: "Charcoal wool base layer, M", quantity: 1, price: 1190 },
          { name: "Merino liner socks", quantity: 2, price: 249 }
        ]
      }
    }] })
  }
);
const receipt = await response.json();
Historical sample. Use your committed event’s ID, timestamp and customer facts.
Rendered email · Sample event
To Marte · Example emailOpen email ↗

Explore the example · Fictional brands and data · No emails sent

From the event to the email

The facts stay
with the order.

The carrier, delivery date and item names come from the event. Reusable wording surrounds the customer’s actual order details.

order_name#48213
eta_date21 October 2026
carrierBring
line_itemsThe ordered items
Before your first live event

A few things
to put in place.

Use the setup guide to connect your product and verify the test events.

Read the integration guide ↗
  1. Identify the customer. Send signed_up before the customer’s later events.
  2. Approve the event plan. Use the supported fields and your granted key permissions.
  3. Prepare the sender and Play. Verify the domain and approve the relevant email.
  4. Enable live events and sending. Check intake and delivery separately.

A few useful details.

Which service emails are supported?

Receipts and the defined order updates: shipped, delivered, delayed, canceled, and refunded. Customer password resets and login codes are not supported by this API.

How quickly does an email send?

Usually within hours. Events expire after 24 hours, and close-together orders from the same customer can produce only the latest receipt. Use this for workflows where those limits fit.

Connect the first event.

Read the integration guide, then talk to us about access for your product.

Talk to us about access ↗Read the setup guide ↗