Events — Batch
Create or delete many events in a single request.
Auth: Bearer token. Create derives each event's workspace from its pass_id; delete requires an explicit workspace_id.
Create Events in Batch
POST /wallethero-api/events/batch
Creates up to 1000 events. Each event follows the same per-category schema as single create. Returns counts plus any per-event errors.
Auth: Bearer token — workspace member (derived per event from its pass).
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
events | array<CreateEventRequest> | Yes | 1–1000 event objects |
Example Request
bash
curl -X POST "https://api.wallethero.app/wallethero-api/events/batch" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"events": [
{ "event_category": "transaction", "pass_id": "pass-1", "event_type": "purchase", "amount": 25.00, "currency": "USD" },
{ "event_category": "engagement", "pass_id": "pass-2", "event_type": "check_in", "source": "store-001" }
]
}'Response (200)
json
{
"data": {
"created": 2,
"failed": 0,
"events": [
{ "id": "event-1", "pass_id": "pass-1", "event_category": "transaction", "event_type": "purchase" },
{ "id": "event-2", "pass_id": "pass-2", "event_category": "engagement", "event_type": "check_in" }
]
}
}When some events fail, failed > 0 and an errors array is included:
json
{
"data": {
"created": 1,
"failed": 1,
"events": [ { "id": "event-1" } ],
"errors": [ { "index": 1, "error": "Invalid pass_id: pass not found" } ]
}
}| Field | Type | Description |
|---|---|---|
created | number | Events successfully created |
failed | number | Events that failed |
events | array<PassEvent> | The created events |
errors | array<{ index, error }> | Per-event failures (when failed > 0) |
SDK
typescript
const result = await wh.events.createBatch([
{ event_category: "transaction", pass_id: "pass-1", event_type: "purchase", amount: 25.0, currency: "USD" },
{ event_category: "engagement", pass_id: "pass-2", event_type: "check_in" },
]);
console.log(`Created ${result.data.created}, failed ${result.data.failed}`);Delete Events in Batch
DELETE /wallethero-api/events/batch
Deletes multiple events by ID within a workspace. Both event_ids and workspace_id are required (validated inline; a missing or non-array value returns 400).
Auth: Bearer token — workspace member (the supplied workspace_id).
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
event_ids | array<string (UUID)> | Yes | Event identifiers to delete |
workspace_id | string (UUID) | Yes | Workspace identifier |
Example Request
bash
curl -X DELETE "https://api.wallethero.app/wallethero-api/events/batch" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "workspace_id": "WORKSPACE_ID", "event_ids": ["event-1", "event-2", "event-3"] }'Response (200)
json
{ "data": { "deleted": 3 } }SDK
typescript
await wh.events.deleteBatch(["event-1", "event-2", "event-3"], "WORKSPACE_ID");Notes
- Idempotency: set
external_idon each event to dedupe against your own records. - Ordering: events within a batch are not guaranteed to be processed in order.