Events
SDK methods for event ingestion, querying, subscriptions, and replay.
The client.events namespace provides typed methods for ingesting custom events, querying the event log, and managing event subscriptions with replay support. Available in TypeScript, Python, and Go SDKs.
| SDK | Install | Namespace |
|---|---|---|
| TypeScript | npm install @caldera/platformxe-sdk | client.events |
| Python | pip install platformxe | client.events |
| Go | go get github.com/calderaxe/platformxe-go | client.Events |
Ingest an event
Send an event to the workflow engine: POST /api/v1/events. The body is eventType (one of the Workflow Event Types, such as BOOKING_CONFIRMED), and optionally entityType (an entity type, such as BOOKING), entityId, entityData (your own parameters: the fields your trigger conditions and action templates read; for a business event type PlatformXe defines no fields; may be {} or null for none), sourceApp (your key's caller service when absent) and metadata. An event type that is not on that page, or an unknown entity type, is 400 VALIDATION_ERROR (the message links the page; it never lists the values), and a body that is not JSON 400 INVALID_BODY. Your key's organisation and caller service decide which triggers run, never the body.
The answer is the engine's outcome: eventType, entityType, entityId, sourceApp, triggersEvaluated, triggersMatched, triggersExecuted, and one results item per trigger evaluated (triggerId, triggerName, matched, executed, and executionId, skippedReason or error when set). A failure in the engine is 500 EXECUTION_ERROR.
const result = await client.events.ingest({
eventType: 'BOOKING_CONFIRMED',
entityType: 'BOOKING',
entityId: 'BK-2026-00451',
entityData: {
guestName: 'Ade Bakare',
checkIn: '2026-05-01',
propertyId: 'prop-123',
},
});
console.log(result.triggersMatched, result.triggersExecuted);
result = client.events.ingest(
"BOOKING_CONFIRMED",
entity_type="BOOKING",
entity_id="BK-2026-00451",
entity_data={
"guestName": "Ade Bakare",
"checkIn": "2026-05-01",
"propertyId": "prop-123",
},
)
print(result["triggersExecuted"])
result, err := client.Events.Ingest(map[string]interface{}{
"eventType": "BOOKING_CONFIRMED",
"entityType": "BOOKING",
"entityId": "BK-2026-00451",
"entityData": map[string]interface{}{
"guestName": "Ade Bakare",
"checkIn": "2026-05-01",
"propertyId": "prop-123",
},
})
fmt.Println(result.TriggersMatched, result.TriggersExecuted)
BOOKING_CONFIRMED is a business event type: guestName, checkIn and propertyId are this example's own fields in entityData; PlatformXe defines none.
The route does not read a payload field. In every SDK payload is now a deprecated name for entityData: it is sent as entityData when entityData is absent (TypeScript 1.16.2, Python 1.13.0 and Go v1.13.0, all pending release). Before those versions, Python and Go sent payload as it was, so no trigger saw the event data, and the TypeScript SDK's ingest posted to an /ingest sub-path the API does not have (every call failed with 404). The TypeScript result's eventId and subscriptionsNotified are deprecated: the route never sends them. Ingest takes no idempotency key: if you retry a call whose answer you did not receive, a trigger's actions can run twice.
Query the event log
Retrieve past events with optional filters by type, entity, or time range.
Fraud and compliance events are left out (a filter naming one returns none), except the operational ones listed in Fraud and compliance events, which come back with only their listed fields.
The route reads eventTypes (comma separated), from, to, page and limit, and answers { items, total, page, limit }.
const log = await client.events.log({
eventTypes: ['BOOKING_CONFIRMED'],
from: '2026-04-01T00:00:00Z',
to: '2026-04-13T23:59:59Z',
page: 1,
limit: 50,
});
for (const entry of log.items) {
console.log(`${entry.eventType} at ${entry.timestamp}`);
}
log = client.events.log(
event_types=["BOOKING_CONFIRMED"],
from_="2026-04-01T00:00:00Z",
to="2026-04-13T23:59:59Z",
)
log, err := client.Events.Log(map[string]string{
"eventTypes": "BOOKING_CONFIRMED",
"from": "2026-04-01T00:00:00Z",
"to": "2026-04-13T23:59:59Z",
})
Subscriptions
List subscriptions
const { items, total } = await client.events.listSubscriptions();
result = client.events.list_subscriptions()
result, err := client.Events.ListSubscriptions()
Create a subscription
name (3 characters or more), eventTypes (a non-empty list of non-blank strings) and webhookUrl (a public https URL) are required; a new subscription is ACTIVE. The answer is { subscription, secret }: the signing secret is shown once. A subscription naming a fraud or compliance event that is never delivered is refused with 400 RESTRICTED_EVENT_TYPE (see Fraud and compliance events). GET, the list and PATCH answer restrictedEventTypes: the stored entries of an older subscription that name one (remove them with a PATCH).
const { subscription, secret } = await client.events.createSubscription({
name: 'Bookings',
eventTypes: ['BOOKING_CONFIRMED', 'BOOKING_CANCELLED'],
webhookUrl: 'https://your-app.com/events',
});
console.log(subscription.id); // "esub_abc123"
created = client.events.create_subscription(
event_types=["BOOKING_CONFIRMED", "BOOKING_CANCELLED"],
webhook_url="https://your-app.com/events",
name="Bookings",
)
sub, err := client.Events.CreateSubscription(map[string]interface{}{
"name": "Bookings",
"eventTypes": []string{"BOOKING_CONFIRMED", "BOOKING_CANCELLED"},
"webhookUrl": "https://your-app.com/events",
})
// sub.Secret holds the signing secret (returned once).
Get a subscription
const sub = await client.events.getSubscription('esub_abc123');
sub = client.events.get_subscription("esub_abc123")
sub, err := client.Events.GetSubscription("esub_abc123")
Update a subscription
Each field you send is checked as create checks it: a name that is not a string or is under 3 characters, an eventTypes that is not a non-empty list of non-blank strings, a status other than ACTIVE / PAUSED / FAILING, or an unsafe webhookUrl is 400 VALIDATION_ERROR; a restricted entry is 400 RESTRICTED_EVENT_TYPE. status: "PAUSED" stops deliveries; status: "ACTIVE" resumes them and resets the failure count. A FAILING subscription is still sent new events (through the retry sweep) and is ACTIVE again on its next success.
const updated = await client.events.updateSubscription('esub_abc123', {
eventTypes: ['BOOKING_CONFIRMED'],
status: 'PAUSED',
});
updated = client.events.update_subscription(
"esub_abc123",
eventTypes=["BOOKING_CONFIRMED"],
status="PAUSED",
)
updated, err := client.Events.UpdateSubscription("esub_abc123", map[string]interface{}{
"eventTypes": []string{"BOOKING_CONFIRMED"},
"status": "PAUSED",
})
Delete a subscription
await client.events.deleteSubscription('esub_abc123');
client.events.delete_subscription("esub_abc123")
result, err := client.Events.DeleteSubscription("esub_abc123")
Replay events
Replay previously delivered events for a subscription within a time range. Useful for recovering from downstream failures.
The body is fromTimestamp (required), toTimestamp and eventTypes (a non-empty list of non-blank strings; anything else is 400 VALIDATION_ERROR). The answer is { replayed }. One replay runs per subscription at a time (409 CONFLICT).
const replay = await client.events.replay('esub_abc123', {
fromTimestamp: '2026-04-10T00:00:00Z',
toTimestamp: '2026-04-11T00:00:00Z',
});
console.log(replay.replayed); // 42
replay = client.events.replay(
"esub_abc123",
from_date="2026-04-10T00:00:00Z",
to_date="2026-04-11T00:00:00Z",
event_types=["BOOKING_CONFIRMED"], # optional
)
replay, err := client.Events.Replay("esub_abc123", "2026-04-10T00:00:00Z", "2026-04-11T00:00:00Z")
// or client.Events.ReplayTypes(id, from, to, []string{"BOOKING_CONFIRMED"})
Python before 1.13.0 and Go before v1.13.0 sent the window as from / to, which the route does not read: every replay was a 400 VALIDATION_ERROR. Upgrade. Python before 1.13.0 also sent eventType to the event log (never read: the filter was ignored).
Event replay re-delivers events to the subscription's webhook URL. Ensure your webhook handler is idempotent to safely process replayed events. Fraud and compliance events outside the deliverable list are never replayed (replayed does not count them); the deliverable ones are re-sent with only their listed fields.
Scopes required
| Method | Scope |
|---|---|
events.ingest() | none: any valid key but an MCP key |
events.log() | events:read |
events.listSubscriptions() | events:manage |
events.createSubscription() | events:manage |
events.getSubscription() | events:manage |
events.updateSubscription() | events:manage |
events.deleteSubscription() | events:manage |
events.replay() | events:manage |