Server-to-Server APIAPI access is available on Starter and Pro.

Chat API Reference

Stream AI chatbot responses directly from your backend using Server-Sent Events (SSE).

Overview

Use the public Chat API when you want to call your Tellvira bot from your own backend, server-side workflow, or custom integration instead of embedding the browser widget.

Requests are server-to-server, do not require an Origin header, and reuse the same knowledge retrieval, conversation memory, and monthly plan quotas as the web widget.

Before you start

  • Create an API key: Go to Account Settings > API keys to generate a secret key. API access is available on Starter and Pro plans.Open API keys
  • Find your bot_id: Open Bots, select your bot, and open its Install tab to copy the bot's public ID.Open Bots

Authentication

Authenticate every request with a secret API key in the Authorization header using the Bearer scheme.

API keys use the format tv_live_ followed by 40 random characters (48 characters total). The full key is shown once at creation time in Account Settings > API keys. Up to 5 active keys are allowed per account.

Authorization: Bearer tv_live_your_api_key_here

Base URL

Send all Chat API requests over HTTPS to your Tellvira API origin:

https://api.tellvira.com

Endpoint

Sends a visitor message to one of your active bots and streams the reply as Server-Sent Events.

POST/api/v1/public/chat

Headers

NameRequiredValueDescription
AuthorizationYesBearer tv_live_<40 chars>Your secret API key. Requests with missing, revoked, or expired keys return 401.
Content-TypeYesapplication/jsonJSON request body media type.
AcceptRecommendedtext/event-streamIndicates the client expects an SSE stream. Pre-stream auth or validation errors still return application/json.

Body parameters

NameTypeRequiredDescription
bot_idstringYesPublic ULID of the target bot (max 64 chars). The bot must belong to the API key owner and be active.
messagestringYesVisitor message text (trimmed, 1 to 500 characters by default).
conversation_idstring (UUID) | nullNoExisting conversation UUID returned by a prior conversation event. Must belong to the same bot. Conversations expire after 24 hours of inactivity.

Response

Successful requests return HTTP 200 with Content-Type: text/event-stream. Each event includes an event: name and a JSON-encoded data: line.

EventPayload fieldsWhen sent
conversationconversationId: string (UUID)Sent first on every stream. Store this ID after done arrives to continue the conversation.
tokentoken: stringSent zero or more times as the assistant generates text chunks.
usageused: number, limit: number, reached: booleanSent after the turn is saved; reports turns used vs the per-conversation turn limit (default 15 turns / 30 messages).
lead_formfields: Array<{ name: string, label: string, ... }>Sent after usage when lead capture is enabled on the bot and the assistant triggers lead capture.
done{} (empty object)Final event indicating the stream finished and messages and usage were committed.
errormessage: stringSent if an internal error interrupts streaming after the 200 SSE response has started.

Errors

Failures before streaming begins return standard JSON error envelopes with success: false, responseCode, message, errors, and an optional machine-readable code.

HTTP statuscodeMeaningWhat to do
401invalid_api_keyMissing, malformed, revoked, or expired API key.Check the Bearer token or create a new API key in Account Settings.
403account_suspendedThe API key owner's account is suspended or inactive.Contact support to restore account access.
403plan_not_allowedThe owner's current plan does not include API access.Upgrade to Starter or Pro in Billing.
403bot_inactiveThe requested bot is paused or inactive.Set the bot status to Active in the dashboard.
403—Monthly plan quota for conversations, AI messages, or AI tokens is reached.Wait for the next billing cycle or upgrade your plan.
404bot_not_foundNo bot with that bot_id exists for the API key owner.Verify bot_id and ensure the API key belongs to the bot owner.
404conversation_not_foundThe supplied conversation_id belongs to a different bot.Omit conversation_id to start fresh or pass one created for this bot.
409—Conversation reached the maximum message limit (30 messages by default).Start a new conversation by omitting conversation_id.
422—Request body validation failed (field details are returned in errors).Fix the invalid or missing fields listed in the errors object.
429rate_limit_exceededPer-API-key or per-conversation rate limit exceeded.Pause and retry after a short backoff.
429—Another message is currently streaming for the same conversation_id.Wait for the in-flight stream to finish before sending the next turn.
503—Upstream AI provider or knowledge search is temporarily unavailable.Retry with exponential backoff.

Rate limits

ScopeLimitNotes
Per API key60 requests / minute (default)Applies across all bots used with that key.
Per conversation10 requests / minute (default)Applies when conversation_id is supplied.
Concurrent stream lock1 active turn per conversationConcurrent requests to the same conversation_id return 429 until the active turn completes.
Message & session caps500 chars / message, 30 messages / conversation, 24h inactivity expiryEach new or expired conversation counts once toward your monthly plan conversation quota.

Examples

curl -N -X POST "https://api.tellvira.com/api/v1/public/chat" \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -H "Accept: text/event-stream" \
  -d '{
    "bot_id": "01J...",
    "message": "Hello",
    "conversation_id": null
  }'

Best practices

  • Keep API keys on your server only—never ship tv_live_ keys in browser JavaScript, mobile app bundles, or public repositories.
  • Save the conversationId from the conversation event only after you receive the done event, because messages and usage are committed when streaming completes.
  • Disable client-side response buffering (for example pass -N in cURL) so tokens render incrementally.
  • Use separate API keys per environment or integration so you can revoke one key without affecting others.
  • Handle HTTP 429 and 503 responses with bounded exponential backoff rather than tight retry loops.