---
title: Events
description: Events protocol schemas
---

{/* ⚠️  AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs go in content/docs/guides/. */}

Metadata Event Types

Triggered when metadata items are created, updated, or deleted.

Follows the pattern: `metadata.\{type\}.\{action\}`

Examples:

- `metadata.object.created` - A new object was created

- `metadata.view.updated` - A view was updated

- `metadata.agent.deleted` - An agent was deleted

<Callout type="info">
**Source:** `packages/spec/src/api/events.zod.ts`
</Callout>

## TypeScript Usage

```typescript
import { DataEvent, DataEventType, MetadataEventType } from '@objectstack/spec/api';
import type { DataEvent, DataEventType, MetadataEventType } from '@objectstack/spec/api';

// Validate data
const result = DataEvent.parse(data);
```

---

## DataEvent

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **id** | `string` | ✅ | Unique event identifier |
| **type** | `Enum<'data.record.created' \| 'data.record.updated' \| 'data.record.deleted' \| 'data.field.changed'>` | ✅ | Event type |
| **object** | `string` | ✅ | Object name |
| **recordId** | `string` | ✅ | Record ID |
| **changes** | `Record<string, any>` | optional | Changed fields |
| **before** | `Record<string, any>` | optional | Before state |
| **after** | `Record<string, any>` | optional | After state |
| **userId** | `string` | optional | User who triggered the event |
| **timestamp** | `string` | ✅ | Event timestamp |


---

## DataEventType

### Allowed Values

* `data.record.created`
* `data.record.updated`
* `data.record.deleted`
* `data.field.changed`


---

## MetadataEventType

### Allowed Values

* `metadata.object.created`
* `metadata.object.updated`
* `metadata.object.deleted`
* `metadata.field.created`
* `metadata.field.updated`
* `metadata.field.deleted`
* `metadata.view.created`
* `metadata.view.updated`
* `metadata.view.deleted`
* `metadata.app.created`
* `metadata.app.updated`
* `metadata.app.deleted`
* `metadata.agent.created`
* `metadata.agent.updated`
* `metadata.agent.deleted`
* `metadata.tool.created`
* `metadata.tool.updated`
* `metadata.tool.deleted`
* `metadata.flow.created`
* `metadata.flow.updated`
* `metadata.flow.deleted`
* `metadata.action.created`
* `metadata.action.updated`
* `metadata.action.deleted`
* `metadata.workflow.created`
* `metadata.workflow.updated`
* `metadata.workflow.deleted`
* `metadata.dashboard.created`
* `metadata.dashboard.updated`
* `metadata.dashboard.deleted`
* `metadata.report.created`
* `metadata.report.updated`
* `metadata.report.deleted`
* `metadata.role.created`
* `metadata.role.updated`
* `metadata.role.deleted`
* `metadata.permission.created`
* `metadata.permission.updated`
* `metadata.permission.deleted`


---

