API Reference
The Awentail API lets you interact with your AI assistants programmatically. The chat endpoint is public (no authentication required) — it’s designed for widget embedding.
Base URL
https://app.awentail.com/api
Chat Endpoint
POST /api/chat/:botId
Send a message to an AI assistant and receive a response.
URL parameters:
| Parameter | Type | Description |
|---|---|---|
botId | string | Unique assistant identifier (UUID) |
Request body:
{
"message": "How do I reset my password?",
"conversationId": "optional-conversation-id"
}
| Field | Type | Required | Description |
|---|---|---|---|
message | string | Yes | The user’s message |
conversationId | string | No | Existing conversation ID for context continuity |
Response:
{
"reply": "To reset your password, go to Settings > Security and click 'Change Password'. You'll need to enter your current password first.",
"conversationId": "conv_abc123"
}
| Field | Type | Description |
|---|---|---|
reply | string | AI-generated assistant response |
conversationId | string | Conversation ID for follow-up messages |
Example:
curl -X POST https://app.awentail.com/api/chat/your-bot-id \
-H "Content-Type: application/json" \
-d '{"message": "What are your pricing plans?"}'
Rate Limiting
The chat endpoint is rate-limited to prevent abuse:
| Scope | Limit |
|---|---|
| Per IP + Assistant | 30 requests/minute |
When the limit is exceeded, the API returns a 429 Too Many Requests response.
Widget Configuration
GET /api/chat/:botId/config
Get an assistant’s widget configuration (name, welcome message, colors).
Response:
{
"name": "Support Assistant",
"welcomeMessage": "Hi! How can I help you today?",
"color": "#7C3AED"
}
Error responses
All errors follow a consistent format:
{
"error": "Error description"
}
Common error codes:
| Status | Meaning |
|---|---|
400 | Bad request — missing or invalid fields |
404 | Assistant not found |
429 | Rate limit exceeded |
500 | Internal server error |
Authentication
The chat endpoint does not require authentication. It’s designed for public use in embedded widgets.
All admin endpoints (creating assistants, uploading documents, viewing analytics) require a JWT token obtained by logging in. These endpoints are used internally by the Awentail dashboard and are not documented as a public API.
CORS
The chat API supports CORS from any origin, so the widget works on any website.
Webhooks
Awentail uses Stripe webhooks for billing events. If you need webhook notifications for chat events, contact us — we’re working on it.