Skip to content

API reference

These are the endpoints behind the widget. They live under your Mikabot app domain, accept JSON, and return JSON. Use them when you build your own chat surface or track products you render yourself.

How a request is accepted

Every chat request is validated against the chatbot’s configuration before it is answered. Requests that fail validation are not answered, and appear in the chatbot’s failed logs — the fastest way to diagnose a widget that stays silent.

Send a message

POST /api/chat/send

{
  "message": "Which watering can suits a small balcony?",
  "store_id": "st_your_chatbot_key",
  "page_url": "https://yourshop.com/collections/tools",
  "session_id": "visitor-session-id",
  "conversation_history": [],
  "detected_language": "en"
}
  • message — the visitor’s text
  • store_id — your chatbot key
  • page_url — the page the visitor is on, used for the domain check and shown in your chat logs
  • session_id — groups turns into one conversation. Generate one per visitor.
  • conversation_history — earlier turns. Send an empty array for a one-off question.
  • detected_language — overrides automatic detection

The answer is returned in the response field, together with any products the bot decided to show.

Store information

POST /api/ai-responses/store-info returns the public details used in greetings and placeholders. Send store_id, language, and page_url.

Product tracking

Use these when you render product cards yourself and still want the numbers in your dashboard.

POST /api/product/click

  • product_external_id (required) — the product’s ID in your feed
  • click_type (required) — buy_now, view_product, or ask_ai
  • session_id, page_url, detected_language (optional)

POST /api/product/impressions

  • products (required) — an array, each entry with a product_external_id
  • impression_type (required) — display, search_result, or direct_hit
  • session_id, page_url, detected_language (optional)

GET /api/product/click-stats

  • period (optional) — today, week, month, or all
  • product_id (optional) — limit the totals to one product

Errors

  • 402 with code message_limit_reached — the monthly message limit of the billing account is used up. Chat stops until the next period.
  • 503 with code api_unavailable — the AI provider is temporarily unavailable.
  • Other failures return an error field with a readable message.

Requests that error are not counted against your monthly message limit.