System Events
3 API calls in this section.
List Events
/system/eventsRetrieves a paginated list of system events with optional filtering by event type, source module, target module, status, and entity type.
User must have 'manage:system' permission or be a system admin
Response
Returns a paginated list of system events
Includes pagination metadata (total count, page, limit)
Query parameters
| Parameter | Type | Description |
|---|---|---|
tenant_idOptional | string | UUID of the tenant (optional for system admins) (optional for system admins): UUID of the tenant Example: |
event_typeOptional | string | Filter by event type (optional) |
source_moduleOptional | string | Filter by source module (optional) |
target_moduleOptional | string | Filter by target module (optional) |
statusOptional | string | Filter by event status (optional, |
entity_typeOptional | string | Filter by entity type (optional) |
pageOptional | string | Page number for pagination (optional, default: 1) Page number for pagination (default: 1) Example: |
limitOptional | string | Number of items per page (optional, default: 100) Number of items per page (default: 100) Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
Content-Type | string | Example: |
1curl --globoff --request GET "https://staging-api.ondi.io/functions/v1/system/events?tenant_id=${TENANT_ID}&event_type=&source_module=&target_module=&status=&entity_type=&page=1&limit=100" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3 --header "Content-Type: application/json"Response examples
1{2 "success": true,3 "message": "Events retrieved successfully",4 "events": [5 {6 "id": "event-uuid-1",7 "tenant_id": "tenant-uuid",8 "event_type": "inventory_updated",9 "source_module": "inventory",10 "target_module": "warehouse",11 "entity_type": "inventory_item",12 "entity_id": "item-uuid-1",13 "event_data": {14 "previous_quantity": 100,15 "new_quantity": 95,16 "warehouse_id": "warehouse-uuid-1"17 },18 "status": "processed",19 "retry_count": 0,20 "created_at": "2023-04-01T10:00:00Z",21 "processed_at": "2023-04-01T10:01:00Z",22 "error_message": null23 },24 {25 "id": "event-uuid-2",26 "tenant_id": "tenant-uuid",27 "event_type": "delivery_assigned",28 "source_module": "logistics",29 "target_module": "notifications",30 "entity_type": "delivery",31 "entity_id": "delivery-uuid-1",32 "event_data": {33 "driver_id": "driver-uuid-1",34 "delivery_date": "2023-04-05T09:00:00Z"35 },36 "status": "pending",37 "retry_count": 0,38 "created_at": "2023-04-01T11:30:00Z",39 "processed_at": null,40 "error_message": null41 }42 ],43 "page": 1,44 "limit": 100,45 "total": 246}Publish Event
/system/eventsCreates a new system event for inter-module communication. Events are used to notify other modules about changes or actions that occurred in the system.
Must have system-generated token OR 'manage:system' permission or be a system admin
Business Rules
event_datamust be a valid JSON objectAll required fields must be provided
Event is created with status 'pending' and
retry_countof 0
Query parameters
| Parameter | Type | Description |
|---|---|---|
tenant_idOptional | string | UUID of the tenant (optional if in auth context) (optional if in auth context): UUID of the tenant Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
Content-Type | string | Example: |
Body parameters
| Parameter | Type | Description |
|---|---|---|
event_type | string | — |
source_module | string | — |
target_module | string | — |
entity_type | string | — |
entity_id | string | — |
event_data | object | — |
event_data.previous_quantity | number | — |
event_data.new_quantity | number | — |
event_data.warehouse_id | string | — |
1curl --globoff --request POST "https://staging-api.ondi.io/functions/v1/system/events?tenant_id=${TENANT_ID}" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3 --header "Content-Type: application/json" \4 --data-raw '{5 "event_type": "inventory_updated",6 "source_module": "inventory",7 "target_module": "warehouse",8 "entity_type": "inventory_item",9 "entity_id": "{{item_id}}",10 "event_data": {11 "previous_quantity": 100,12 "new_quantity": 95,13 "warehouse_id": "{{warehouse_id}}"14 }15}'Replace {{placeholders}} with your own values before sending.
Other request examples (1)
1{2 "event_type": "string", // required - Type of event (e.g., inventory_updated, delivery_assigned)3 "source_module": "string", // required - Module that published the event4 "target_module": "string", // optional - Target module for the event5 "entity_type": "string", // required - Type of entity related to the event6 "entity_id": "uuid", // required - ID of the related entity7 "event_data": {} // required - JSON object containing event payload data8}Response examples
1{2 "success": true,3 "message": "Event published successfully",4 "event": {5 "id": "event-uuid-new",6 "tenant_id": "tenant-uuid",7 "event_type": "inventory_updated",8 "source_module": "inventory",9 "target_module": "warehouse",10 "entity_type": "inventory_item",11 "entity_id": "item-uuid-1",12 "event_data": {13 "previous_quantity": 100,14 "new_quantity": 95,15 "warehouse_id": "warehouse-uuid-1"16 },17 "status": "pending",18 "retry_count": 0,19 "created_at": "2023-04-01T15:00:00Z",20 "processed_at": null,21 "error_message": null22 }23}Update Event Status
/system/events/:idUpdates the status of an existing system event. This endpoint is typically used by event processors to mark events as processed or failed.
Must have system-generated token OR 'manage:system' permission or be a system admin
Business Rules
Status must be one of: pending, processed, failed
If status is changed to 'processed' and
processed_atis not provided, current timestamp will be usedIf status is changed to 'failed',
retry_countwill be incrementedEvent must exist in the system
Path parameters
| Parameter | Type | Description |
|---|---|---|
idRequired | string | UUID of the event to update (required) Example: |
Query parameters
| Parameter | Type | Description |
|---|---|---|
tenant_idOptional | string | UUID of the tenant (optional if in auth context) (optional if in auth context): UUID of the tenant Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
Content-Type | string | Example: |
Body parameters
| Parameter | Type | Description |
|---|---|---|
status | string | — |
processed_at | string | — |
error_message | null | — |
1curl --globoff --request PUT "https://staging-api.ondi.io/functions/v1/system/events/${ID}?tenant_id=${TENANT_ID}" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3 --header "Content-Type: application/json" \4 --data-raw '{5 "status": "processed",6 "processed_at": "2023-04-01T15:05:00Z",7 "error_message": null8}'Other request examples (1)
1{2 "status": "string", // required - New status (pending, processed, failed)3 "processed_at": "string", // optional - ISO timestamp when the event was processed4 "error_message": "string" // optional - Error message if the event processing failed5}Response examples
1{2 "success": true,3 "message": "Event updated successfully",4 "event": {5 "id": "event-uuid-2",6 "tenant_id": "tenant-uuid",7 "event_type": "delivery_assigned",8 "source_module": "logistics",9 "target_module": "notifications",10 "entity_type": "delivery",11 "entity_id": "delivery-uuid-1",12 "event_data": {13 "driver_id": "driver-uuid-1",14 "delivery_date": "2023-04-05T09:00:00Z"15 },16 "status": "processed",17 "retry_count": 0,18 "created_at": "2023-04-01T11:30:00Z",19 "processed_at": "2023-04-01T15:05:00Z",20 "error_message": null21 }22}