> ## Documentation Index
> Fetch the complete documentation index at: https://monitoryt.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# API event objects

> Understand shared event fields and type-specific response data.

Feed events form a discriminated union on the `type` field. Inspect `type` before
reading the fields unique to that event.

## Fields on every event

| Field                      | Type             | Meaning                                                       |
| -------------------------- | ---------------- | ------------------------------------------------------------- |
| `id`                       | string           | Monitor YT's 24-character event ID.                           |
| `type`                     | string           | One of the event types below.                                 |
| `createdAt`                | integer          | Observation time in Unix epoch milliseconds.                  |
| `channel.id`               | string           | Monitor YT channel ID used by the feed's `channelIds` filter. |
| `channel.youtubeChannelId` | string           | YouTube's permanent `UC…` channel ID.                         |
| `channel.title`            | string           | Current observed channel title.                               |
| `channel.thumbnailUrl`     | string or `null` | Current observed avatar URL.                                  |

Most video event types also include:

| Field                       | Type    | Meaning                                             |
| --------------------------- | ------- | --------------------------------------------------- |
| `video.youtubeVideoId`      | string  | YouTube video ID.                                   |
| `video.currentTitle`        | string  | Latest title known when the response was built.     |
| `video.currentThumbnailUrl` | string  | Latest thumbnail known when the response was built. |
| `video.publishedAt`         | integer | YouTube publish time in Unix epoch milliseconds.    |

## Video event variants

| `type`                        | Additional fields                                                                 |
| ----------------------------- | --------------------------------------------------------------------------------- |
| `video_published`             | `video.isMembersOnly`, `video.viewCount`, `video.likeCount`, `video.commentCount` |
| `title_changed`               | `oldTitle`, `newTitle`                                                            |
| `thumbnail_changed`           | `oldThumbnailUrl`, `newThumbnailUrl`                                              |
| `title_ab_test`               | `titles`                                                                          |
| `title_ab_test_concluded`     | `titles`, `finalTitle`                                                            |
| `thumbnail_ab_test`           | `thumbnailUrls`                                                                   |
| `thumbnail_ab_test_concluded` | `thumbnailUrls`, `finalThumbnailUrl`                                              |
| `members_only_changed`        | `isMembersOnly`                                                                   |

## Channel event variants

Channel events do not contain a `video` object.

| `type`                   | Additional fields                          |
| ------------------------ | ------------------------------------------ |
| `subscriber_change`      | `oldSubscriberCount`, `newSubscriberCount` |
| `channel_renamed`        | `oldChannelTitle`, `newChannelTitle`       |
| `channel_avatar_changed` | `oldAvatarUrl`, `newAvatarUrl`             |

## TypeScript example

```typescript theme={null}
for (const event of page.events) {
  switch (event.type) {
    case "title_changed":
      console.log(`${event.oldTitle} -> ${event.newTitle}`);
      break;
    case "thumbnail_ab_test_concluded":
      console.log(event.thumbnailUrls, event.finalThumbnailUrl);
      break;
    case "subscriber_change":
      console.log(event.oldSubscriberCount, event.newSubscriberCount);
      break;
  }
}
```

<Note>
  Current titles, thumbnails, and channel metadata can be newer than the event
  itself. Use the type-specific old/new fields to understand the recorded
  transition.
</Note>
