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

# Connection types

> Choose the right transport for your channel. Humain supports REST, WebSocket streaming, WebRTC voice, and VoIP/SIP.

Humain exposes one API surface for all channel types. The `mode` you set when opening a session
determines which transport patterns are available. HTTP (REST) is used for session lifecycle —
open, ticket, end — in every mode; the conversation itself always runs over WebSocket (text) or
WebRTC (voice/voip). There is no REST endpoint for sending a text message and getting a reply.

## At a glance

> [card] [REST — text session setup](https://humain.mintlify.site/connections/rest-text.md)
>
> Open a session, mint a WebSocket ticket, close a session — all plain HTTPS. The conversation
> turns themselves happen over the WebSocket described below.

> [card] [WebSocket — streaming](https://humain.mintlify.site/connections/websocket-streaming.md)
>
> Open a persistent connection and exchange conversation turns. The only way to send and
> receive text messages.

> [card] [WebRTC — real-time voice](https://humain.mintlify.site/connections/webrtc-voice.md)
>
> Full-duplex audio over WebRTC. Server-side VAD, barge-in support, and sub-200 ms latency.
> For kiosk terminals, drive-throughs, and any hands-free scenario.

> [card] [VoIP / SIP](https://humain.mintlify.site/connections/voip-sip.md)
>
> Bridge a SIP trunk or PSTN phone line directly to the Humain AI. No WebRTC runtime needed
> on the client side.

## Comparison

| | REST | WebSocket | WebRTC voice | VoIP / SIP |
| - | - | - | - | - |
| Carries conversation turns | ❌ No — session lifecycle only | ✅ Yes — the only text transport | ✅ Yes | ✅ Yes |
| Best for | Opening/closing sessions in any mode | Chat UIs, kiosk touchscreens, any text integration | Hands-free terminals, drive-throughs | Call centres, IVR, PSTN callers |
| Requires | HTTPS client | WebSocket client | WebRTC runtime (browser or pion) | SIP stack or PBX |
| Testable in browser | ✅ Yes | ✅ Yes | ✅ Yes (with mic permission) | ❌ No — needs telephony hardware |

## Which one should I use?

Every mode uses REST to open and close the session. The question is which mode fits your channel:

| Scenario | Recommended mode |
| - | - |
| Website chat widget with streaming | `text` (WebSocket) |
| Backend server calling the AI | `text` (WebSocket) |
| Touchscreen kiosk with typed input | `text` (WebSocket) |
| Hands-free kiosk or terminal | `voice` (WebRTC) |
| Drive-through ordering | `voice` (WebRTC) |
| Call centre / IVR replacement | `voip` (SIP) |
| Phone support from mobile app | `voice` (WebRTC) |
| IoT / embedded device | `text` (WebSocket) |

## Mixing transports within a session

A single session uses one mode for its lifetime. You cannot switch from `text` to `voice` mid-session.
Open a new session if the user's channel changes (e.g. a chat user initiates a voice call).

## Latency expectations

| Transport | First-token latency | Typical end-to-end |
| - | - | - |
| WebSocket (text) | N/A — full response returned per turn | 1–3 s |
| WebRTC (voice) | \~150 ms | Near real-time |
| VoIP / SIP | \~200 ms | Near real-time |

> [!NOTE]
>
> Latency figures are for the sandbox and production environments with a warm connection. Cold
> start (first request in a session) adds \~100 ms for cache population.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.