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.chat

Authentication

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

POST/api/chat

Send 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).

GET/api/widget-settings/:domain

Retrieve widget configuration for a domain.

Response

{
  "headerBgColor": "#ffffff",
  "headerTextColor": "#000000",
  "title": "Chat with us",
  "subtitle": "We're here to help",
  "position": "right"
}
POST/api/document

Retrieve 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:

PlanRequests/minuteConversations/month
Basic30500
Start601,000
Business1205,000
Pro30010,000
EnterpriseCustomUnlimited

Error Handling

{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Too many requests. Please try again later.",
    "retryAfter": 60
  }
}
CodeDescription
DOMAIN_NOT_FOUNDDomain is not registered
RATE_LIMIT_EXCEEDEDToo many requests
QUOTA_EXCEEDEDMonthly conversation limit reached
SUBSCRIPTION_INACTIVESubscription is inactive
Feedback

Route: /docs/api