Audit
SDK methods for dispatching federated audit events into the trace pipeline.
The client.audit namespace dispatches audit events into PlatformXe's federated trace pipeline. Available in TypeScript, Python, and Go SDKs.
| SDK | Install | Namespace |
|---|---|---|
| TypeScript | npm install @caldera/platformxe-sdk | client.audit |
| Python | pip install platformxe | client.audit |
| Go | go get github.com/calderax/platformxe-go | client.Audit |
Log an audit event
Events are accepted asynchronously (HTTP 202) and durably recorded by the inngest worker.
await client.audit.log({
app: 'lettings',
actorId: 'user_123',
entityType: 'BOOKING',
entityId: 'bk_abc',
action: 'CONFIRMED',
metadata: { propertyId: 'prop_xyz', amount: 50000 },
});
client.audit.log(
app="lettings",
actor_id="user_123",
entity_type="BOOKING",
entity_id="bk_abc",
action="CONFIRMED",
)
err := client.Audit.Log(px.AuditLogRequest{
App: "lettings",
ActorID: "user_123",
EntityType: "BOOKING",
EntityID: "bk_abc",
Action: "CONFIRMED",
})
Request fields
| Field | Type | Description |
|---|---|---|
app | string | Source application emitting the event (lettings, concierge, xadmin). |
actorId | string | Stable identifier of the actor performing the action. |
entityType | string | Polymorphic entity kind (BOOKING, PROPERTY, USER). |
entityId | string | Stable identifier of the entity. |
action | string | Verb describing the action (CREATED, APPROVED, CANCELLED). |
metadata | Record<string, unknown> (optional) | Free-form structured context persisted with the event. |
occurredAt | string (optional) | ISO 8601 timestamp. Defaults to server-side new Date(). |
Scopes required
| Method | Scope |
|---|---|
audit.log() | audit:write |