# System events

Reecall announces a System event when something happens on the platform, such as the end of a conversation. A [Trigger](/docs/triggers) listens to one System event type and starts its Process each time one occurs.

| Type | Announced when | `refId` points to |
| --- | --- | --- |
| [`exchange.started`](#exchangestarted) | A conversation starts | The Exchange |
| [`exchange.completed`](#exchangecompleted) | A conversation ends and its Exchange is complete | The Exchange |
| [`run.failed`](#runfailed) | A Run fails | The Run |

System events are not the Exchange events of a conversation's timeline. See [Exchange events](/docs/events) for those.

## What a Process reads

A Run started by a Trigger reads the System event under `event`:

| Field | Type | Description |
| --- | --- | --- |
| `id` | `string` (UUID) | Identifies the System event. A type and a record always give the same ID. |
| `type` | `string` | The System event type, such as `exchange.completed` |
| `occurredAt` | `string` | ISO 8601 date and time of the change that caused the System event |
| `refId` | `string` (UUID) | ID of the record the System event comes from |
| `data` | `object` | Fields of the record, listed below for each type. Each field can be `null`. |

For example, `{{ event.refId }}` is the Exchange ID in a Process started by `exchange.completed`, and `{{ event.data.duration }}` is the conversation's duration. See [Templating language](/docs/templating-language).

Trigger conditions read the same fields, plus `event.organizationId` and `event.projectId`.

Each Trigger starts at most one Run for a System event. If Reecall delivers the same System event again, its Trigger starts nothing new.

## exchange.started

Announced when Reecall registers an Exchange at the start of a conversation, with `status: "inProgress"`. `refId` is the Exchange ID.

| `data` field | Type | Description |
| --- | --- | --- |
| `status` | `string` | Status of the Exchange: `"inProgress"` |
| `type` | `string` | Conversation type, such as `"voice"` |
| `assistantId` | `string` (UUID) | The Assistant holding the conversation |
| `roomId` | `string` | Identifier of the conversation's room |
| `externalId` | `string` | The [external ID](/docs/external-id) supplied for the conversation |

## exchange.completed

Announced once per Exchange, when it reaches `status: "completed"`. This covers both the normal case, where Reecall updates the Exchange at the end of the conversation, and the fallback, where the start registration failed and Reecall creates the completed Exchange at the end. Later updates of a completed Exchange announce nothing.

`refId` is the Exchange ID. `data` has the fields of `exchange.started`, plus:

| `data` field | Type | Description |
| --- | --- | --- |
| `title` | `string` | Short description of the conversation |
| `duration` | `number` | Conversation duration in seconds |
| `audioUrl` | `string` | URL of the recording, when one is available |
| `messages` | `array` | The transcript. See [Messages](/docs/messages). |
| `events` | `array` | The Exchange events of the conversation. See [Exchange events](/docs/events). |
| `resources` | `array` | Configuration metadata and media references. See [Resources](/docs/resources). |
| `data` | `object` | Data extracted from the conversation. See [Data Extraction](/docs/conversational-data-extraction). |

The Exchange ID is not in `data`. Use `event.refId`.

```json title="event in a Process started by exchange.completed"
{
  "id": "0b2e6f4a-8c1d-5e7f-9a3b-4c5d6e7f8a9b",
  "type": "exchange.completed",
  "occurredAt": "2026-12-01T10:15:42.120Z",
  "refId": "72770d5a-5b25-4118-ba88-786972b29de7",
  "data": {
    "status": "completed",
    "type": "voice",
    "assistantId": "8f9c2b1e-4d3a-4c7b-9e6f-1a2b3c4d5e6f",
    "roomId": "RM_abcde1324",
    "externalId": "ext-12345",
    "title": "Customer reported a connection issue and asked for a callback.",
    "duration": 73,
    "audioUrl": "https://recordings.reecall.io/a130b57c-d6d7-4a18-9111-219e3192a478",
    "messages": [
      {
        "message": "Hi, welcome to the technical support, how may I assist you today?",
        "from": "assistant",
        "time": "2026-12-01T10:14:31.002484"
      }
    ],
    "events": [
      { "type": "session_start", "time": "2026-12-01T10:14:29.420863", "data": {} }
    ],
    "resources": [],
    "data": { "motive": "Technical Support" }
  }
}
```

## run.failed

Announced when a Run ends with `status: "failed"`, whether a Trigger or an API call started it. `refId` is the ID of the failed Run.

| `data` field | Type | Description |
| --- | --- | --- |
| `triggerId` | `string` (UUID) | The Trigger that started the failed Run, or `null` for a Run started through the API |
| `processId` | `string` (UUID) | The Process of the failed Run. Absent when the Run ran steps sent with the API call. |
| `errorCode` | `string` | Why the Run failed, as a code. See [Why a Run failed](/docs/runs#why-a-run-failed). |
| `errorMessage` | `string` | Why the Run failed, in a sentence that never holds the Run's data, such as `Request failed with status code 503 (Service Unavailable)` |
| `failedStep` | `string` | Position of the step that failed, such as `"2"`, or `null` when no step failed, as when the attempt timed out |

A Run started by `run.failed` that fails announces no `run.failed`, so an alert Process cannot start itself in a loop. See [Email an alert when a Run fails](/docs/run-failure-email).

## List the types through the API

```bash title="List System event types"
curl https://workflows.reecall.io/v2/event-types \
  --header 'Authorization: Bearer sk_YOUR_API_KEY'
```

```json title="Response"
{
  "eventTypes": [
    { "type": "exchange.started", "ref": "conversational.exchange" },
    { "type": "exchange.completed", "ref": "conversational.exchange" },
    { "type": "run.failed", "ref": "automation.run" }
  ]
}
```

`ref` names the kind of record `refId` points to.
