REST API
Complete AskIA REST API documentation for building custom integrations.
The API is accessible at
askia-pcg.vercel.app/api
Authentication
For now, the public widget API doesn't require authentication. Protected endpoints require a JWT token (coming soon).
Available Endpoints
POST
/api/widget/chat
Send a message to the bot
Send a message to a bot and receive an AI-generated response.
Request Body
Parameter | Type | Description |
---|---|---|
botId required | string | The unique bot ID |
message required | string | The user's message |
conversationId | string | Conversation ID to maintain context |
Request Example
fetch('askia-pcg.vercel.app/api/widget/chat', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
botId: 'YOUR_BOT_ID',
message: 'What are your pricing plans?',
conversationId: 'optional-conversation-id'
})
})
.then(res => res.json())
.then(data => console.log(data))
Response
{
"reply": "We offer three pricing plans: Free, Pro ($29/month), and Enterprise (custom pricing)...",
"conversationId": "conv_abc123",
"messageId": "msg_xyz789"
}
GET
/api/bots/:id
Get bot information
Retrieve bot metadata and configuration.
URL Parameters
Parameter | Type | Description |
---|---|---|
id required | string | The bot ID |
Request Example
fetch('askia-pcg.vercel.app/api/bots/YOUR_BOT_ID')
.then(res => res.json())
.then(data => console.log(data))
Response
{
"id": "bot_abc123",
"name": "Customer Support Assistant",
"description": "Helps customers with product questions",
"category": "support",
"language": "en",
"createdAt": "2024-01-15T10:00:00Z"
}
GET
/api/bots/:id/branding
Get bot branding
Retrieve the bot's visual customization settings.
Response
{
"primaryColor": "#6366f1",
"backgroundColor": "#ffffff",
"textColor": "#1f2937",
"logoUrl": "https://example.com/logo.png",
"position": "bottom-right",
"theme": "light"
}
Error Codes
Parameter | Type | Description |
---|---|---|
400 | Bad Request | Missing or invalid parameters |
404 | Not Found | Bot not found |
429 | Too Many Requests | Rate limit exceeded |
500 | Internal Server Error | Server error |
The API is in beta. Endpoints may evolve. Check this documentation regularly for updates.
Rate Limits
The following limits apply to the public API:
- Free plan: 100 requests/hour
- Pro plan: 1,000 requests/hour
- Enterprise plan: Custom