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.
Build Anything with AI
Our REST API gives you the power to integrate AI chatbot capabilities into any application
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.
{
"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.
{
"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.
How It Works
Get started with the AI Chatbot API in three simple steps
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.
Make Your First Request
Send a POST request to our chat endpoint with your message. The AI processes it and returns an intelligent response.
Integrate Anywhere
Use the API in your mobile app, website, internal tools, or any custom platform. The possibilities are endless.
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
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.
Frequently Asked Questions
Everything you need to know about the AI Chatbot API
Your first request
One POST returns an AI answer grounded in your knowledge base. No SDK to install.
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.
# 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
| Field | Type | Required | Description |
|---|---|---|---|
message | string | required | The user's message. An empty value returns a 400. |
session_id | string | optional | Your 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_id | integer | optional | Which of your agents should answer. Omit it and your primary website is used, or the first one on the account. |
Response body
| Field | Type | Description |
|---|---|---|
success | boolean | true when the AI produced an answer. |
response | string | The answer text. |
session_id | string | The 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.
// 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.
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.
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"])
$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'];
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;
}
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.
| Status | Meaning | What to do |
|---|---|---|
400 | Invalid JSON body, missing message, or a website_id that is not on your account. | Fix the payload. The error string names the problem. |
401 | No API key, or the key does not match an account. | Check the header name and that the key was not regenerated. |
403 | The account is on the Free plan. API access needs Starter, Standard or Pro. | Upgrade the plan. |
429 | Monthly message limit reached. The body also carries "limit_reached": true. | Back off and upgrade, or wait for the next billing period. |
503 | The 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
| Method | Path | Purpose |
|---|---|---|
| POST | /chat/ | Send a message, get an AI answer. |
Websites and agents
| Method | Path | Purpose |
|---|---|---|
| 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
| Method | Path | Purpose |
|---|---|---|
| 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
| Method | Path | Purpose |
|---|---|---|
| GET | /conversations/ | Past conversations. |
| GET | /sessions/ | Sessions with message counts. |
| GET | /leads/ | Contact details the chatbot captured. |
| GET | /account/ | Plan, usage and limits. |
Webhooks
| Method | Path | Purpose |
|---|---|---|
| GETPOST | /webhooks/ | List or register a webhook. |
| DELETE | /webhooks/{webhook_id}/ | Remove a webhook. |
Requirements and limits
| Item | Detail |
|---|---|
| Plan | API access requires a paid plan: Starter, Standard or Pro. Free accounts receive a 403. |
| Message allowance | API messages count against the same monthly allowance as widget conversations. Check the current figure with GET /api/v1/account/. |
| History depth | Up to 10 previous messages per session_id are supplied as context. |
| Transport | HTTPS only. JSON request and response bodies. |
| Key rotation | Regenerate 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.