---
title: "Emit a custom event"
description: "Send a custom event from your backend onto the Unitpost event bus — e.g. `POST /api/v1/events`"
url: https://www.unitpost.com/docs/automations/post-events
section: "Automations API reference"
updated: 2026-12-01
---
# Emit a custom event

`POST /api/v1/events`

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](https://www.unitpost.com/docs/platform/post-webhooks)), 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 body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes | — |
| `data` | object | no | — |
| `email` | string | no | — |
| `contact_id` | string | no | — |
| `idempotency_key` | string | no | — |
| `create_contact` | boolean | no | — |

## Response fields (201)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | string | yes | — |
| `id` | string | yes | — |
| `name` | string | yes | — |
| `source` | string | yes | — |
| `contact_id` | string \| null | yes | — |
| `email` | string \| null | yes | — |
| `status` | string | yes | — |
| `warnings` | string[] | yes | 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. |

## Responses

| Status | Description |
| --- | --- |
| 201 | Queued onto the event bus. |
| 401 | Missing or invalid API key. |
| 403 | Insufficient scope (a Sending key created before automations launched doesn't include `events:emit`: create a new Sending key), or a new name past the workspace's 500 event names (`limit_reached`, detail `event_name_limit`). Names can't be deleted yet: reuse one, or contact support. |
| 404 | contact_id doesn't match a contact in this workspace. |
| 422 | Validation error (reserved/invalid event name, mismatched email + contact_id, …). |
| 502 | Couldn't reach the mailing engine. |

## Example request

```bash
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"
  }'
```

## Example response (201)

```json
{
  "object": "event",
  "id": "id_123",
  "name": "Example",
  "source": "customer",
  "contact_id": "contact_123",
  "email": "customer@example.com",
  "status": "queued",
  "warnings": [
    "string"
  ]
}
```

## Links

- HTML reference (with Node.js, Python, Ruby, PHP, Laravel, Go, Java, Rust, .NET and CLI examples): https://www.unitpost.com/docs/automations/post-events
- OpenAPI 3.1 (full schemas): https://www.unitpost.com/api/v1/openapi.json
