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

# When the Bot Leaves

> Configure when the meeting bot leaves after silence, time alone, lobby waits, or a duration limit.

Set `leave_policy` on `POST /v2/meeting_sessions` or MCP `join_meeting` to customize automatic departure for Google Meet and Teams sessions. Zoom accepts a valid policy but ignores it and omits it from the response.

```json theme={null}
{
  "meeting_url": "https://meet.google.com/abc-defg-hij",
  "idempotency_key": "weekly-planning-2026-11-10",
  "leave_policy": {
    "alone_seconds": 300,
    "max_duration_seconds": 7200
  }
}
```

The [create-session reference](https://developers.telnyx.com/api-reference/meeting-sessions/create-a-meeting-session.md) defines the complete request schema.

| Field | Default | Behavior |
| - | - | - |
| `silence_seconds` | `600` | Leave after this much continuous audio inactivity once the grace period ends. |
| `silence_grace_seconds` | `1200` | Wait this long after joining before starting a fresh silence timer. |
| `alone_seconds` | `60` | Leave after being alone this long, after another participant has attended and left. Arriving before everyone else does not start this timer. |
| `host_wait_seconds` | `600` | Maximum wait for the host to start the meeting. |
| `lobby_wait_seconds` | `900` | Maximum wait for lobby admission. |
| `max_duration_seconds` | `null` | Maximum time after joining. `null` means no per-join limit; service safety limits still apply. |
| `bot_name_keywords` | `null` | Case-insensitive names or phrases identifying other bots to exclude when deciding whether this bot is alone. |

Durations must be whole seconds from 1 to 2,147,483,647. Zero does not disable a timer. Only `max_duration_seconds` and `bot_name_keywords` accept `null`. An empty keyword array also disables name filtering. Supply at most 100 keywords, each 1–100 characters. Name matching splits on spaces, hyphens, and underscores.

The silence timers run consecutively: the default 20-minute grace period followed by 10 minutes of continuous silence allows roughly 30 minutes before silence-based departure. Omitted fields keep runtime defaults; an empty policy is equivalent to omission.

## Policy Lifetime and Other Ways to Leave

The policy is fixed at creation and returned in `config.leave_policy`. It is retained for scheduled joins where scheduling is supported, but cannot be changed with `PATCH`. Reusing an idempotency key with a different policy returns a conflict.

`assistant.leave_on_end: true` independently requests departure when the assistant conversation ends or fails. You can also call `DELETE /v2/meeting_sessions/{id}` to leave immediately or cancel a scheduled join. These operations stop participation; they do not delete the session's transcript, artifacts, or exported Storage objects.

Follow `session.status_changed` and the session's `status_detail` for lifecycle outcomes. A departure request may first put the session in `leaving`; wait for a terminal status. Then wait separately for transcript finalization and recording export, as described in [Collect Results](https://developers.telnyx.com/docs/meeting/collect-results.md).
