AI Chatbot API

Build custom AI chatbot integrations with our REST API. Send messages and get intelligent AI-powered responses for any platform, application, or custom solution.

Get API Key See Pricing

Build Anything with AI

Our REST API gives you the power to integrate AI chatbot capabilities into any application

# Send a message to AI
curl -X POST https://asyntai.com/api/v1/chat/ \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message": "What are your hours?"}'

Simple REST API

A single API endpoint to send messages and get AI responses. Use cURL, Python, JavaScript, or any language that can make HTTP requests. No complex SDKs required.

# AI Response
{
  "success": true,
  "response": "We're open Monday-Friday,
    9am-6pm EST. How can I help?"
,
  "session_id": "abc123"
}

Intelligent Responses

The AI knows your business inside out. It learns from your website, documents, and custom instructions to provide accurate, contextual answers to any question.

# Conversation with context
{
  "message": "What was my last question?",
  "session_id": "user_12345"
}

# AI remembers the conversation

Conversation Memory

Use session IDs to maintain conversation context. The AI remembers previous messages and provides coherent, contextual responses across multiple interactions.

Built for Developers

Everything you need to integrate AI chatbot capabilities into your applications

RESTful Design

Clean, intuitive REST API that follows best practices. Easy to understand, easy to integrate, easy to maintain.

Simple Authentication

Secure API key authentication. Just include your key in the header and you're ready to make requests.

Fast Response Times

Optimized for speed. Get AI-powered responses in milliseconds, not seconds.

Session Management

Built-in conversation tracking with session IDs. Maintain context across multiple messages effortlessly.

Multi-Language

The AI automatically detects and responds in the user's language. Support global audiences without extra work.

Secure & Reliable

HTTPS encryption, rate limiting, and 99.9% uptime. Your integration is safe and always available.

Ready to build with the AI Chatbot API?

Start free with 50 messages. No credit card required.

Get Your API Key

How It Works

Get started with the AI Chatbot API in three simple steps

1

Sign Up & Get API Key

Create your account and generate your API key from the dashboard. Your AI will automatically learn from your website content.

2

Make Your First Request

Send a POST request to our chat endpoint with your message. The AI processes it and returns an intelligent response.

3

Integrate Anywhere

Use the API in your mobile app, website, internal tools, or any custom platform. The possibilities are endless.

View API Documentation

Use Cases

The AI Chatbot API is versatile and can power AI support across any platform or application you can imagine.

  • ✓ Mobile apps (iOS, Android, React Native)
  • ✓ Custom web applications
  • ✓ Internal support tools
  • ✓ Voice assistants and IVR systems
  • ✓ Slack bots, Discord bots, and more
# Python example
import requests

response = requests.post(
  "https://asyntai.com/api/v1/chat/",
  headers={"Authorization": "Bearer API_KEY"},
  json={"message": "Hello!"}
)

print(response.json()["response"])

Why Choose Our API

Build powerful AI chatbot integrations with minimal effort

Ship Faster

Skip months of AI development. Integrate our API and have intelligent chatbot capabilities in your app today.

Always Learning

Update your AI's knowledge anytime through the dashboard. No API changes needed when your business evolves.

Cost Effective

Pay only for what you use. No infrastructure costs, no model costs, no maintenance overhead.

Start building today

100 free API calls included. Upgrade anytime as your usage grows.

Get Your API Key

Frequently Asked Questions

Everything you need to know about the AI Chatbot API

How do I get started with the API?
Click here to get your API key. Create an account, enter your website URL (so the AI learns about your business), and generate your API key. Then make your first request using cURL, Python, JavaScript, or any HTTP client.
What programming languages are supported?
Any language that can make HTTP requests works with our API. This includes Python, JavaScript, PHP, Ruby, Java, C#, Go, Swift, Kotlin, and many more. We provide code examples in our documentation.
How does conversation context work?
Include a session_id parameter in your requests. The AI will remember all previous messages in that session and provide contextual responses. Use any unique identifier for each user or conversation.
How does the AI know about my business?
You can give the AI knowledge about your business by uploading your website URL (we'll crawl it automatically), uploading documents (PDFs, text files), adding custom instructions, or providing specific Q&A pairs. All this is done through the dashboard - no API changes needed.
What are the rate limits?
Rate limits depend on your plan. The API is designed for real-time chat applications. If you need higher limits for your use case, contact us and we'll work with you.
Is the API secure?
Yes. All API requests use HTTPS encryption. Your API key should be kept secret and never exposed in client-side code. We recommend making API calls from your backend server.
Developer reference

Your first request

One POST returns an AI answer grounded in your knowledge base. No SDK to install.

POST /api/v1/chat/curl
curl -X POST https://asyntai.com/api/v1/chat/ \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message": "Do you ship to Germany?"}'

# 200 OK
{
  "success": true,
  "response": "Yes, we ship to Germany in 3-5 days.",
  "session_id": "api_1042_87"
}

Before your first call, add content to your knowledge base. The API answers from your own documentation, prices and policies. With an empty knowledge base the answers are generic.

Authentication

Every request carries your API key in a header. Two header forms are accepted and they behave identically. Pick one. Generate the key at Settings → API.

Headers only. The key is never read from the query string. A key in a URL leaks into web server logs, proxy logs, browser history and Referer headers, so that method is not supported.

Two accepted formshttp
# Option A - bearer token
Authorization: Bearer YOUR_API_KEY

# Option B - dedicated header
X-API-Key: YOUR_API_KEY

The chat endpoint

POST https://asyntai.com/api/v1/chat/

Request body

FieldTypeRequiredDescription
messagestringrequiredThe user's message. An empty value returns a 400.
session_idstringoptionalYour own identifier for one conversation. Send the same value again to keep context. Omit it and the account falls back to a single shared session.
website_idintegeroptionalWhich of your agents should answer. Omit it and your primary website is used, or the first one on the account.

Response body

FieldTypeDescription
successbooleantrue when the AI produced an answer.
responsestringThe answer text.
session_idstringThe session this message was filed under. Send it back on the next call.

Conversation memory

Pass a stable session_id and the last 10 messages of that conversation are supplied as context, so a follow-up such as "and how much is that?" resolves correctly. Use a different session_id per end user. If you omit it, every caller on the account shares one thread, which is almost never what you want in production.

Keeping context across two callsjson
// first call
{ "message": "Do you ship to Germany?", "session_id": "user-8842" }

// second call - same session_id, so "that" is understood
{ "message": "How much does that cost?", "session_id": "user-8842" }

Integration examples

Copy, paste, replace the key.

Server-side fetchjavascript
const res = await fetch('https://asyntai.com/api/v1/chat/', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    message: 'Do you ship to Germany?',
    session_id: 'user-8842'
  })
});

const data = await res.json();
if (!data.success) throw new Error(data.error);
console.log(data.response);

// Never ship your API key in browser code. Call this from your
// own server or an edge function and proxy the result.
Python 3python
import requests

resp = requests.post(
    "https://asyntai.com/api/v1/chat/",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "message": "Do you ship to Germany?",
        "session_id": "user-8842",
    },
    timeout=30,
)

data = resp.json()
if not data["success"]:
    raise RuntimeError(data["error"])

print(data["response"])
PHP 8php
$ch = curl_init('https://asyntai.com/api/v1/chat/');
curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer YOUR_API_KEY',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'message'    => 'Do you ship to Germany?',
        'session_id' => 'user-8842',
    ]),
]);

$data = json_decode(curl_exec($ch), true);
curl_close($ch);

if (empty($data['success'])) {
    throw new Exception($data['error']);
}
echo $data['response'];
Node.js 18+javascript
const ASYNTAI_KEY = process.env.ASYNTAI_API_KEY;

export async function ask(message, sessionId) {
  const res = await fetch('https://asyntai.com/api/v1/chat/', {
    method: 'POST',
    headers: {
      'X-API-Key': ASYNTAI_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ message, session_id: sessionId })
  });

  if (res.status === 429) throw new Error('Monthly message limit reached');

  const data = await res.json();
  if (!data.success) throw new Error(data.error);
  return data.response;
}
Shellcurl
curl -X POST https://asyntai.com/api/v1/chat/ \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Do you ship to Germany?",
    "session_id": "user-8842"
  }'

Error responses

Every failure returns {"success": false, "error": "..."} with one of these status codes.

StatusMeaningWhat to do
400Invalid JSON body, missing message, or a website_id that is not on your account.Fix the payload. The error string names the problem.
401No API key, or the key does not match an account.Check the header name and that the key was not regenerated.
403The account is on the Free plan. API access needs Starter, Standard or Pro.Upgrade the plan.
429Monthly message limit reached. The body also carries "limit_reached": true.Back off and upgrade, or wait for the next billing period.
503The AI service failed to answer this request.Retry with backoff. This is transient.

Check success, not only the status code. Handle 429 explicitly if you send traffic in bulk, otherwise a reached limit looks like a generic failure to your users.

Full endpoint reference

Base URL https://asyntai.com/api/v1/. Every endpoint uses the same authentication.

Chat

MethodPathPurpose
POST/chat/Send a message, get an AI answer.

Websites and agents

MethodPathPurpose
GETPOST/websites/List your agents, or create one and start a crawl.
GET/websites/{id}/Details for one agent.
GETPATCH/websites/{id}/settings/Read or update widget settings.
GETPUT/websites/{id}/instructions/Read or replace the AI instructions.

Knowledge base

MethodPathPurpose
GET/knowledge/List everything the AI can draw on.
POST/knowledge/text/Add plain text.
POST/knowledge/url/Add a page by URL.
POST/knowledge/spreadsheet/Add a spreadsheet.
GETDELETE/knowledge/{context_id}/Read or remove one item.
POSTPUT/knowledge/{context_id}/tags/Manage tags on an item.

Conversations and data

MethodPathPurpose
GET/conversations/Past conversations.
GET/sessions/Sessions with message counts.
GET/leads/Contact details the chatbot captured.
GET/account/Plan, usage and limits.

Webhooks

MethodPathPurpose
GETPOST/webhooks/List or register a webhook.
DELETE/webhooks/{webhook_id}/Remove a webhook.

Requirements and limits

ItemDetail
PlanAPI access requires a paid plan: Starter, Standard or Pro. Free accounts receive a 403.
Message allowanceAPI messages count against the same monthly allowance as widget conversations. Check the current figure with GET /api/v1/account/.
History depthUp to 10 previous messages per session_id are supplied as context.
TransportHTTPS only. JSON request and response bodies.
Key rotationRegenerate the key from Settings → API. The old key stops working immediately.

Ready to Build with AI?

Start free with 100 API calls and see how easy it is to add AI chatbot capabilities to your application.

Get API Key - No Credit Card Required