# Record small-group classes and build an on-demand library

> Create a small live class, record it as it happens, export an MP4 when recording.ready fires, and optionally transcribe it for class notes.

Fitness, yoga, pilates, meditation, personal training, rehab and teacher
training are usually small live classes. A typical online class is often under
10 people, and many are around 3. This guide builds that: one session per
class, a recording with a separate track per person, an MP4 you can hand to an
on-demand host, and an optional transcript for class notes.

Synento is for the interactive class, up to the plan's per-call cap (4 people
on Free, 16 on pay-as-you-go). It does not offer HLS, and it does not broadcast
to an audience larger than that cap. The current caps and rates are on the
[pricing page](https://synento.com/pricing). A worked example for a 60-minute
class of 3 people and one of 10 is on
[Small-group live classes](https://synento.com/use-cases/live-classes), computed
from the plan catalogue.

You need a server-side key (`sk_live_…`, or an `rk_live_` restricted key for
the project) and a client: `@synento/client` in the browser, or
`@synento/react-native` for an iOS or Android app
(`npx expo install @synento/react-native`). The key stays on the server.

## 1. Create the session

One session is one class. `POST /v1/sessions` creates it in the API key's
project. Send an `Idempotency-Key` when a retry must not create the class
twice. The same key returns the same session for 24 hours.

```bash
curl -s -X POST https://api.synento.com/v1/sessions \
  -H "Authorization: Bearer $SYNENTO_API_KEY" \
  -H "Idempotency-Key: yoga-2026-11-17-0900" \
  -H "Content-Type: application/json" \
  -d '{"name": "Tuesday yoga"}'
```

The response's `data.id` is the session id.

With `@synento/node` the same call is `createSession`. The client sends its
own idempotency key per request, so use the header above when your app, not
the SDK, decides the key.

```typescript
import { SynentoClient } from "@synento/node";

// Reads SYNENTO_API_KEY and SYNENTO_API_URL. Server-side only.
const synento = new SynentoClient();
const session = await synento.createSession({ name: "Tuesday yoga" });
```

There is nothing to start recording. The session is the recording.

## 2. Let the instructor and each student join

Mint one connection token per person. `user_id` is the id you will see on
that person's tracks and transcript lines. Use a stable id, such as
`instructor` or the student's id in your app. Letters, digits, `-` and `_`.

```typescript
import { SynentoClient, resolveWsUrl } from "@synento/node";

const synento = new SynentoClient();

export async function POST(request: Request) {
  const { sessionId, userId } = await request.json();
  const token = await synento.createConnectionToken(sessionId, { userId });
  return Response.json({
    token: token.accessToken,
    wsUrl: resolveWsUrl({
      apiBaseUrl: process.env.SYNENTO_API_URL!,
      requestOrigin: request.headers.get("origin"),
      sessionId,
      userId,
    }),
  });
}
```

The same route is `POST /v1/sessions/{sessionId}/connection` with
`{"user_id": "instructor"}`.

The browser joins with `@synento/client`. Publishing the camera and the
microphone is the recording. There is no start or stop call.

```typescript
import { SynentoRoom } from "@synento/client";

const room = new SynentoRoom({
  userId: "instructor",
  // Called again on every reconnect, so the token is minted fresh.
  getToken: () =>
    fetch("/api/class-token", {
      method: "POST",
      body: JSON.stringify({ sessionId, userId: "instructor" }),
    }).then((res) => res.json()), // { wsUrl, token }
});

await room.connect();
const stream = await navigator.mediaDevices.getUserMedia({
  audio: true,
  video: true,
});
await room.publishCamera(stream);
await room.publishMicrophone(stream);
```

Each person is a separate camera track and a separate microphone track. Form
review and per-student feedback read one `user_id` at a time from the
manifest or from playback. Replay in the browser uses
[`@synento/player`](https://www.npmjs.com/package/@synento/player).

A person past the plan's per-call cap cannot join. Free stops at 4 people in
one call. Pay-as-you-go stops at 16.

## 3. Wait for recording.ready

Subscribe once, for the project. The response includes a signing secret
(`whsec_…`) that is shown only this time. Store it where the receiver can
read it.

```bash
curl -s -X POST https://api.synento.com/v1/webhooks \
  -H "Authorization: Bearer $SYNENTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://app.example.com/hooks/synento",
    "events": ["recording.ready", "export.completed", "transcript.ready"]
  }'
```

`@synento/node`: `synento.createWebhook(url, events)` returns the same secret.

`recording.ready` is sent when the last person leaves, at the same moment as
`session.ended`. The two can arrive in either order. The session's streams
are the recording, so replay can start then. There is no processing step to
wait for. Verify the signature before you trust the body. The check is in
the [webhooks guide](https://synento.com/docs/guides/webhooks.md).

The payload carries `session_id`. For `export.completed` that is the session,
not the export job, so keep the job id from the export response yourself.
`transcript.ready` also carries `data.languages` and `data.speech_seconds`.

## 4. Export an MP4

Ask for the file after `recording.ready`. Export is a `GET`. The same layout
and orientation return the existing job (`"reused": true`) instead of
encoding again.

```bash
curl -s "https://api.synento.com/v1/sessions/$SESSION_ID/export?layout=grid&orientation=landscape" \
  -H "Authorization: Bearer $SYNENTO_API_KEY"
```

Response `202`: `{ "data": { "job_id": "…" }, "error": null }`. `layout` is
`grid` or `presenter`. `orientation` is `landscape` or `vertical`. `focus` is
a participant user id, used by the presenter layout.

Poll `GET /v1/exports/{jobId}` until `status` is `completed`, or wait for
`export.completed` and download the job you stored. Then:

```bash
curl -o class.mp4 \
  "https://api.synento.com/v1/exports/$JOB_ID/download" \
  -H "Authorization: Bearer $SYNENTO_API_KEY"
```

The download needs your API key. Do not give that URL to another service.

The MP4 mixes cameras and microphones. Screen share is not in the file.
[Recordings and replay](https://synento.com/docs/guides/recordings-replay.md) lists the current limits,
including these:

- Every participant in the recording needs camera video. A person who
  published none fails the export, and the error names them.
- A camera recorded in VP8 or VP9 cannot be exported. `@synento/client` uses
  H.264 when the browser can encode it.
- An export runs for at most 15 minutes and is then marked `failed`. A long
  class with many cameras can hit that. Replay of the same recording does not
  depend on the export finishing, because replay reads the streams directly.

## 5. Put the file in an on-demand library

Synento keeps the recording and the MP4. It does not host a public catalogue,
and it does not push the file to a VOD host.

Download the MP4 on your server, as above, and upload those bytes with the
host's own API. Mux and Cloudflare Stream both accept an MP4. Your library
then serves that copy. Keep the Synento session if you still want per-person
replay. The export is the file you publish.

## 6. Optional transcript for class notes

Transcripts are off until you ask. For every class in a project:

```bash
curl -s -X PUT "https://api.synento.com/v1/projects/$PROJECT_ID/transcription" \
  -H "Authorization: Bearer $SYNENTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "enabled": true, "language": "auto" }'
```

Or one class, after it has ended:

```bash
curl -s -X POST "https://api.synento.com/v1/sessions/$SESSION_ID/transcript" \
  -H "Authorization: Bearer $SYNENTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "language": "auto" }'
```

`@synento/node`: `await synento.requestTranscript(sessionId)`. Asking again
returns the transcript already queued, running or finished. The CLI is
`synento transcript <sessionId> --request`. An agent uses `request_transcript`,
then `get_transcript`.

`transcript.ready` means it is done. Read it with
`GET /v1/sessions/{sessionId}/transcript`. Add `?format=vtt`, `srt` or `txt`
for a subtitle file or plain text. Each cue's `speaker` is the `user_id` from
that person's connection token, so class notes can say who spoke. Silence and
muted time are not billed. Details are in [Transcripts](https://synento.com/docs/guides/transcripts.md).

## 7. Check that everyone was recorded

`GET /v1/sessions/{sessionId}/manifest` lists each person and the tracks that
actually hold media. A track is real when `start_ts` is not null. After a
test class, the instructor and each student who published should have `cam`
and `mic`.

```bash
curl -s "https://api.synento.com/v1/sessions/$SESSION_ID/manifest" \
  -H "Authorization: Bearer $SYNENTO_API_KEY"
```

`@synento/node`: `synento.getSessionManifest(sessionId)`. A coding agent
connected to the MCP server at `https://api.synento.com/mcp` can do the same
with `verify_session`, after `create_session` and a real publish from the
app. See [Connect your agent](https://synento.com/docs/guides/mcp.md).

## What a class costs

A participant-minute is one person in the class for one minute. Recording is
included in that rate. A 60-minute class with 3 people is 180
participant-minutes. The same class with 10 people is 600. Both sit inside
the monthly allowance on the current plans. Minutes past that allowance are
billed on pay-as-you-go. The 10-person class does not fit Free, because Free
stops at 4 people per call.

Exporting the MP4 is a separate meter (exported participant-minutes). A
transcript is another, billed on speech. The
[live-classes page](https://synento.com/use-cases/live-classes) prices the
60-minute example from the current catalogue, including storage of the
recording for its first 30 days on pay-as-you-go. The
[pricing page](https://synento.com/pricing) is the full list.
