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

# Quickstart

> Build your first secure realtime telephony flow with Sippet.

## Overview

You will:

* Install the SDK
* Mint a short-lived realtime session token on your backend
* Subscribe to realtime call events from the browser

If you want the extended version, use:

* `/guides/getting-started-classic`

## 1. Install the SDK

```bash theme={null}
npm install @sippet-ai/sdk-js
```

## 2. Mint a realtime session token on your backend

Use your **secret** key server-side.

```ts theme={null}
const response = await fetch("https://api.sippet.ai/api/realtime/session", {
  method: "POST",
  headers: {
    "content-type": "application/json",
    "x-api-key": process.env.SIPPET_SECRET_KEY!,
  },
});

if (!response.ok) throw new Error("Failed to mint realtime session token");

const { token, expires_at } = await response.json();
return { token, expiresAt: expires_at };
```

## 3. Connect the browser to realtime events

```ts theme={null}
import { initSocket, joinEventsChannel } from "@sippet-ai/sdk-js/client";

const { token } = await fetch("/api/sippet/realtime-session", {
  method: "POST",
  credentials: "include",
}).then((r) => r.json());

initSocket({
  baseUrl: "https://api.sippet.ai",
  socketOptions: {
    params: {
      session_token: token,
    },
  },
});

const channel = joinEventsChannel();

channel.on("incoming_call", (payload) => console.log("incoming_call", payload));
channel.on("call_answered", (payload) => console.log("call_answered", payload));
channel.on("call_ended", (payload) => console.log("call_ended", payload));
```

## 4. Refresh token before expiry

* Session tokens are short-lived.
* Re-mint on reconnect or auth failure.
* Keep secret keys out of browser code.

## Next steps

* Full session-token guide: `/guides/realtime-session-tokens`
* Realtime architecture patterns: `/guides/realtime-telephony-patterns`
