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

# Legacy Events (Deprecated)

> Deprecated event format still dispatched for backward compatibility

<Warning>
  These events are **deprecated** and will be removed in a future version. They are still dispatched for backward compatibility, but you should migrate to the [new event format](/assistant/events) as soon as possible.
</Warning>

## Overview

The legacy event system uses the `CORTI_EMBEDDED_EVENT` wrapper format with camelCase event names. These events are still sent alongside the new dot-notation events, but support will be removed in a future release.

## Legacy event structure

All legacy events follow this structure:

```typescript theme={null}
{
  type: 'CORTI_EMBEDDED_EVENT',  // Always this value for legacy events
  event: string,                 // camelCase event name (e.g., 'recordingStarted')
  deprecated: true,              // Always true for legacy events
  payload?: object               // Optional event-specific data
}
```

## New event structure

The new event format uses dot-notation event names and includes a `confidential` field:

```typescript theme={null}
{
  type: 'CORTI_EMBEDDED_EVENT',  // Same wrapper as legacy format
  event: string,                 // Dot-notation event name (e.g., 'recording.started')
  confidential: boolean,         // Indicates if payload contains sensitive data
  payload: object                // Event-specific data with new structure
}
```

## Migration path

When migrating from legacy events to the new format:

1. Update your event names from camelCase to dot-notation (e.g., `recordingStarted` → `recording.started`)
2. Handle the new `confidential` field in events
3. Update payload structures to match the new format (see individual event pages)
4. Remove checks for `deprecated: true` field (not present in new events)

<Note>
  The `CORTI_EMBEDDED_EVENT` type wrapper remains the same in both legacy and new formats. You still check for `event.data?.type === 'CORTI_EMBEDDED_EVENT'`

  * only the event names and payload structures have changed.
</Note>

<Tip>
  You can use the `deprecated: true` field to programmatically detect and log warnings for legacy events in your integration, helping you track migration progress.
</Tip>

## Legacy events reference

### ready

Emitted when the embedded app is loaded and ready to receive messages.

```typescript theme={null}
{
  type: 'CORTI_EMBEDDED_EVENT',
  event: 'ready',
  deprecated: true,
  payload?: {}
}
```

**Replacement:** Use [`embedded.ready`](/assistant/events/generated/embedded-api/ready) instead.

***

### loaded

Emitted when navigation to a specific path has completed.

```typescript theme={null}
{
  type: 'CORTI_EMBEDDED_EVENT',
  event: 'loaded',
  deprecated: true,
  payload: {
    path: string
  }
}
```

**Replacement:** Use [`interaction.loaded`](/assistant/events/generated/interaction/loaded) instead.

***

### recordingStarted

Emitted when recording has started.

```typescript theme={null}
{
  type: 'CORTI_EMBEDDED_EVENT',
  event: 'recordingStarted',
  deprecated: true,
  payload?: {}
}
```

**Replacement:** Use [`recording.started`](/assistant/events/generated/recording/started) instead.

***

### recordingStopped

Emitted when recording has stopped.

```typescript theme={null}
{
  type: 'CORTI_EMBEDDED_EVENT',
  event: 'recordingStopped',
  deprecated: true,
  payload?: {}
}
```

**Replacement:** Use [`recording.stopped`](/assistant/events/generated/recording/stopped) instead.

***

### documentGenerated

Emitted when a document has been generated.

```typescript theme={null}
{
  type: 'CORTI_EMBEDDED_EVENT',
  event: 'documentGenerated',
  deprecated: true,
  payload: {
    document: {
      id: string,
      name: string,
      templateRef: string,
      // ... (see getStatus response for full document structure)
    }
  }
}
```

**Replacement:** Use [`document.generated`](/assistant/events/generated/document/generated) instead.

***

### documentUpdated

Emitted when a document has been updated.

```typescript theme={null}
{
  type: 'CORTI_EMBEDDED_EVENT',
  event: 'documentUpdated',
  deprecated: true,
  payload: {
    document: {
      id: string,
      name: string,
      templateRef: string,
      // ... (see getStatus response for full document structure)
    }
  }
}
```

**Replacement:** Use [`document.updated`](/assistant/events/generated/document/updated) instead.

***

### documentSynced

Emitted when a document has been synced to EHR.

```typescript theme={null}
{
  type: 'CORTI_EMBEDDED_EVENT',
  event: 'documentSynced',
  deprecated: true,
  payload: {
    document: {
      id: string,
      name: string,
      templateRef: string,
      // ... (see getStatus response for full document structure)
    }
  }
}
```

**Replacement:** Use [`document.synced`](/assistant/events/generated/document/synced) instead.

### usage

Emitted when credits have been consumed because of either of these triggers:

* **Ending/pausing a recording**: credits consumed for transcription and fact extraction
* **Ending dictation**: credits consumed for transcription
* **Generating a document**: credits consumed for text generation

```typescript theme={null}
{
  type: 'CORTI_EMBEDDED_EVENT',
  event: 'usage',
  payload: {
    creditsConsumed: 0.13,
  }
}
```

This value is not accumulative and only refers to the latest trigger.

**Replacement:** Use [`account.creditsConsumed`](/assistant/events/generated/account/creditsConsumed) instead.

***

## Listening for legacy events

```javascript theme={null}
window.addEventListener("message", (event) => {
  if (event.data?.type === "CORTI_EMBEDDED_EVENT") {
    switch (event.data.event) {
      case "ready":
        console.log("Embedded app ready");
        break;
      case "loaded":
        console.log("Navigation completed:", event.data.payload.path);
        break;
      case "documentGenerated":
        console.log("Document generated:", event.data.payload.document);
        break;
      case "documentUpdated":
        console.log("Document updated:", event.data.payload.document);
        break;
      case "documentSynced":
        console.log("Document synced:", event.data.payload.document);
        break;
      case "recordingStarted":
        console.log("Recording started");
        break;
      case "recordingStopped":
        console.log("Recording stopped");
        break;
      default:
        console.log("Unknown event:", event.data.event);
    }
  }
});
```

## Timeline

* **Current**: Both legacy and new events are dispatched
* **Future**: Legacy events will be removed (date TBD)
* **Action required**: Migrate to new event format before legacy support is removed
