Chat API & SDK
Two ways to embed ReplyTurbine chat in your own products. Both go through the same assistant, inbox, and human-takeover flow as the website widget.
1. Website widget (no code)
Copy the snippet from Website chat in your dashboard and paste it before </body>.
<script src="https://replyturbine.com/widget.js" data-key="wk_YOUR_KEY" async></script>
Optional JavaScript controls once loaded: ReplyTurbine.open(), ReplyTurbine.close().
2. Browser SDK (custom UI)
Build your own chat interface in a web app or hybrid mobile app. Uses the public widget key and is subject to the widget's allowed-domain and rate-limit rules.
<script src="https://replyturbine.com/sdk.js"></script>
<script>
const chat = ReplyTurbineChat.create({ host: "https://replyturbine.com", key: "wk_YOUR_KEY" });
await chat.start();
const r = await chat.send("Do you offer free estimates?");
console.log(r.reply?.text, r.handoff, r.waitingForHuman);
const stop = chat.onMessage(m => console.log(m.role, m.text)); // live updates (agent replies)
await chat.submitLead({ name: "Pat", email: "pat@example.com" });
await chat.requestHuman();
</script>3. REST API (server to server)
Create an API key under Settings → Data & security → API keys. Send it as Authorization: Bearer rtk_…. Keep it on your server; never ship it to browsers.
Each key has an access level (send messages, read conversations, or both) and can expire after 30, 90, or 365 days. Expired and revoked keys answer 401; a key without the needed access answers 403. The API only sees conversations that were started through the API, never email, text, or website chat threads. Contact details in user are saved as provided by your app (unverified).
Send a message
POST https://replyturbine.com/api/v1/conversations
Authorization: Bearer rtk_...
Content-Type: application/json
{ "externalUserId": "user_123", "message": "What are your hours?",
"user": { "name": "Pat", "email": "pat@example.com" } }
→ 201 { "conversationId": "...", "messageId": "...",
"reply": { "id": "...", "text": "We are open ...", "createdAt": "..." } | null,
"status": "sent" | "drafted" | "skipped", "handoff": false }Messages from the same externalUserId continue the same conversation. When reply is null, the assistant drafted a reply for your team or handed off; poll the transcript for the human reply.
Continue a conversation
POST https://replyturbine.com/api/v1/conversations/{conversationId}/messages
{ "message": "Can I book for Tuesday?" }Read the transcript
GET https://replyturbine.com/api/v1/conversations/{conversationId}/messages?since=2026-01-01T00:00:00Z
→ { "conversation": { "id", "status", "aiPaused" },
"messages": [ { "id", "role": "user" | "assistant" | "agent", "text", "createdAt" } ] }List conversations
GET https://replyturbine.com/api/v1/conversations?status=open&limit=50
Errors
{ "error": { "code": "unauthorized" | "rate_limited" | "validation" | "not_found" | ..., "message": "..." } }Rate limit: 120 requests per minute per workspace. Public widget endpoints: 15 messages per minute per chat session and 60 per minute per network.
Public widget endpoints
Used by the widget and SDK; documented so native mobile apps can call them directly. All accept JSON and support CORS.
GET /api/widget/config?key=wk_... → widget configuration and online status
POST /api/widget/session { key } → { session: { token } }
Every call below sends the token in a header: x-rt-session: <token>
POST /api/widget/message { key, text, visitor? } → { reply|null, handoff, waitingForHuman }
GET /api/widget/messages?key=&since= → { messages[], humanActive }
POST /api/widget/lead { key, name?, email?, phone?, message? }
POST /api/widget/human { key } → asks for a personNever put the session token in a URL. Until November 15, 2026 the older token query parameter and body field still work; after that a call without the header answers 401 with code missing_session.
A session token stops working after 30 days without activity and then answers 401 with code invalid_session: start a new session. The widget and SDK do this automatically. Attachment links in messages last 7 days and are issued fresh on every call.