Skip to main content

Events

MethodPathScopeSDK
POST/api/v1/eventssequences:writeevents.track

One call does four things: upserts the contact, enrolls them into every active sequence whose trigger equals type, re-arms flows waiting on that event, and cancels their enrollments in the sequences you list under exitSequences.

Request

FieldTypeNotes
typestringRequired. Your event name, e.g. order.placed. Matched against each sequence's trigger.
emailstringRequired unless contactId is given; upserted if unknown.
contactIduuidAddress an existing contact instead.
dataobjectEvent payload. Available to templates and branch conditions.
exitSequencesstring[]Sequence keys to cancel active enrollments in.
curl -X POST https://mailroom.example.com/api/v1/events \
-H "Authorization: Bearer pk_live_…" \
-H "Content-Type: application/json" \
-d '{
"type": "order.placed",
"email": "ada@example.com",
"data": { "orderId": "ord_123", "total": 4200, "currency": "USD" },
"exitSequences": ["abandoned-cart"]
}'

Response

{ "ok": true, "contactId": "9f0c…", "enrolled": 1, "reArmed": 0, "exited": 1 }

Counts, not ids:

  • enrolled — new enrollments started by this event.
  • reArmed — waiting enrollments that this event advanced.
  • exited — enrollments cancelled via exitSequences.

All zeros is a normal outcome: it means no active sequence is triggered by that type. The contact upsert still happened.

Errors

StatuscodeCause
422invalid_requestMissing type, or neither email nor contactId
422reason stringThe event could not be applied (e.g. the contact is unsubscribed)
403forbiddenKey lacks sequences:write

Notes

  • Event names are free-form. Nothing validates type, so a typo silently triggers nothing — keep the string in one constant on your side.
  • Not idempotent by nature. Two identical calls can create two enrollments where re-entry allows it. Send an Idempotency-Key header when replaying.
  • Events are not analytics. Mailroom keeps them to drive automation, not to be queried back; there is no event-read endpoint.