Skip to content
Start free trial

Documentation

Documentation

Get chat onto your site, use the REST API, and receive webhook events.

Add the widget

Get your public widget key from the workspace widget settings, then paste the loader snippet into your site. The loader is 5.4 KB gzipped and lazy-loads the chat panel, so it never slows your page.

Install<script async src="https://widget.enkachat.com/widget.js" data-enkachat-key="YOUR_PUBLIC_KEY"></script>

Use the REST API

The REST API is served from https://api.enkachat.com. Widget routes are public and answer CORS with Access-Control-Allow-Origin: *; agent routes use the enkachat_session cookie. Three auth models cover the API:

  • Public widget key — a key query parameter on GET /widget/config returns the visitor-facing widget settings for a workspace.
  • X-Visitor-Token — the visitor token returned when a widget session is created; it authorizes the visitor REST routes.
  • enkachat_session — the HttpOnly session cookie set on agent login; it authorizes the agent and workspace routes.

Fetch public widget config

curl "https://api.enkachat.com/widget/config?key=YOUR_PUBLIC_KEY"

Receive events with webhooks

Push exchange events into chat with POST https://api.enkachat.com/widget/status-cards. The request authenticates with two headers: X-Workspace-Key (the workspace widget key) and X-EnkaChat-Secret (the crypto.webhook_secret from the workspace widget settings). The body is a StatusCardPushRequest: a session_id, the card to upsert, and an optional mode (update edits the newest card in place, append always inserts a new card).

Push a status card

curl -X POST "https://api.enkachat.com/widget/status-cards" \
  -H "Content-Type: application/json" \
  -H "X-Workspace-Key: YOUR_WORKSPACE_KEY" \
  -H "X-EnkaChat-Secret: YOUR_WEBHOOK_SECRET" \
  -d '{
  "session_id": "3f2a1c4e-8b6d-4f9a-9c2e-5d7b1a0e4f6a",
  "mode": "update",
  "card": {
    "order_id": "ORD-1042",
    "status": "PROCESSING",
    "deposit": {
      "asset": "USDT",
      "amount": "500.00",
      "network": "TRC20",
      "tx_hash": "0x9f2c4e8a1b3d5f7a9c0e2d4b6a8f1c3e",
      "explorer_url": "https://tronscan.org/#/transaction/0x9f2c4e8a1b3d5f7a9c0e2d4b6a8f1c3e"
    },
    "payout": {
      "asset": "BTC",
      "amount": "0.0125",
      "network": "Bitcoin",
      "tx_hash": "1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d",
      "explorer_url": "https://mempool.space/tx/1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d"
    },
    "steps": [
      { "label": "Deposit received", "state": "completed", "time": "2026-10-02T09:12:00Z" },
      { "label": "Processing", "state": "active" },
      { "label": "Payout sent", "state": "pending" }
    ]
  }
}'