Quickstart

Create a workspace and a bot, add knowledge, stream a reply and embed the widget, using curl.

Five steps take you from an empty organisation to a knowledge-grounded agent for one of your customers. Use a test key (hk_test_...) while you build, and export it first:

Shell
export HEYLLO_API_KEY="hk_test_..."

The key needs the workspaces:write, bots:write, knowledge:write, knowledge:read, chat:write and bots:read scopes. An organisation key created without narrowing has all of them. Several calls require an Idempotency-Key header; see Idempotency.

1. Create a workspace

Create one workspace per customer of yours. Put your own customer ID in external_id so you can find the workspace again with GET /v1/workspaces?external_id=....

Shell
curl https://api.heyllo.co/v1/workspaces \
  -H "Authorization: Bearer $HEYLLO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ws-cust-881" \
  -d '{"name": "Acme Shoes", "external_id": "cust-881"}'
Response (201)
{
  "id": "ws_4hT8kQ2mZx7LpR1vN9cW3yBd",
  "object": "workspace",
  "name": "Acme Shoes",
  "external_id": "cust-881",
  "status": "active",
  "metadata": {},
  "livemode": false,
  "created": "2026-11-18T09:00:00.000Z"
}

2. Create a bot

Create a bot in the workspace. allowed_domains limits where the widget may load, and widget_enabled turns the widget on.

Shell
curl https://api.heyllo.co/v1/bots \
  -H "Authorization: Bearer $HEYLLO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: bot-cust-881-main" \
  -d '{
    "workspace": "ws_4hT8kQ2mZx7LpR1vN9cW3yBd",
    "name": "Acme Assistant",
    "instructions": "You help Acme customers with orders, sizing and returns.",
    "handoff": { "mode": "ai_until_agent_joins", "notify_emails": ["[email protected]"] },
    "allowed_domains": ["acme.example"],
    "widget_enabled": true
  }'

The response is the bot object. Its id (for example bot_k3x9q2m7v1p8z4w6t5r0y2) is used in the next steps.

3. Add knowledge

Crawl the customer's help pages. Ingestion is asynchronous: the call returns 202 with a knowledge job.

Shell
curl https://api.heyllo.co/v1/bots/bot_k3x9q2m7v1p8z4w6t5r0y2/knowledge/url \
  -H "Authorization: Bearer $HEYLLO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: kb-cust-881-help" \
  -d '{"url": "https://acme.example/help", "max_depth": 2}'
Response (202)
{
  "id": "job_2mQ7nB4xK9pL1vR8cT3wZ6yA",
  "object": "knowledge_job",
  "bot": "bot_k3x9q2m7v1p8z4w6t5r0y2",
  "kind": "url",
  "status": "queued",
  "progress": null,
  "message": null,
  "words": null,
  "livemode": false,
  "created": "2026-11-18T09:01:00.000Z",
  "finished": null
}

Poll the job until status is completed or failed, or subscribe to the knowledge.job.completed and knowledge.job.failed webhooks.

Shell
curl https://api.heyllo.co/v1/knowledge_jobs/job_2mQ7nB4xK9pL1vR8cT3wZ6yA \
  -H "Authorization: Bearer $HEYLLO_API_KEY"

You can also push separate items (stories, articles) as documents under your own IDs with PUT /v1/bots/{id}/knowledge/documents/{external_id}, add files with /knowledge/files (multipart) and Q&A pairs with /knowledge/qa, or let the bot search your own API live. See Knowledge.

4. Start a conversation and stream a reply

Create a conversation for an end user. Passing your own external_id marks the user as verified, so the agent can use what it knows about them from earlier conversations.

Shell
curl https://api.heyllo.co/v1/conversations \
  -H "Authorization: Bearer $HEYLLO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"bot": "bot_k3x9q2m7v1p8z4w6t5r0y2", "end_user": {"external_id": "visitor-5521", "name": "Amina"}}'

The response is the conversation object, with an id such as conv_8LpR3tY6nW1qK9xM2vB5cZ7d. Send the user's message with "stream": true to receive the reply as server-sent events. -N stops curl from buffering the stream.

Shell
curl -N https://api.heyllo.co/v1/conversations/conv_8LpR3tY6nW1qK9xM2vB5cZ7d/messages \
  -H "Authorization: Bearer $HEYLLO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"content": "Do you ship to Nairobi?", "stream": true}'
Stream
event: message.created
data: {"id":"msg_51aH7kP2xQ9mN4vR6tW8yC3b","object":"message","conversation":"conv_8LpR3tY6nW1qK9xM2vB5cZ7d","role":"user","content":"Do you ship to Nairobi?","citations":[],"superseded":false,"created":"2026-11-18T09:05:00.000Z"}

event: response.delta
data: {"text":"Yes, we deliver to Nairobi "}

event: response.delta
data: {"text":"within 3 to 5 working days."}

event: response.completed
data: {"message":{"id":"msg_51bJ3nL8zT5qR2wK7pX4mV9d","object":"message","conversation":"conv_8LpR3tY6nW1qK9xM2vB5cZ7d","role":"assistant","content":"Yes, we deliver to Nairobi within 3 to 5 working days.","citations":[],"superseded":false,"created":"2026-11-18T09:05:02.000Z"},"usage":{"input_tokens":1830,"cached_input_tokens":1536,"cache_write_tokens":0,"output_tokens":96,"reasoning_tokens":0,"total_tokens":1926}}

Leave out "stream": true to wait for the whole reply as JSON. See Streaming for every event.

5. Put the widget on your customer's site

Fetch the embed snippet for the bot and add it to the customer's pages.

Shell
curl https://api.heyllo.co/v1/bots/bot_k3x9q2m7v1p8z4w6t5r0y2/widget \
  -H "Authorization: Bearer $HEYLLO_API_KEY"
Response
{
  "object": "widget",
  "bot": "bot_k3x9q2m7v1p8z4w6t5r0y2",
  "embed_id": "<embed id>",
  "allowed_domains": ["acme.example"],
  "snippet": "<script>window.chatBotConfig = { chatbotId: \"<embed id>\", domain: \"https://heyllo.co\" };</script>\n<script src=\"https://heyllo.co/dist/bundle.js\" defer></script>"
}

The snippet is ready to paste into the page HTML. The embed ID is public by design, since it appears in the page. When the bot has allowed_domains, the widget only loads on those domains.