API
Call the ASE chat API directly: start a session, send messages, read the widget configuration and attach store context, with widget or secret key authentication.
The widget talks to a small JSON API. You can call it yourself to build a custom chat interface, a mobile app or a server-side integration. Base URL: https://app.ase.support/api/v1.
Authentication
Send one of two headers on every request:
X-Widget-Key: pk_…— from a browser on the registered domain. TheOriginof the request must match the key's domain.X-Secret-Key: …— from your server. See keys.
Responses are JSON. Errors return a non-200 status and {"error": "…"}. Authentication errors use 401 and 403; quota limits use 429.
Start a session
POST /api/v1/chat/init
Content-Type: application/json
{
"lang": "en",
"page_url": "https://mystore.com/shipping",
"page_title": "Shipping information",
"meta_desc": "Delivery times and costs",
"page_lang": "en"
}
Returns {"session_id": "…", …} together with the agent's greeting settings. Pass your own session_id to resume a session. The page fields are optional; they let the agent know where the visitor is.
Send a message
POST /api/v1/chat
Content-Type: application/json
{ "session_id": "…", "lang": "en", "message": "How long does shipping take?" }
{
"response": "Orders ship within 2 business days…",
"answered_by": "intent" | "ai",
"session_id": "…",
"usage": { "tokens_in": 1234, "tokens_out": 87 } // only when answered_by is "ai"
}
Intents are checked first; a match returns instantly with answered_by: "intent". Otherwise the AI answers using the relevant knowledge base entries and the last messages of the session.
Widget configuration
GET /api/v1/widget/config
Returns the agent's display settings (name, colours, position, greeting, active plugins and their settings, interface strings). The widget calls this on load; use it if you build your own interface.
Attach store context
POST /api/v1/context
Content-Type: application/json
{ "session_id": "…", "context": "Customer: Jane Doe. Last order #1042 shipped 12 Nov, tracking XY123." }
Stores free-form context for the session. The agent sees it on the next messages, so it can answer "where is my order?" with the actual order. Send it from your server with a secret key, or from your store's page scripts for the current logged-in customer. Keep it short and only include what the agent needs.
Limits
- A message is one AI message against your monthly quota, unless an intent answered it.
- Message text is limited to a few thousand characters; the API returns 400 for an empty message.
- The conversation history sent to the AI is the last 20 messages of the session.