Emit a custom event

Emit a custom event

POST/api/v1/events

POST /events
curl -X POST 'https://www.unitpost.com/api/v1/events' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "order.completed",
    "email": "sam@acme.com",
    "data": {
      "order_id": "ord_981",
      "total": 42.5
    },
    "idempotency_key": "ord_981"
  }'
Response · 201
{
  "object": "event",
  "id": "id_123",
  "name": "Example",
  "source": "customer",
  "contact_id": "contact_123",
  "email": "customer@example.com",
  "status": "queued",
  "warnings": [
    "string"
  ]
}

Send a custom event from your backend onto the Unitpost event bus — e.g. cart.updated or order.completed. Event names are your own bare, lowercase dotted identifiers (reserved platform prefixes like email. or contact. are rejected); deliveries carry source: "customer" so they're always distinguishable from built-in platform events. Link the event to a contact with email and/or contact_id, and pass an idempotency_key to make retried requests emit exactly once. Webhook endpoints subscribed to the event name receive it (see Create a webhook endpoint), and it can trigger automations. New event names are registered to your workspace vocabulary automatically on first use. An event starts a run in every live automation whose custom-event trigger names it, resumes runs waiting for it, and can meet a goal. Each automation's policy decides who starts: one live run per person at a time by default (maxConcurrentRunsPerSubject; a journey that tells runs apart by the event's own data allows up to 10), its re-entry rule, and no_consent: no run starts for a person every message of the journey would skip for consent, and nothing is billed (guard_trips.no_consent in the stats). So it can send: emit a test event only when that is what you want. An email no contact has becomes a contact when a live automation that needs one starts from the event (subscribed, its address's consent source event, no topic choices, counted against the plan's contacts); create_contact: false opts out and the answer's warnings says so. At the contact limit nothing is made and no run starts. Requires the events:emit capability.

Request body6 fields
FieldTypeDescription
namerequiredstring—
dataobject—
emailstring—
contact_idstring—
idempotency_keystring—
create_contactboolean—
Response · 201 fields8 fields
FieldTypeDescription
objectrequiredstring—
idrequiredstring—
namerequiredstring—
sourcerequiredstring—
contact_idrequiredstring | null—
emailrequiredstring | null—
statusrequiredstring—
warningsrequiredstring[]Said when `email` isn't a contact yet: with `create_contact` left out, a live automation that sends to or reads the contact makes it one (subscribed) when this event starts it; with `create_contact: false`, no contact is made and those automations start nothing. Empty otherwise.
201401403404422502

Search docs and guides

Search the docs and product guides.