Custom Events
Core events ship with epilot and are identical in every organization. Custom events are authored by your organization: you choose the entity the event is about, the related data it carries, and each payload field β projected from your own entity attributes.
This matters because a built-in event cannot read attributes that only your organization has. If your service team tracks an installment change on a ticket attribute called neuer_abschlagsbetrag_in_eur, no shared built-in can project it. A custom event can, and once published it behaves exactly like a core event: the same trigger sources, the same payload envelope, the same JSON Schema endpoints, and the same webhook and automation integrations.
Built-in and custom events comparedβ
| Core (built-in) events | Custom events | |
|---|---|---|
| Defined by | epilot | Your organization |
| Visible to | Every organization | Your organization only |
| Payload fields | Fixed by epilot | Authored by you, projected from entity data |
| Versions | Multiple versions, with downgrade chains | Fixed at 1.0 |
| Definition changes | Released by epilot | Immutable after publishing |
event_origin | builtin | custom |
| Tagged | builtin | custom |
Built-in names always win a collision: an event name already used by a built-in cannot be claimed as a custom event.
Anatomy of a custom eventβ
A custom event definition has four parts. The Event Catalog API stores them together as one immutable definition.
Root entityβ
Every custom event is built from exactly one root entity β a graph node with cardinality: one. The root is what an entity-change trigger watches, what an API or Automation trigger seeds the event from, and the starting point for related data. It is chosen once and cannot change afterwards.
Entity graphβ
entity_graph describes which entities the event carries. Nodes are entity schemas, edges follow the relation attributes those schemas define:
{
"entity_graph": {
"nodes": [
{ "id": "ticket", "schema": "ticket", "cardinality": "one" },
{ "id": "contract", "schema": "contract", "cardinality": "one" },
{ "id": "contact", "schema": "contact", "cardinality": "one", "fields": ["email", "first_name", "last_name"] }
],
"edges": [
{ "from": "ticket", "to": "contract" },
{ "from": "ticket", "to": "contact" }
]
}
}
When the event fires, epilot hydrates this graph and puts each node into the payload under its node ID. fields narrows a node to the listed attributes (plus the internal _id, _schema and _org); omit it to include everything.
Payload fields and projectionβ
schema_fields defines the event's own payload fields. Each field carries a JSON Schema type and a graph_source β a JSONata expression evaluated against the hydrated graph, where every node is available under its node ID:
{
"schema_fields": {
"installment_amount": {
"json_schema": { "type": "number" },
"required": true,
"graph_source": "ticket.neuer_abschlagsbetrag_in_eur"
},
"contract_number": {
"json_schema": { "type": "string" },
"graph_source": "contract.contract_number"
},
"change_reason": {
"json_schema": { "type": "string" },
"graph_source": "ticket.sonstiger_grund ? ticket.sonstiger_grund : ticket.aenderungsgrund"
}
}
}
Because graph_source is a full JSONata expression, it also covers type coercion ($number(ticket.value)), constants ('EUR'), fallbacks and conditionals.
Field types must match the stored valuesβ
Every projected value is validated against its field's json_schema before the event is sent. The type must match what the entity actually stores: a customer number saved as the number 4711 does not pass a field declared "type": "string", and the event is rejected instead of published. Either declare the stored type, or convert the value in the expression ($string(contact.customer_number)). Preview names such a mismatch: customer_number must be string, but the value is a number.
A field whose expression finds no value is left out of the payload. That is valid for an optional field; a required field without a value fails validation. Preview lists every left-out field as a warning, so you can tell an entity that has no value from a mapping that reads the wrong attribute.
Custom event fields are always projected from the entity graph. Unlike some built-ins, a custom event never accepts caller-supplied field values β a fields object sent to the trigger endpoint is ignored.
Mapping modesβ
| Mode | How the payload is produced |
|---|---|
guided (default) | Every field in schema_fields needs its own graph_source. Recommended. |
jsonata | One JSONata expression in mapping.jsonata returns the complete payload object. schema_fields still defines the schema the result is validated against. |
In jsonata mode the expression is evaluated against the hydrated nodes plus an operation object holding the entity-operation context. It must return an object, and it cannot write system-owned fields.
Entity data or mapped fields onlyβ
mapping.payload decides whether the hydrated entities travel with the event:
mapping.payload | Builder option | What the event carries |
|---|---|---|
extend (default) | Add to the entity data | Your fields, followed by every graph node: the root entity and its related entities, with all their attributes unless a node lists fields. |
replace | Only the mapped fields | Only your fields. The graph is still hydrated to compute them, but no node is sent. |
{
"mapping": { "mode": "guided", "payload": "replace" }
}
Good to know
With extend, consumers receive the hydrated entities, which can include personal data such as birth dates, addresses or consents. Most integrations need this: the receiving system gets the full picture and new attributes arrive without a new event version. To keep the entity data but leave attributes out, narrow a node with fields. If the receiving system should only get specific values, use replace and map exactly those fields.
The choice is part of the published definition: later versions keep what the event carries, because consumers already parse it.
Triggersβ
A custom event needs at least one trigger source. They combine freely, except where noted:
| Source | Config | What it does |
|---|---|---|
| Entity changes | entity_operation | Fires when an entity of the root schema is created or updated. Optional attribute and purpose_filters narrow it. |
| API | api_trigger: true | Allows an integration to fire the event explicitly via POST /v1/events/{event_name}:trigger. |
| Automation | automation_trigger: true | Offers the event in the automation builder's Trigger Event action. |
entity_operation supports createEntity and updateEntity. deleteEntity is not available for custom events.
Purposes are filtered by stable taxonomy classification IDs (purpose_filters), not by classification names, so renaming a classification does not break the trigger. Each filter also carries a display_name snapshot for display.
Setting automation_trigger_only: true restricts triggering to Automation with durable delivery and strict entity-readiness checks. It requires automation_trigger: true, api_trigger: false, no entity_operation, and an automation_trigger_seed_node naming a cardinality: one graph node.
The published payloadβ
A custom event payload is assembled in this order, with later parts overriding earlier ones: common metadata, the entity-operation context (entity triggers only), the hydrated graph nodes, then your projected fields. With mapping.payload: replace the graph nodes are left out.
{
"_org_id": "739224",
"_event_time": "2026-01-15T10:30:00.000Z",
"_event_id": "01JHQ8EWG7CKF2ATJTX0000000",
"_event_name": "InstallmentChangeRequested",
"_event_version": "1.0",
"_event_source": "entity",
"_ack_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"_trigger_source_type": "operation",
"_trigger_source": "0f2c1b6e-8d4a-4f52-9a1e-5c7d2b3e4f10",
"operation": "createEntity",
"trigger_entity": "9b1c7d2e-4a5f-4c83-9e61-7d0a2f3b5c48",
"activity_id": "6d3e9a1b-2c47-4f8e-b512-8a9c0d1e2f34",
"activity_type": "EntityCreated",
"ticket": { "_id": "9b1c7d2e-4a5f-4c83-9e61-7d0a2f3b5c48", "_schema": "ticket", "...": "..." },
"contract": { "_id": "4e8a0c6b-1d39-4b27-8f54-2a6c9e0d7b13", "_schema": "contract", "...": "..." },
"contact": { "_id": "7c5b2a1f-9e04-4d6a-83c2-1b4e6f8a0d95", "_schema": "contact", "...": "..." },
"installment_amount": 42.5,
"contract_number": "V-2026-00193",
"change_reason": "Verbrauch gestiegen"
}
_event_source is entity for entity-change triggers, and the caller's _trigger_source_type (default api) for explicit triggers. The operation / trigger_entity / activity_id / activity_type block is present only for entity-change triggers. See Core Events for the common metadata fields.
Build a custom event in epilot 360β
Open Event Catalog in epilot 360 and choose Create event. The builder is a five-step wizard; Save draft at any point persists your work.
- Event details β start from scratch or derive from a built-in event, then set the API name, title and description. The API name is reserved as soon as the draft is saved, so a late collision cannot cost you the rest of the work.
- Triggers β choose the root entity, then enable API, Automation and/or entity changes. For entity changes, pick create and/or update and optionally narrow by changed attributes and purposes.
- Related data β expand the root entity along the relation attributes its schema defines, and choose whether each node carries all attributes or only selected ones.
- Payload β add payload fields and map each one to entity data, or switch to a single JSONata expression, and choose whether the event adds your fields to the entity data or carries only them. A live preview renders the resulting event from generated sample data or from a real entity of the root schema: search it by name or paste its ID. The entity must belong to the organization you build the event in. The preview flags values whose type does not match their field and lists the fields the sample has no value for.
- Preview and publish β review the assembled event and publish version 1.0.
Lifecycleβ
| State | event_status | Fires? | What you can do |
|---|---|---|---|
| Draft | draft | No | Edit the whole definition, preview it, publish it, or discard it. Not offered to webhooks or automations. |
| Active | active | Yes | Enable/disable it and pause its automatic trigger. The definition itself is immutable. |
| Deprecated | deprecated | Never again | Read the definition and its event history. The name stays reserved and cannot be reused. |
Three rules follow from this:
- A draft is not immutable. It has no consumers yet, so
PUT /v1/events/{event_name}replaces its whole definition. The event name is its identity and cannot change. - Publishing freezes version 1.0. After publishing, only the activation overlay β
enabled,auto_triggerandsuccess_criteriaβ can change, throughPATCH /v1/events/{event_name}. - Deprecation is one-way. A deprecated event is disabled, never fires again, and cannot be restored.
Status, enabled and auto_triggerβ
Three fields describe an event's state. They answer different questions:
| Field | Question it answers |
|---|---|
event_status | Where is the definition in its lifecycle? draft, active or deprecated. |
enabled | Is the event switched on for your organization? A disabled event does not fire, and an explicit trigger returns 403. |
auto_trigger | Do entity changes fire it automatically? With false it fires only when triggered explicitly through the API or an Automation. Always false for Automation-only events. |
A draft always reads event_status: draft, enabled: false and auto_trigger: false, and that is what the create and replace responses show. These values describe the draft, not the event you publish: publishing sets enabled and auto_trigger (both default to true) and event_status becomes active. A response saved before publishing keeps the draft values, so read the current state with GET /v1/events/{event_name}.
Derive from a built-in eventβ
A custom event can start from a built-in definition and keep a recorded link to it (lineage). This is how you adapt a built-in to your organization's own attributes without forking it.
The derived event is a separate, independently named event. The built-in is neither modified nor replaced.
What you inherit, you cannot loosen. The base event's version is pinned in lineage.base_event_version and validated against the registered built-in, and its trigger restrictions carry over:
- The inherited entity trigger cannot be removed, replaced or narrowed. You may add watched attributes and purposes as OR alternatives, but an inherited trigger that watches all attributes or all purposes cannot be narrowed.
- An inherited Automation-only trigger, including its seed node, cannot be changed.
- Built-in attachment fields cannot be authored, so built-ins that use them cannot be derived.
- Built-ins triggering on
deleteEntity, on several schemas at once, or without an entity graph cannot be derived.
Because both events now match the same entity changes, publishing a derived event offers to switch off the base event's automatic trigger for your organization (base_auto_trigger_enabled: false). The base event stays in the catalog; only its org-level auto-trigger is turned off.
Consume a custom eventβ
A published custom event is a first-class catalog event, so everything that consumes core events consumes it too.
Webhooksβ
Subscribe a webhook to the trigger event_<EventName> β for example event_InstallmentChangeRequested. The event detail view lists the webhooks already subscribed to the event and links straight to creating another. Payloads arrive in the Event Catalog envelope described above. See Webhooks.
Automationsβ
Two integrations, in both directions:
- With
automation_trigger: true, the event appears in the automation builder's Trigger Event action, so a flow can fire it. - Any automation flow can use the event as its own trigger. The event detail view lists the flows already triggered by the event.
Event history and schemaβ
GET /v1/events/{event_name}/json_schema and GET /v1/events/{event_name}/example work for custom events exactly as for built-ins, and delivered events are searchable in the event history.
Build a custom event with the APIβ
Every call below β creating, previewing, publishing, triggering and deprecating β requires the event_catalog:manage grant action. Reading event definitions requires event_catalog:view.
1. Create the draftβ
curl -X POST https://event-catalog.sls.epilot.io/v1/events \
-H "Authorization: Bearer $EPILOT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"event_name": "InstallmentChangeRequested",
"event_title": "Installment change requested",
"event_description": "A customer requested a new installment amount.",
"entity_graph": {
"nodes": [
{ "id": "ticket", "schema": "ticket", "cardinality": "one" },
{ "id": "contract", "schema": "contract", "cardinality": "one" }
],
"edges": [{ "from": "ticket", "to": "contract" }]
},
"entity_operation": {
"operation": ["createEntity"],
"schema": ["ticket"],
"purpose_filters": [
{ "id": "aenderung-abschlag", "display_name": "Γnderung Abschlag" }
]
},
"schema_fields": {
"installment_amount": {
"json_schema": { "type": "number" },
"required": true,
"graph_source": "ticket.neuer_abschlagsbetrag_in_eur"
},
"contract_number": {
"json_schema": { "type": "string" },
"graph_source": "contract.contract_number"
}
},
"mapping": { "mode": "guided" },
"api_trigger": true,
"automation_trigger": true
}'
The response is the stored definition with event_status: "draft", event_version: "1.0" and event_origin: "custom". A name already taken by a built-in or by another event in your organization returns 409.
To change a draft, send the complete definition again with PUT /v1/events/InstallmentChangeRequested. The body's event_name must match the path.
2. Preview it against a real entityβ
Preview runs the same hydration and projection the producer runs, so what you see is what will be published, and it fails wherever publishing would fail. It does not publish anything.
A custom event belongs to the organization that created it. The seed must be an entity of that same organization, with the seed node's schema: an ID copied from another organization or sandbox is not found. The seed node cannot be listed in skip_hydration, because the event is built from it.
curl -X POST "https://event-catalog.sls.epilot.io/v1/events/InstallmentChangeRequested:preview" \
-H "Authorization: Bearer $EPILOT_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "seed": { "entity_id": "9b1c7d2e-4a5f-4c83-9e61-7d0a2f3b5c48", "node_id": "ticket" } }'
A successful preview returns the payload plus warnings: what this sample leaves out without failing. Optional fields without a value are listed by field name; while the event carries the entity data, related entities the sample does not have are listed by node ID. Warnings never block publishing.
{
"payload": { "_event_name": "InstallmentChangeRequested", "installment_amount": 42.5, "...": "..." },
"errors": [],
"warnings": [
{
"path": "change_reason",
"message": "has no value on this sample (ticket.sonstiger_grund ? ticket.sonstiger_grund : ticket.aenderungsgrund), so the field is left out of the event"
}
]
}
Anything that would stop the event returns 400. issues names each problem; error summarises them:
| Problem | error starts with | issues[].path |
|---|---|---|
| The seed is not an entity of this organization | Seed entity not found in this organization | seed.entity_id |
| The seed is an entity of another schema | Seed entity has the wrong schema | seed.entity_id |
| A value does not match its field type, or a required field has no value | Custom event payload failed JSON Schema validation | the field, for example customer_number |
| An expression fails | Custom event projection failed | the field, or mapping.jsonata in jsonata mode |
{
"status": 400,
"error": "Custom event payload failed JSON Schema validation: customer_number must be string, but the value is a number",
"issues": [
{ "path": "customer_number", "message": "must be string, but the value is a number" }
]
}
Messages name the type that was found or the reason an expression failed, never the value itself.
3. Publish version 1.0β
curl -X POST "https://event-catalog.sls.epilot.io/v1/events/InstallmentChangeRequested:publish" \
-H "Authorization: Bearer $EPILOT_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "enabled": true, "auto_trigger": true }'
Add "base_auto_trigger_enabled": false to switch off the lineage base event's automatic trigger at the same time. Publishing an event that is no longer a draft returns 409.
4. Trigger it explicitlyβ
curl -X POST "https://event-catalog.sls.epilot.io/v1/events/InstallmentChangeRequested:trigger" \
-H "Authorization: Bearer $EPILOT_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "seed": { "entity_id": "9b1c7d2e-4a5f-4c83-9e61-7d0a2f3b5c48", "node_id": "ticket" } }'
The seed is required, because a custom event always projects from a hydrated graph, and like in preview it must be an entity of your organization. Any fields you send are ignored. Invalid input returns 400 with issues, in the same shape as preview.
Deprecate itβ
curl -X DELETE "https://event-catalog.sls.epilot.io/v1/events/InstallmentChangeRequested" \
-H "Authorization: Bearer $EPILOT_TOKEN"
This is a soft deprecation: the event is disabled and never fires again, while its definition and history stay readable and its name stays reserved.
Referenceβ
Naming and limitsβ
| Field | Rule |
|---|---|
event_name | ^[A-Z][A-Za-z0-9]{2,79}$ β PascalCase, 3β80 characters. Immutable. |
event_title | 1β160 characters |
event_description | Up to 2000 characters |
Graph node id | ^[a-z][A-Za-z0-9_]{0,63}$, unique within the graph |
mapping.jsonata | Up to 20000 characters |
| Payload field names | Start with a letter, then letters, digits or underscores. Must not start with _, collide with a graph node ID, or use a reserved name. |
Reserved payload field namesβ
These are owned by the platform and cannot be used as payload field names, nor written by a JSONata mapping:
_org_id, _event_time, _event_id, _event_name, _event_version, _event_source, _ack_id, _downgrades, operation, trigger_entity, activity_id, activity_type
Any name starting with _event_ is reserved as well.
What the API validatesβ
A definition is rejected unless all of the following hold:
- The entity graph has at least one node and at least one
cardinality: onenode. - Node IDs are unique and well-formed, and every edge connects defined nodes.
- In
guidedmode, every field has agraph_source; injsonatamode,mapping.jsonatais present. Every expression compiles, and everyjson_schemais a valid JSON Schema. - An entity trigger uses only
createEntity/updateEntity, and its schema has exactly one matchingcardinality: onenode to seed from. - Purposes use
purpose_filterswith non-empty stable IDs and display names β plainpurposenames are accepted only when inherited unchanged from a pinned built-in version. - At least one trigger source is enabled, and Automation-only rules hold where they apply.
- No field is reserved, collides with a node ID (allowed with
mapping.payload: replace, where no node is sent), or uses built-in attachment semantics. - The canonical example generated from the definition validates against the event's own JSON Schema.
Validation failures return 400 with issues: one { "path", "message" } entry per problem, each naming the path that failed, for example schema_fields.customer_number.graph_source.
Current limitationsβ
- Custom events are fixed at version
1.0, and a published definition cannot be edited. To change one, publish a new event and deprecate the old one. - Entity triggers cover
createEntityandupdateEntityonly. - Attachment fields (
event_attachments) are built-in only. - Payload fields are flat: a nested object or array is passed through whole from an entity attribute rather than authored item by item.
- A custom event is visible only inside the organization that authored it. Event definitions are not among the resources blueprints carry, so a custom event is recreated per organization rather than distributed with a blueprint.