API Documentation

Build chatbots, push training data, and chat — all over a simple REST API.

Authentication

Create an API key in your dashboard and send it with every request as a Bearer token. Keys are shown once and stored hashed — keep them secret and never use them in browser code.

Authorization: Bearer av_live_your_key_here

Base URL: https://ansarivibe.com/api/v1. All requests and responses are JSON. Errors return {"error": {"message": "..."}} with an appropriate HTTP status (401 unauthorized, 404 not found, 429 rate/quota limit).

Account

GET/api/v1/me

Returns your account, plan limits, and current usage.

curl https://ansarivibe.com/api/v1/me \
  -H "Authorization: Bearer YOUR_API_KEY"

Bots

GET/api/v1/bots

List all your bots.

POST/api/v1/bots

Create a bot. Fields: name (required), description, system_prompt, model, temperature (0–2), welcome_message, primary_color, allowed_domains.

curl -X POST https://ansarivibe.com/api/v1/bots \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Support Bot",
    "system_prompt": "You are a helpful support agent for Acme Inc.",
    "model": "gpt-4o-mini",
    "temperature": 0.7
  }'
GET/api/v1/bots/:bot_id

Fetch a single bot by its id (e.g. bot_a1b2c3…).

PATCH/api/v1/bots/:bot_id

Update any bot fields (same fields as create; all optional).

DELETE/api/v1/bots/:bot_id

Delete a bot and all its training data & conversations. Irreversible.

Training

GET/api/v1/bots/:bot_id/training

List training sources for a bot.

POST/api/v1/bots/:bot_id/training

Add training data. Content is automatically chunked, embedded, and indexed. Three types:

# Plain text
{"type": "text", "title": "Refund policy", "content": "We offer refunds within 30 days..."}

# FAQ pair
{"type": "faq", "question": "Do you ship worldwide?", "answer": "Yes, to over 90 countries."}

# Crawl a website (fetches the page + a few linked pages)
{"type": "url", "url": "https://your-website.com"}
DELETE/api/v1/bots/:bot_id/training/:source_id

Remove a training source and its indexed chunks.

Chat

POST/api/v1/bots/:bot_id/chat

Send a message and get the bot's reply. Pass the same session_id (8–64 chars, your choice) to continue a conversation with memory; omit it to start a new one — the response returns the id to reuse.

curl -X POST https://ansarivibe.com/api/v1/bots/bot_a1b2c3/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message": "What is your refund policy?", "session_id": "customer-42"}'

# Response
{
  "reply": "We offer a full refund within 30 days of purchase...",
  "session_id": "customer-42",
  "bot_id": "bot_a1b2c3"
}

Website widget

No code required — drop this into any page:

<script src="https://ansarivibe.com/widget.js" data-bot-id="bot_a1b2c3" defer></script>

Optional: data-color="#0ea5e9" and data-position="left". Restrict which sites can use your bot via Allowed domains in the bot settings.

Rate limits & quotas

  • Chat API: 60 requests/minute per account. Widget: 15 messages/minute per visitor.
  • Training API: 30 requests/minute per account.
  • Monthly message quotas and per-bot training size depend on your plan — see /api/v1/me.
  • Exceeded limits return HTTP 429.