Skip to content

Developer API

Keep your chatbot’s knowledge up to date from your own system. Push text or Markdown, review the changes, then publish them through the API. Your integration controls when to sync; no manual portal action is required for each update.

This API publishes public chatbot knowledge. It does not provide live CRM lookups, authenticated end-customer data, or model tool/function execution. Keep private customer/order records out of the public knowledge base.

  • Contract / source of truth: openapi.yaml
  • Base path: all endpoints are mounted under /api, e.g. POST /api/v1/sources
  1. Concepts
  2. Quickstart
  3. Authentication & key rotation
  4. Items: single, batch, snapshot, deletes & tombstones
  5. Runs & publishing
  6. Idempotency
  7. Rate limits
  8. Errors
  9. Request activity
  10. Webhooks & signature verification
  11. Examples — curl, JavaScript, Python, C#, GitHub Actions

flowchart LR
A[Your system] -->|push items| B[Staging set]
B -->|start run| C[Run: diff vs last applied]
C -->|apply| D[Generation built + published]
D --> E[Widget / assistant serves it]
Term Meaning
Source A container of type developer_api that owns a staging set, its runs and its published generations. Create one per logical content collection.
Item A single piece of content identified by a stable externalItemId you own. Re-using the id upserts the same item.
Staging set The full desired state of a source. You mutate it (upsert / delete / snapshot); a run reads it.
Run Reads the staging set, diffs it against the last applied state, records the changes. Runs execute synchronously.
Apply Builds and publishes a new generation from a run. The serving layer uses it immediately.
Generation An immutable, published snapshot of the knowledge base that the widget and assistant read from.

The golden rule: the staging set is the whole truth. A run with complete discovery turns items you removed into tombstones (subject to the source’s grace window); a rolling upsert/batch only touches the items it names.


A tenant administrator first creates an API key in the admin portal (or via POST /api/v1/admin/keys). The key secret is shown once.

Terminal window
export CHATBOT_API="https://your-host/api"
export CHATBOT_KEY="sk_live_xxxxxxxxxxxxxxxx_..."
# 1. One-time setup: create a source and save its ID for future syncs.
# Requires sources:write. Do not repeat source creation on every scheduled run.
SID=$(curl -fsS -X POST "$CHATBOT_API/v1/sources" \
-H "Authorization: Bearer $CHATBOT_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Help center","graceDays":7}' | jq -r .source.id)
export CHATBOT_SOURCE_ID="$SID"
# 2. Push an item
curl -fsS -X POST "$CHATBOT_API/v1/sources/$SID/items" \
-H "Authorization: Bearer $CHATBOT_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"externalItemId":"faq-1","title":"Refunds","content":"Refunds take 14 days."}'
# 3. Run, then apply (publish)
RUN=$(curl -fsS -X POST "$CHATBOT_API/v1/sources/$SID/runs" \
-H "Authorization: Bearer $CHATBOT_KEY")
echo "$RUN" | jq -e '.applyEligible == true' >/dev/null || exit 1
RID=$(echo "$RUN" | jq -r .run.id)
curl -fsS -X POST "$CHATBOT_API/v1/sources/$SID/runs/$RID/apply" \
-H "Authorization: Bearer $CHATBOT_KEY"
# → 202 { "apply": { "status": "queued", ... }, "poll": "v1/sources/.../apply" }
# 4. Poll this URL until apply.status is succeeded or failed.
curl -fsS "$CHATBOT_API/v1/sources/$SID/runs/$RID/apply" \
-H "Authorization: Bearer $CHATBOT_KEY" | jq .apply

Content becomes live only after the apply job succeeds. queued or running means it is still being processed; check again after a short delay. On failure, inspect error and resultStatus. Full polling loops are included in examples/, and all job states are described in Runs & publishing.

For later updates, reuse CHATBOT_SOURCE_ID and the same externalItemId for each article. The regular sync key needs items:write, runs:execute, runs:apply and runs:read; source setup uses sources:write separately.


Source creation, item writes, run creation and apply requests accept an Idempotency-Key header (any unique string — a UUID is ideal). For these operations, retrying with the same key has the following behavior:

  • Same key + same payload → the original result is replayed.
  • Same key + different payload → 409 idempotency_conflict.
  • Keys are retained for 24 hours.

Item upserts are also naturally idempotent on (source, externalItemId), so a retried upsert never creates a duplicate even without a key. Use the header to make batches and runs safe to retry as a unit.

Terminal window
curl -X POST "$CHATBOT_API/v1/sources/$SID/items/batch" \
-H "Authorization: Bearer $CHATBOT_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: import-2024-06-01-batch-7" \
-d '{"items":[ ... ]}'

Requests are limited per API key (independent of source IP). The default is 300 requests/minute, configurable by the service operator. Exceeding the active limit returns 429 with Retry-After: 60:

{ "error": "Too many requests. Please slow down.", "code": "rate_limited" }

Back off and retry after the indicated delay. Batch changes instead of making a request for every small edit. Keep retries bounded and retain the same Idempotency-Key when retrying the same write operation.


All errors share a stable shape:

{ "error": "human readable message", "code": "machine_code" }
Status code Meaning
400 validation_error The body failed validation.
400 / 409 unsupported_publication_target Only public knowledge for public_widget is supported. Unsupported existing sources/items cannot be published.
400 invalid_json / invalid_body Body was not valid JSON.
401 unauthorized Missing/malformed Authorization header.
401 invalid_key / key_expired / key_revoked The key is not usable.
403 insufficient_scope The key lacks the scope the endpoint requires.
404 not_found Source / run not found (or not a developer_api source).
409 idempotency_conflict Idempotency-Key reused with a different payload.
409 idempotency_in_progress A request with this key is still running.
409 source_inactive The source is archived.
409 not_apply_eligible Run discovery was incomplete — cannot apply.
409 apply_conflict / stale_plan / stale_base / lease_lost / apply_in_progress Transient — retry the apply.
413 payload_too_large Body exceeded the size limit (1 MiB single, 8 MiB batch).
415 unsupported_media_type Content-Type was not application/json.
429 rate_limited Per-key rate limit exceeded.
502 build_failed The knowledge build failed; the previous generation keeps serving.

Tenant administrators can open API og webhooks in the customer portal to see recent Developer API calls, up to seven days and 10,000 entries. Filter by errors to find failed calls and match the request ID to the X-Request-Id response header in your integration’s logs.

Each entry shows the time, API key name, HTTP method, route, response status, and duration, plus a stable error code when available. The history covers completed calls authenticated with a Developer API key. It may take a few seconds for a call to appear. The server assigns the response request ID. The history stores diagnostic metadata without request bodies or credentials. Outgoing webhook deliveries have their own history on the same page.