Why a server route
Your API key must stay on the server. The browser calls your own route; your route calls Moss with the secret key and returns a short-lived session token to the browser. This keeps yoursk_... key out of client bundles entirely.
Create the route
The example below uses Next.js App Router. The samecreateFoundingAgentSession call works from any Node server.
Response
The route returns a JSON object with the following fields.LiveKit access token for the browser to join the session.
LiveKit server URL to connect to.
The session’s room name.
Optional. One-time value used by the booking flow.
createFoundingAgentSession also accepts serviceUrl and timeoutMs. The defaults are correct for production, so you can omit them.Next steps
React components
Add the provider and voice bubble to your React app.