Advanced Features
API Reference
Integrate hej! directly into your applications.
The hej! API allows you to programmatically interact with your AI chatbot. Send messages, retrieve responses, and integrate chat functionality into your own applications.
Base URL
https://api.hej.chatAuthentication
API requests are authenticated using your domain. For public widget requests, the domain is passed via the data attribute. For server-to-server requests, contact us for API key access.
API Keys
API key authentication is available on Enterprise plans. Contact sales for access.
Endpoints
/api/chatSend a message and receive a streaming AI response.
Request Body
{
"domain": "your-domain.com",
"message": "What are your business hours?",
"conversationId": "optional-conversation-id"
}Response
Returns a streaming response with Server-Sent Events (SSE).
/api/widget-settings/:domainRetrieve widget configuration for a domain.
Response
{
"headerBgColor": "#ffffff",
"headerTextColor": "#000000",
"title": "Chat with us",
"subtitle": "We're here to help",
"position": "right"
}/api/documentRetrieve the content of a specific indexed page.
Request Body
{
"domain": "your-domain.com",
"url": "https://your-domain.com/about"
}Rate Limits
API requests are rate-limited based on your plan:
| Plan | Requests/minute | Conversations/month |
|---|---|---|
| Basic | 30 | 500 |
| Start | 60 | 1,000 |
| Business | 120 | 5,000 |
| Pro | 300 | 10,000 |
| Enterprise | Custom | Unlimited |
Error Handling
{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Too many requests. Please try again later.",
"retryAfter": 60
}
}| Code | Description |
|---|---|
DOMAIN_NOT_FOUND | Domain is not registered |
RATE_LIMIT_EXCEEDED | Too many requests |
QUOTA_EXCEEDED | Monthly conversation limit reached |
SUBSCRIPTION_INACTIVE | Subscription is inactive |