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

# REST Integration Guide

> Session lifecycle from your backend.

<Warning>
  Run the REST API from your backend. Avaturn API keys exposed in the browser can be stolen and used to act on your behalf.
</Warning>

## Session lifecycle

<Steps>
  <Step title="Create a session">
    [`POST /api/v1/sessions`](/api-reference/create-session) with a [conversation engine](/howtos/openai_realtime_api) config. Response contains `session_id` (backend) and `token` (frontend).
  </Step>

  <Step title="Hand the token to the frontend">
    The `token` is the only credential the browser needs. The [Web SDK](/web-sdk/integration-guide) uses it to join the avatar room over WebRTC.
  </Step>

  <Step title="Terminate the session">
    [`DELETE /api/v1/sessions/{id}`](/api-reference/terminate-session) when you're done, or rely on auto-termination (`user_absent_timeout` / `max_duration`).
  </Step>
</Steps>

A working end-to-end snippet lives in [Example](/rest/example).

For backend-driven scripted speech (no STT), see [Legacy text-echo](/legacy/text-echo).
