> For clean Markdown of any page, append `.md` to the page URL.
> For a complete documentation index, see https://docs.sarvam.ai/llms.txt.
> For full documentation content in one file, see https://docs.sarvam.ai/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server.

# Deploy with Code (API & SDK)

Integrate Voice Agents programmatically with APIs and SDKs. For platform speech APIs, see the [API Reference](/api-reference/introduction).

## What will be covered

| Topic                     | Description                                                                                                                  |
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| **API recipes**           | Ready-to-use code for common operations, creating agents, starting sessions, triggering outbound calls, fetching transcripts |
| **WebSocket integration** | Real-time voice sessions with audio frames, turn events, and tool-call signals                                               |
| **SDK usage**             | Typed client libraries for session lifecycle, agent management, and outcome retrieval                                        |
| **Authentication**        | API key usage and best practices for keeping secrets server-side                                                             |

Authenticate all requests with your [API key](/conversations/settings/api-key).

## Getting started (preview)

Use the dashboard API recipes as a starting point:

1. **Create or update an agent configuration**: set up agents programmatically instead of through the UI
2. **Start a conversation session**: initiate a voice or text session via API
3. **Trigger outbound calls**: kick off calls to specific numbers with variable payloads
4. **Fetch transcripts and outcomes**: pull conversation data into your systems for analysis or CRM updates

## WebSocket integration

For real-time voice sessions, connect over the Conversations WebSocket interface. Handle audio frames, turn events, and tool-call signals according to the API contract.

Never expose production API keys in browser code. Keep secrets server-side and proxy WebSocket connections through your backend when building client-facing applications.

## Embed the agent (widget)

To put a voice or chat agent on your website, embed the widget:

1. Open your agent and go to the **Embed** option in Deploy with Code.
2. Copy the embed snippet from the dashboard.
3. Paste it into your site, typically before `</body>`.
4. Load the page and confirm the widget initializes.

Customize the launcher position, theme, and which agent the widget uses from the dashboard, and re-test in [test agent](/conversations/deploy/overview) after changes.