Skip to main content

API Documentation

Integrate AI assisters into your website or application using our JavaScript SDK and REST API.

Quick Start

1. Get your API Key

Generate an API key from your dashboard. API keys start with ask_.

2. Add the SDK to your website

<script src="https://assisters.io/sdk/assisters.js"></script>
<script>
  Assisters.init({
    apiKey: 'ask_your_api_key',
    assisterId: 'your-assister-uuid'
  });
</script>

3. That's it!

A chat button will appear in the bottom-right corner of your page.

SDK Configuration

OptionTypeDefaultDescription
apiKeystringrequiredYour API key from the dashboard
assisterIdstringrequiredThe UUID of the assister to embed
positionstring"bottom-right"Button position: "bottom-right" or "bottom-left"
themestring"auto"Theme: "auto", "light", or "dark"
primaryColorstring"#3b82f6"Brand color for the button and accents
buttonSizenumber56Button diameter in pixels
buttonIconstring"chat""chat", "sparkle", or custom image URL
greetingstringnullCustom greeting message override
placeholderstring"Type a message..."Placeholder text for the message input
hideWatermarkbooleanfalseHide "Powered by Assisters" watermark (requires $50+ wallet)
autoOpenbooleanfalseAuto-open chat on page load
zIndexnumber9999Z-index for the widget

SDK Methods

Assisters.open()

Opens the chat widget programmatically.

Assisters.close()

Closes the chat widget.

Assisters.toggle()

Toggles the chat widget open/closed.

Assisters.sendMessage(message)

Sends a message programmatically.

Assisters.sendMessage("Hello, I need help with my order");

Assisters.isOpen()

Returns true if the chat widget is currently open.

Assisters.destroy()

Removes the widget from the page completely.

Event Callbacks

Assisters.init({
  apiKey: 'ask_xxx',
  assisterId: 'uuid',

  // Called when the widget finishes loading
  onLoad: function() {
    console.log('Widget loaded');
  },

  // Called when the chat opens
  onOpen: function() {
    console.log('Chat opened');
  },

  // Called when the chat closes
  onClose: function() {
    console.log('Chat closed');
  },

  // Called when a message is sent or received
  onMessage: function(data) {
    console.log('Message:', data);
  }
});

REST API

For server-side integrations, you can use our REST API directly.

POST/api/embed/chat

Send a message and receive a streaming response.

Headers

X-Assisters-Key: ask_your_api_key
Content-Type: application/json

Request Body

{
  "assisterId": "uuid",
  "message": "Hello, I need help",
  "sessionId": "optional-session-id"
}

Response

Returns a Server-Sent Events (SSE) stream with chunks of the response.

SSE Stream Format

// Each chunk arrives as a JSON event:
data: {"type":"chunk","content":"Hello"}

data: {"type":"chunk","content":", how"}

data: {"type":"chunk","content":" can I"}

data: {"type":"chunk","content":" help you today?"}

// Final event with metadata:
data: {"type":"done","tokens_used":142,"hideWatermark":false}

JavaScript Example

const response = await fetch('https://assisters.io/api/embed/chat', {
  method: 'POST',
  headers: {
    'X-Assisters-Key': 'ask_your_api_key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    assisterId: 'your-assister-uuid',
    message: 'Hello!'
  })
});

const reader = response.body.getReader();
const decoder = new TextDecoder();
let fullText = '';

while (true) {
  const { done, value } = await reader.read();
  if (done) break;

  const text = decoder.decode(value);
  const lines = text.split('\n');

  for (const line of lines) {
    if (line.startsWith('data: ')) {
      const data = JSON.parse(line.slice(6));
      if (data.type === 'chunk') {
        fullText += data.content;
        console.log(data.content); // Stream to UI
      } else if (data.type === 'done') {
        console.log('Complete! Tokens:', data.tokens_used);
      }
    }
  }
}

Rate Limits

API requests are rate-limited based on your subscription tier:

  • Free: 10 requests per minute
  • Plus: 60 requests per minute
  • Pro: 300 requests per minute
  • Max: 1000 requests per minute

Billing

Embed API usage is charged from your wallet balance based on token consumption. Each assister has its own price per million tokens set by the creator.

Monitor your usage and top up your wallet from the wallet page.

Ready to integrate?

Get your API key and start embedding AI assisters today.