Quickstart API Keys Embedding the Widget Widget Parameters Widget Events RAG Overview Uploading Sources POST /chat POST /knowledge GET /usage Error Codes Rate Limits

Travis AI Docs

Everything you need to embed Travis on your site, connect your knowledge base, and interact with the API.

Quickstart

Add Travis to any website in 60 seconds. Sign up, grab your API key, and paste one script tag before your closing </body>.

<!-- Add before </body> -->
<script src="https://travis-ai.net/app/api/widget.php ?key=tvs_your_api_key"></script>

That's it. Travis will appear as a chat button in the bottom-right corner of your page. To customize behavior, see Widget Parameters.

API Keys

Your API key identifies your tenant and is required for all widget embeds and API calls. You can create, rotate, and revoke keys from the admin dashboard under Settings → API Keys.

Keep your API key private. Do not commit it to public repositories. The widget embed key is an exception — it is intended for client-side use and is scoped to read-only widget operations only.

Key format

All API keys are prefixed with tvs_ followed by 32 random characters. Example: tvs_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6.

Embedding the Widget

The widget script is served dynamically and includes your tenant's branding, persona name, and settings automatically. No additional configuration is needed for a standard embed.

<script src="https://travis-ai.net/app/api/widget.php?key=tvs_YOUR_KEY" data-position="bottom-right" data-open="false" ></script>

Widget Parameters

Pass these as data-* attributes on the script tag:

ParameterDefaultDescription
data-positionbottom-rightWidget placement: bottom-right, bottom-left, top-right, top-left. Overrides the admin panel setting.
data-openfalseSet to true to open the chat window on page load.
data-greeting(from settings)Override the welcome message for this page only.
data-themelightlight or dark.
data-z-index9999CSS z-index of the widget container.

Widget Events

Travis emits browser events you can listen to:

window.addEventListener('travis:open', () => { console.log('Widget opened'); }); window.addEventListener('travis:close', () => { console.log('Widget closed'); }); window.addEventListener('travis:message', (e) => { console.log('New message:', e.detail); });

RAG Overview

Travis uses Retrieval-Augmented Generation (RAG) to ground answers in your content. When a visitor asks a question, Travis retrieves the most relevant chunks from your knowledge base and passes them as context to the language model.

Uploading Sources

Upload knowledge base content from the admin dashboard under Knowledge Base. Supported sources:

POST /app/api/chat.php

Send a chat message programmatically.

Request
POST https://travis-ai.net/app/api/chat.php Authorization: Bearer tvs_YOUR_KEY Content-Type: application/json { "message": "What is your return policy?", "session_id": "visitor_abc123" }
Response
{ "reply": "We offer a 30-day no-questions-asked return policy.", "session_id": "visitor_abc123", "sources": [ { "title": "Returns Policy.pdf", "score": 0.91 } ] }

POST /app/api/knowledge.php

Add a knowledge base document programmatically.

POST https://travis-ai.net/app/api/knowledge.php Authorization: Bearer tvs_YOUR_KEY Content-Type: application/json { "type": "text", "title": "Refund Policy", "content": "We offer a full refund within 30 days..." }

GET /app/api/usage.php

Retrieve usage stats for the current billing period.

GET https://travis-ai.net/app/api/usage.php Authorization: Bearer tvs_YOUR_KEY
Response
{ "period_start": "2025-06-01", "period_end": "2025-06-30", "messages_used": 842, "messages_limit": 1000, "rag_retrievals": 615, "tokens_used": 124300 }

Error Codes

HTTP StatusCodeMeaning
401unauthorizedMissing or invalid API key.
403forbiddenAction not allowed on this plan.
429rate_limitedToo many requests. See rate limits below.
402limit_exceededMonthly message limit reached.
500server_errorInternal error. Contact support.

Rate Limits

API requests are rate-limited per API key:

If you need higher limits, contact us about a Pro or Enterprise plan.