Skip to main content

Getting Started

How the platform works

Sarufi is organized around a hierarchy of resources. Understanding how they connect makes every API call obvious.

Workspace
└── Chatbot
├── Flows ← conversation logic (state machine)
│ └── States → Transitions → Actions (API calls, LLM, etc.)
├── Knowledge Bases ← documents for AI-powered answers
└── Integrations ← channels: WhatsApp, Web widget, SMS, API


Conversations (one per user session, per channel)
└── Messages ← user input + bot response pairs

The request path for an end-user message:

User (WhatsApp / Web / SMS / API)
│ sends message

Channel gateway
│ routes to chatbot

Conversation engine
├── loads current conversation state
├── evaluates flow transitions
├── runs state actions (API calls, LLM turns, …)
└── renders reply messages


Bot reply delivered back to user

Key concepts

ConceptWhat it is
WorkspaceYour top-level account. Holds API keys and all chatbots.
ChatbotA single bot instance with its own flows, channels, and settings.
FlowA state machine that drives conversations. Each chatbot has one active (published) flow.
StateA point in a conversation — defines what the bot says and what happens next.
IntegrationA connected channel (WhatsApp number, web widget, SMS line) or external tool.
ConversationA session between one user and the chatbot, scoped to a channel.
Knowledge BaseA collection of documents the chatbot can search to answer questions.

Quick start

Get your workspace details in 30 seconds:

curl -X GET https://api.sarufi.io/api/dev/v1/me \
-H "Authorization: Bearer <your-api-key>"
{
"workspace": {
"id": "01JMXYZ...",
"name": "My Workspace"
},
"api_key": {
"key": "sk-...",
"created_at": "2026-01-15T10:00:00Z"
}
}
Get your API key

Go to your Sarufi workspace → SettingsAPI Keys to generate your developer API key.


Base URL

All three URLs are production endpoints and behave identically — use whichever fits your setup:

Base URL
https://api.sarufi.io/api/dev/v1
https://beta-api.sarufi.io/api/dev/v1
https://developers.sarufi.io/api/dev/v1

All endpoints are organized under the path /api/dev/v1.


Rate limits

OperationLimit
Reads1 request / second
Writes / Updates1 request / 2 seconds

If you exceed the limit you receive 429 Too Many Requests. The Retry-After header indicates how many seconds to wait.


Request format

  • Content-Type: application/json for all requests with a body
  • Accept: application/json
  • All timestamps are ISO 8601 UTC strings

Response format

Successful responses return JSON with the resource data. Paginated list endpoints return:

{
"items": [...],
"next_cursor": "opaque-string-or-null",
"total": 42
}

Pass cursor in subsequent requests to page through results.


Error responses

StatusMeaning
400Bad request — validation error in request body
401Unauthorized — missing or invalid API key
403Forbidden — action not permitted for this workspace
404Not found — resource does not exist
409Conflict — resource already exists
422Unprocessable entity — schema validation failed
429Too Many Requests — rate limit exceeded
500Internal server error

Error bodies include a detail field:

{
"detail": "Chatbot with this name already exists in workspace."
}