BLLM REST API
The BLLM API lets you programmatically execute agents, manage conversations, and query knowledge bases. All endpoints are under /api/v1/ and require API key authentication.
Base URL:
https://your-domain.com/api/v1
Authentication
Every request must include an API key. Create and manage keys under Settings → Public API keys (REST integrations). LLM provider keys are separate. Each key has scoped permissions, optional IP allowlists, and custom rate limits.
Pass the key via either header:
Authorization: Bearer bllm_pk_a1b2c3d4e5f6... # or X-API-Key: bllm_pk_a1b2c3d4e5f6...
Key format
Keys are prefixed with bllm_pk_ followed by 32 hex characters. The raw key is shown once at creation — only a SHA-256 hash is stored server-side.
Scopes
Each key is granted one or more scopes that control what it can access:
| Scope | Grants |
|---|---|
| agents:read | List agents, get agent details |
| agents:execute | Execute / run an agent |
| conversations:read | List conversations, get details, list messages |
| conversations:write | Create conversations, send messages |
| knowledge:read | List knowledge bases, query a knowledge base |
Error Handling
All errors return a consistent JSON envelope:
{
"error": {
"code": "API_KEY_INVALID",
"message": "The provided API key is invalid.",
"status": 401
},
"meta": {
"requestId": "req_a1b2c3d4e5f6g7h8",
"timestamp": "2026-03-19T10:00:00.000Z"
}
}Error codes
| Code | Status | Meaning |
|---|---|---|
| API_KEY_REQUIRED | 401 | No API key header provided |
| API_KEY_INVALID | 401 | Key format is wrong or key not found |
| API_KEY_REVOKED | 401 | Key has been revoked |
| API_KEY_EXPIRED | 401 | Key has passed its expiration date |
| IP_NOT_ALLOWED | 403 | Request IP not in key's allowlist |
| INSUFFICIENT_SCOPE | 403 | Key lacks the required scope for this endpoint |
| AGENT_NOT_ACCESSIBLE | 403 | Agent is not in the key's allowed agent list |
| AGENT_NOT_PUBLISHED | 403 | Agent exists but is not published |
| RATE_LIMIT_EXCEEDED | 429 | Per-key rate limit exceeded |
| NOT_FOUND | 404 | Resource does not exist |
| VALIDATION_ERROR | 422 | Missing or invalid request body fields |
| INTERNAL_ERROR | 500 | Unexpected server error |
Rate Limits
Each API key has a configurable rate limit (default: 60 requests/minute). Every response includes rate limit headers:
| Header | Description |
|---|---|
| X-RateLimit-Limit | Maximum requests per window |
| X-RateLimit-Remaining | Requests remaining in current window |
| X-RateLimit-Reset | Unix timestamp when the window resets |
| Retry-After | Seconds to wait (only on 429 responses) |
Pagination
List endpoints use cursor-based pagination. Pass ?limit=20&cursor=clx... as query parameters. Responses include a pagination object:
{
"data": [...],
"pagination": {
"cursor": "clx...",
"hasMore": true,
"limit": 20
},
"meta": { ... }
}/api/v1/agentsReturns a paginated list of published agents accessible to this API key.
Query parameters
| Param | Type | Default | Description |
|---|---|---|---|
| limit | integer | 20 | Max results (1-50) |
| cursor | string | — | Cursor from previous response |
Response
{
"data": [
{
"id": "clx...",
"name": "Support Agent",
"description": "Handles customer questions",
"published": true,
"createdAt": "2026-03-01T00:00:00.000Z",
"updatedAt": "2026-03-15T12:00:00.000Z"
}
],
"pagination": { "cursor": null, "hasMore": false, "limit": 20 },
"meta": { "requestId": "req_...", "timestamp": "..." }
}/api/v1/agents/:idReturns details for a single published agent.
Path parameters
| Param | Description |
|---|---|
| id | Agent ID |
Response
{
"data": {
"id": "clx...",
"name": "Support Agent",
"description": "Handles customer questions",
"published": true,
"createdAt": "2026-03-01T00:00:00.000Z",
"updatedAt": "2026-03-15T12:00:00.000Z"
},
"meta": { ... }
}/api/v1/agents/:id/executeExecute an agent. Creates a new conversation (or continues an existing one) and returns the agent's response events.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| userInput | string | Yes | The user's message |
| variables | object | No | Initial variables for the execution |
| conversationId | string | No | Continue an existing conversation |
| chatHistory | array | No | Previous messages for context |
{
"userInput": "What is my order status?",
"conversationId": "clx..."
}Response
{
"data": {
"events": [
{ "type": "message", "content": "Let me look that up for you..." },
{ "type": "message", "content": "Your order #1234 shipped on March 15." },
{ "type": "done" }
],
"newState": { "order_id": "1234", "status": "shipped" },
"currentNodeId": null,
"conversationId": "clx...",
"success": true
},
"meta": { ... }
}Event types: message (agent text), wait_input (agent is waiting for user), error (execution error), done (flow finished successfully — omitted when the run ends with errors). handoff may appear for human handoff flows.
success: true when the run completed with a done event and no terminal errors; false on failure; omitted when the run is only paused on wait_input.
/api/v1/conversationsList conversations for your agents. Scoped to the API key's allowed agents if configured.
Query parameters
| Param | Type | Default | Description |
|---|---|---|---|
| limit | integer | 20 | Max results (1-50) |
| cursor | string | — | Cursor from previous response |
Response
{
"data": [
{
"id": "clx...",
"agentId": "clx...",
"agentName": "Support Agent",
"title": "API Conversation",
"status": "ACTIVE",
"createdAt": "...",
"updatedAt": "..."
}
],
"pagination": { ... },
"meta": { ... }
}/api/v1/conversationsCreate a new conversation for a published agent.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| agentId | string | Yes | ID of a published agent |
| title | string | No | Conversation title (default: "API Conversation") |
Response (201)
{
"data": {
"id": "clx...",
"agentId": "clx...",
"title": "API Conversation",
"status": "ACTIVE",
"createdAt": "..."
},
"meta": { ... }
}/api/v1/conversations/:idGet details for a single conversation.
Response
{
"data": {
"id": "clx...",
"agentId": "clx...",
"agentName": "Support Agent",
"title": "API Conversation",
"status": "ACTIVE",
"createdAt": "...",
"updatedAt": "..."
},
"meta": { ... }
}/api/v1/conversations/:id/messagesList messages in a conversation, ordered oldest-first.
Query parameters
| Param | Type | Default | Description |
|---|---|---|---|
| limit | integer | 50 | Max results (1-100) |
| cursor | string | — | Cursor from previous response |
Response
{
"data": [
{ "id": "clx...", "role": "user", "content": "Hello", "createdAt": "..." },
{ "id": "clx...", "role": "assistant", "content": "Hi! How can I help?", "createdAt": "..." }
],
"pagination": { ... },
"meta": { ... }
}/api/v1/conversations/:id/messagesSend a message in an existing conversation. This triggers agent execution using the conversation's agent and returns the response events.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| content | string | Yes | The message text |
{ "content": "What is my order status?" }Response
Same format as the Execute Agent response — includes events, newState, and conversationId.
/api/v1/knowledgeList knowledge bases belonging to the API key's owner.
Response
{
"data": [
{
"id": "clx...",
"name": "Product Docs",
"description": "Internal documentation",
"documentCount": 12,
"createdAt": "...",
"updatedAt": "..."
}
],
"pagination": { ... },
"meta": { ... }
}/api/v1/knowledge/:id/queryRun a semantic search against a knowledge base. Returns the most relevant document chunks with similarity scores.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| query | string | Yes | The search query |
| limit | integer | No | Max results (default 5, max 20) |
{ "query": "How do I reset my password?", "limit": 3 }Response
{
"data": {
"query": "How do I reset my password?",
"results": [
{
"content": "To reset your password, go to Settings > Security...",
"similarity": 0.92,
"metadata": null
}
],
"total": 1
},
"meta": { ... }
}API Key Management
These endpoints are authenticated via your session (browser login), not API keys. Use them from the dashboard or your own admin tooling.
/api/keys/publicCreate a new API key. The raw key is returned once in the response.
{
"name": "Production Key",
"scopes": ["agents:read", "agents:execute", "conversations:write"],
"allowedAgentIds": ["clx..."],
"allowedIPs": ["203.0.113.0/24"],
"expiresAt": "2027-01-01T00:00:00Z",
"rateLimitPerMinute": 100
}/api/keys/publicList all your API keys. Returns prefix, scopes, status, and last used — never the raw key.
/api/keys/public/:idUpdate key name, scopes, allowed agents, allowed IPs, or rate limit.
/api/keys/public/:idRevoke a key. Sets status to revoked. Immediate effect.
/api/keys/public/:id/rotateRevoke the current key and create a new one with the same configuration. Returns the new raw key once.
/api/keys/public/:id/usagePaginated usage logs for a key. Supports ?from= and ?to= date filters.