API & AI integration

Full workspace access via an API key: create and configure bots, manage channels, broadcasts and the inbox programmatically โ€” or connect an AI (Claude and others) over MCP so it does the work for you.

1. Authentication & conventions

Every request carries the header Authorization: Bearer bs_live_โ€ฆ. Create a key in the app: Settings โ†’ API โ†’ Create key (shown once). A key has a scope (whole workspace / organization / project) and a role (admin / editor / operator) โ€” default is whole-workspace + admin; for integrations grant the narrowest scope and role (least privilege). Billing is available only to a whole-workspace admin key.

API base URL: https://ultrabot.work/api

curl https://ultrabot.work/api/bots \
  -H "Authorization: Bearer bs_live_YOUR_KEY"

Keys via API

Keys can be managed programmatically too: GET /api/keys โ€” list {id, name, prefix, created_at, revoked}; POST /api/keys {name} โ†’ {key, prefix, name} (the full bs_live_โ€ฆ key is returned once โ€” store it immediately); POST /api/keys/revoke {id} โ€” revoke. One key = one workspace.

Formats & errors

Request and response bodies are JSON (content-type: application/json). Success โ€” a 2xx code and JSON. Errors return an HTTP code and a plain-text message body (not JSON): branch on the status code, show the text as-is.

CodeMeaning
400Bad request (body/params)
401Missing or expired authorization
402Plan limit reached โ€” upgrade required
403Insufficient permissions (role)
404Not found
429Rate limit exceeded
5xxServer error

Rate limits

Per IP+path, 60-second window: register/forgot โ€” 5; login/reset-confirm โ€” 20; billing/subscribe โ€” 10; bots/import โ€” 10; templates/clone โ€” 20; widget messages โ€” 60. Other endpoints have no hard limit. On excess โ€” 429.

IDs & idempotency

Bot id looks like bot_โ€ฆ; a dialog id (sid) is the chat id as a string. PUT /api/bots/{id}/graph is a full replace of the draft (not a patch). POST /api/bots/{id}/publish creates a new snapshot version (publishing again = a new version; roll back via POST /api/bots/{id}/rollback/{version}).

2. Quick start: create and publish a bot

# 1) create a bot (returns id)
curl -X POST https://ultrabot.work/api/bots \
  -H "Authorization: Bearer $KEY" -H "content-type: application/json" \
  -d '{"name":"My bot"}'

# 2) set the flow (graph)
curl -X PUT https://ultrabot.work/api/bots/BOT_ID/graph \
  -H "Authorization: Bearer $KEY" -H "content-type: application/json" \
  -d '{"states":[...],"transitions":[...]}'

# 3) connect Telegram and publish
curl -X PUT https://ultrabot.work/api/bots/BOT_ID/telegram \
  -H "Authorization: Bearer $KEY" -H "content-type: application/json" -d '{"token":"123:ABC"}'
curl -X POST https://ultrabot.work/api/bots/BOT_ID/publish -H "Authorization: Bearer $KEY"

3. Full endpoint reference

Base URL: https://ultrabot.work/api. Every request carries Authorization: Bearer bs_live_โ€ฆ. A key works within its scope and role (default โ€” whole workspace, admin; then all endpoints below are available except the platform super-admin panel). {id} โ€” bot ID, {sid} โ€” dialog ID (chat id).

Bots & graph

Method and pathDescription
GET /api/botsList active bots
POST /api/botsCreate a bot (draft) {name} โ†’ {id}
GET /api/bots/{id}Bot + graph (states, transitions)
PUT /api/bots/{id}/graphReplace the graph {states, transitions}
POST /api/bots/{id}/publishPublish (graph snapshot โ†’ live)
GET /api/bots/{id}/validateValidate the graph: errors/warnings
POST /api/bots/{id}/simulateTest run {text} | {button} | {reset:true}
GET /api/bots/{id}/versionsPublish history
POST /api/bots/{id}/rollback/{version}Roll the publication back to a version
GET /api/bots/{id}/exportExport the bot to JSON
POST /api/bots/importImport a bot from JSON
GET /api/templates ยท POST /api/templates/{tid}/cloneTemplate gallery and cloning
DELETE /api/bots/{id}Move to trash (soft: the bot stops replying, frees a slot)
GET /api/bots/archivedTrash: deleted bots
POST /api/bots/{id}/restoreRestore from trash (as a draft)
DELETE /api/bots/{id}/purgeDelete permanently (trash only) โ€” irreversible

Website widget

A floating chat button on any site โ€” one line (async, no page slowdown; full-screen on mobile):

<script src="https://ultrabot.work/widget.js" data-bot="BOT_ID" async></script>

Appearance (color, position, round button / side tab, theme, greeting bubble, avatar, branding) is configured in the app: bot โ†’ Website chat. Public config โ€” GET /api/widget/{id}/config; save โ€” PUT /api/bots/{id}/widget (editor+). Alternative โ€” embed via <iframe src="https://ultrabot.work/widget/BOT_ID">.

Channels

Method and pathDescription
GET/PUT /api/bots/{id}/telegramConnect Telegram {token}
GET/PUT /api/bots/{id}/viberConnect Viber {token}
GET/PUT /api/bots/{id}/channel/{name}External channel: vk, ok, max, whatsapp, instagram, messenger, avito
GET/PUT /api/bots/{id}/commandsTelegram command menu {list}
GET/PUT /api/bots/{id}/comments-replyAuto-reply to comments โ†’ DM
GET/PUT /api/bots/{id}/webhook-outOutbound webhooks on bot events

Marketing

Method and pathDescription
GET/POST /api/bots/{id}/broadcastsBroadcasts (with segments/scheduling)
GET /api/bots/{id}/segment-count?tag=Segment size by tag
GET/POST /api/bots/{id}/sequencesDrip sequences
DELETE /api/bots/{id}/sequences/{sid}Delete a sequence
POST /api/bots/{id}/sequences/{sid}/enroll-allEnroll all contacts into a sequence

Contacts & CRM

Method and pathDescription
GET /api/bots/{id}/contacts?tag=&q=Subscribers (filter by tag/search)
POST /api/bots/{id}/contacts/tagTag a subscriber {cid, tag, action}
POST /api/bots/{id}/contacts/bulk-tagBulk tag assignment
GET /api/bots/{id}/contacts/exportExport subscribers to CSV
GET/POST /api/bots/{id}/deals ยท DELETE โ€ฆ/deals/{did}Mini-CRM: deals
GET/POST /api/bots/{id}/products ยท DELETE โ€ฆ/products/{pid}Product catalog

AI & knowledge base

Method and pathDescription
GET/PUT /api/bots/{id}/aiBot AI provider {provider, api_key, model}
GET/POST /api/bots/{id}/knowledge ยท DELETE โ€ฆ/knowledge/{doc_id}Knowledge base (RAG) {title, text}
POST /api/bots/{id}/knowledge/reindexVector reindex of the knowledge base
GET/PUT /api/bots/{id}/provider/{name}Integrations: bitrix, amocrm, sheets, yookassa, sms

Analytics

Method and pathDescription
GET /api/bots/{id}/statsDialogs, messages, conversion
GET /api/bots/{id}/radarTraffic sources (by ?start=)

Inbox (dialogs & agent)

Method and pathDescription
GET /api/inbox?filter=Dialogs: waiting | active | mine | closed
GET /api/inbox/countsTab counters
GET /api/inbox/{id}/{sid}/messagesDialog messages
POST /api/inbox/{id}/{sid}/replyAgent reply {text}
POST /api/inbox/{id}/{sid}/assignAssign a dialog to yourself/an agent
POST /api/inbox/{id}/{sid}/statusDialog status {status} (incl. closed)
POST /api/inbox/{id}/{sid}/noteInternal agent note

Organizations, projects & access

Hierarchy: workspace โ†’ organization โ†’ project โ†’ bot. Plan and limits are per workspace (shared pool). A workspace has a default organization and project, so a solo user never notices them. Roles (inherited top-down, apply at their level and below): admin โ€” full access, editor โ€” edits bots, operator โ€” replies in dialogs only, billing โ€” payments only (workspace level only). Access is granted at any level; external collaborators can be invited to a single project.

Method and pathDescription
GET /api/orgsWorkspace organizations with their projects
POST /api/orgsCreate an organization {name}
PUT /api/orgs/{id} ยท DELETE /api/orgs/{id}Rename / delete an organization (empty)
POST /api/projectsCreate a project {org_id, name}
PUT /api/projects/{id} ยท DELETE /api/projects/{id}Rename / delete a project (empty)
PUT /api/bots/{id}/moveMove a bot to a project {project_id}
GET /api/access?scope_type=tenant|org|project&scope_id=Who has access at a level
POST /api/accessGrant access {scope_type, scope_id, email, role} (a new email gets an account + invite email)
DELETE /api/accessRevoke access {scope_type, scope_id, email}

Workspace: plan, payer, keys

Method and pathDescription
GET /api/billingPlan, limits, usage, payer (payer_email), payment methods (psps)
GET /api/billing/paymentsPayment history
POST /api/billing/payerSet the workspace payer {email}
GET /api/keysWorkspace API keys

Plan, limits and payments are per workspace (like the API key). The payer pays (the creator by default, reassignable by a tenant admin); prices are multi-currency (RUB/KZT/USD/EUR โ€” the amount is taken by the chosen payment method). Team members are managed via /api/access (scope_type=tenant), roles admin/editor/operator/billing. One key = one workspace.

4. Bot graph schema

A flow is states (nodes) and transitions (edges). A minimal bot:

{
  "states": [
    {"id":"start","type":"start","label":"Start","config":{},"position":{"x":80,"y":80}},
    {"id":"hello","type":"message","label":"Hi","config":{"text":"Hello! How can I help?"},"position":{"x":80,"y":220}}
  ],
  "transitions": [
    {"id":"t1","from":"start","to":"hello","type":"goto","condition":null}
  ]
}

Main node types (type) and their config:

typeconfigPurpose
startโ€”Entry point
trigger{event, keywords, match}Start a branch by keyword or on a new subscriber (subscribe)
message{text, media_url?, buttons?}Send a message (buttons via on_button transitions)
input{var}Wait for a reply, save it to a variable
condition{var, op, value}Branching (on_condition transitions with result:true/false)
set_var{var, value}Set a variable
api_call{url, method, body, save_to}HTTP request to an external service
ai{prompt, use_kb, save_to, task}AI answer from the knowledge base
tag{action, tag}Add/remove a subscriber tag
set_field{field, value}Set a custom subscriber field
payment{provider, amount, ...}Payment: YooKassa (link) or Telegram Stars (in chat)
bitrix / amocrm / sheets{fields} / {columns}Send data to Bitrix24 / amoCRM / Google Sheets
handoffโ€”Hand off to an agent (in the inbox)

Tip: fetch a ready bot's graph via GET /api/bots/{id} โ€” it's the best example of the format to edit.

5. Outgoing webhooks (bot events)

The platform can notify your server about bot events. Setup:

curl -X PUT https://ultrabot.work/api/bots/BOT_ID/webhook-out \
  -H "Authorization: Bearer $KEY" -H "content-type: application/json" \
  -d '{"url":"https://your.app/hook","events":{"subscribe":true,"handoff":true,"deal":true,"payment":true}}'

Each event is toggled by a true/false flag. On an event the platform sends a POST to your url (10s timeout, redirects not followed, no retries โ€” keep the handler fast and idempotent). The body always has the shape {event, bot_id, data}:

{"event":"subscribe","bot_id":"bot_ab12โ€ฆ","data":{"chat_id":123,"name":"John","channel":"telegram"}}
eventWhendata
subscribeNew subscriber{"chat_id":123,"name":"John","channel":"telegram"}
handoffDialog handed to an agent (handoff node)chat_id as a number, e.g. 123
dealDeal created (deal node){"title":"Order","amount":1990,"stage":"new"}
paymentSuccessful in-bot payment (Telegram payment){"chat_id":123,"payload":"invoice payload"}

6. Integration examples

Create a broadcast (tag segment, push or email channel):

curl -X POST https://ultrabot.work/api/bots/BOT_ID/broadcasts \
  -H "Authorization: Bearer $KEY" -H "content-type: application/json" \
  -d '{"text":"Sale!","filter_tag":"vip","channel":"push"}'

Optional: buttons, subject (for email), scheduled_at (ISO time), repeat_days, filter_var/filter_value, delay_seconds.

Tag a contact (action: add | remove):

curl -X POST https://ultrabot.work/api/bots/BOT_ID/contacts/tag \
  -H "Authorization: Bearer $KEY" -H "content-type: application/json" \
  -d '{"cid":"CHAT_ID","tag":"vip","action":"add"}'

Inbox: list waiting dialogs and reply as an agent:

curl "https://ultrabot.work/api/inbox?filter=waiting" -H "Authorization: Bearer $KEY"
curl -X POST https://ultrabot.work/api/inbox/BOT_ID/SID/reply \
  -H "Authorization: Bearer $KEY" -H "content-type: application/json" \
  -d '{"text":"Hello!"}'

Workspace plan and limits:

curl https://ultrabot.work/api/billing -H "Authorization: Bearer $KEY"
# โ†’ {"plan":"pro","limits":{"max_bots":10,"max_broadcasts_month":100,"max_contacts":10000},
#     "usage":{...},"payer_email":"...","psps":["robokassa"]}

7. AI integration (MCP)

Through the Model Context Protocol an AI gets tools that call this API with your key โ€” and can create/configure bots, run the inbox and more on its own. Two options:

Option A โ€” remote MCP (no install)

Just add the server by URL. For Claude Desktop / clients with remote MCP:

{
  "mcpServers": {
    "ultrabot": {
      "url": "https://ultrabot.work/mcp",
      "headers": { "Authorization": "Bearer bs_live_YOUR_KEY" }
    }
  }
}

Option B โ€” local server (stdio)

For Claude Desktop / Claude Code that need a local process:

{
  "mcpServers": {
    "ultrabot": {
      "command": "npx",
      "args": ["-y", "@ultrabot/mcp"],
      "env": {
        "ULTRABOT_API_KEY": "bs_live_YOUR_KEY",
        "ULTRABOT_BASE_URL": "https://ultrabot.work"
      }
    }
  }
}

Available tools: list_bots, create_bot, get_bot, rename_bot, delete_bot, list_archived_bots, restore_bot, purge_bot, update_graph, publish_bot, bot_overview, bot_stats, connect_telegram, set_channel, create_broadcast, list_dialogs, dialog_messages, reply_dialog, set_ai, add_knowledge, list_contacts, tag_contact, set_commands, billing_status.

Example user prompt: "Build an autoresponder bot for barbershop bookings, connect my Telegram and publish" โ€” the AI will call create_bot โ†’ update_graph โ†’ connect_telegram โ†’ publish_bot.

Get a key and start

Keys live in the app under "Settings โ†’ API".

Open the app