---
title: Subscription
description: Subscription protocol schemas
---

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

Subscription Event Type

Event types that can be subscribed to for record-level notifications.

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

## TypeScript Usage

```typescript
import { RecordSubscription, SubscriptionEventType } from '@objectstack/spec/data';
import type { RecordSubscription, SubscriptionEventType } from '@objectstack/spec/data';

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

---

## RecordSubscription

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **object** | `string` | ✅ | Object name |
| **recordId** | `string` | ✅ | Record ID |
| **userId** | `string` | ✅ | Subscribing user ID |
| **events** | `Enum<'comment' \| 'mention' \| 'field_change' \| 'task' \| 'approval' \| 'all'>[]` | ✅ | Event types to receive notifications for |
| **channels** | `Enum<'in_app' \| 'email' \| 'push' \| 'slack'>[]` | ✅ | Notification delivery channels |
| **active** | `boolean` | ✅ | Whether the subscription is active |
| **createdAt** | `string` | ✅ | Subscription creation timestamp |


---

## SubscriptionEventType

### Allowed Values

* `comment`
* `mention`
* `field_change`
* `task`
* `approval`
* `all`


---

