API Reference
Build custom integrations with the Asyntai REST API
Paid Plan Required: API access is available on Starter, Standard, and Pro plans. View pricing
Overview
The Asyntai API allows you to integrate AI-powered customer support into any application. Send messages and receive intelligent responses trained on your website content and knowledge base.
Authentication
All API requests require authentication using your API key. You can get your API key from the API Settings page.
Include your API key in requests using one of these methods:
- Authorization header (recommended):
Authorization: Bearer YOUR_API_KEY - X-API-Key header:
X-API-Key: YOUR_API_KEY
Keep your API key secret. Anyone with your key can access your account via the API. Never expose it in client-side code.
Base URL
https://asyntai.com/api/v1/
Endpoints
POST /chat/
Send a message and receive an AI-generated response.
Request Body
{
"message": "What are your business hours?",
"session_id": "user_123", // optional
"website_id": 1 // optional
}
| Parameter | Type | Required | Description |
|---|---|---|---|
message |
string | Yes | The user's message to send to the AI |
session_id |
string | No | Unique identifier for the conversation. Use the same session_id to maintain conversation history. |
website_id |
integer | No | Specific website ID. If not provided, uses your primary website. |
Response
{
"success": true,
"response": "Our business hours are Monday-Friday, 9 AM to 5 PM EST.",
"session_id": "user_123"
}
Example (cURL)
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 business hours?", "session_id": "user_123"}'
Example (Python)
import requests
response = requests.post(
"https://asyntai.com/api/v1/chat/",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"message": "What are your business hours?",
"session_id": "user_123"
}
)
data = response.json()
print(data["response"])
Example (JavaScript)
const response = await fetch("https://asyntai.com/api/v1/chat/", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
message: "What are your business hours?",
session_id: "user_123"
})
});
const data = await response.json();
console.log(data.response);
GET /websites/
List all websites associated with your account.
Response
{
"success": true,
"websites": [
{
"id": 1,
"name": "My Website",
"domain": "example.com",
"is_primary": true
}
]
}
Example (cURL)
curl https://asyntai.com/api/v1/websites/ \
-H "Authorization: Bearer YOUR_API_KEY"
GET /conversations/
Retrieve conversation history for a specific session.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
session_id |
string | Yes | The session ID to retrieve history for |
limit |
integer | No | Max messages to return (default: 50, max: 100) |
Response
{
"success": true,
"session_id": "user_123",
"messages": [
{
"role": "user",
"content": "What are your business hours?",
"timestamp": "2024-01-15T10:30:00Z"
},
{
"role": "assistant",
"content": "Our business hours are Monday-Friday, 9 AM to 5 PM EST.",
"timestamp": "2024-01-15T10:30:01Z"
}
]
}
Example (cURL)
curl "https://asyntai.com/api/v1/conversations/?session_id=user_123&limit=20" \
-H "Authorization: Bearer YOUR_API_KEY"
GET /account/
Get your account information and usage statistics.
Response
{
"success": true,
"account": {
"email": "you@example.com",
"plan": "starter",
"messages_used": 150,
"messages_limit": 2500
}
}
Example (cURL)
curl https://asyntai.com/api/v1/account/ \
-H "Authorization: Bearer YOUR_API_KEY"
Error Responses
All error responses follow this format:
{
"success": false,
"error": "Error message describing what went wrong"
}
| Status Code | Description |
|---|---|
400 |
Bad Request - Invalid parameters or missing required fields |
401 |
Unauthorized - Invalid or missing API key |
429 |
Too Many Requests - Message limit reached for your plan |
503 |
Service Unavailable - AI service temporarily unavailable |
Rate Limits
API usage is limited by your subscription plan:
- Free: 100 messages/month
- Starter ($39/mo): 2,500 messages/month
- Standard ($139/mo): 15,000 messages/month
- Pro ($449/mo): 50,000 messages/month
Need Help?
If you have any questions or run into issues, contact us at hello@asyntai.com.