Tenant API & SDK
Integrate donis-agent into your own application or custom frontend.
Overview
The Tenant API is designed for developers who want to build chat into their own products. Use a tenant API key (donis_tnt_...) instead of a JWT. Perfect for backend-to-backend integration, custom frontends, mobile apps, and automation.
bash
curl -X POST "<your-server>/api/v1/tenant/chat" \
-H "X-API-Key: donis_tnt_..." \
-H "Content-Type: application/json" \
-d '{"message":"Halo!","agent_id":"<agent-uuid>"}'Getting a key
Tenant API keys are created per project from the dashboard (Admin or Member) under Project → API Keys. The plain key is shown only once at creation — store it safely.
bash
# Admin creates a key
curl -X POST "<your-server>/api/admin/projects/$PROJECT_ID/api-keys" \
-H "Authorization: Bearer $ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"Production Key"}'Chat (SSE stream)
Send a message and stream the reply using Server-Sent Events.
bash
curl -X POST "<your-server>/api/v1/tenant/chat" \
-H "X-API-Key: donis_tnt_..." \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-d '{
"message": "Halo!",
"agent_id": "agt_uuid",
"session_id": "sess_xxx",
"model": "deepseek-v4-flash",
"stream": true
}'Parameters
| Field | Required | Description |
|---|---|---|
message | Yes | User message |
agent_id | No | Empty → first active agent in project |
session_id | No | Empty → new session created automatically |
model | No | Override model for this request |
stream | No | true (default) → SSE, false → JSON |
Agents & Models
List active agents or available models for your project.
bash
curl "<your-server>/api/v1/tenant/agents" -H "X-API-Key: donis_tnt_..."
curl "<your-server>/api/v1/tenant/models" -H "X-API-Key: donis_tnt_..."Non-stream response
Set stream: false for a single JSON response (useful backend-to-backend).
bash
curl -X POST "<your-server>/api/v1/tenant/chat" \
-H "X-API-Key: donis_tnt_..." \
-H "Content-Type: application/json" \
-d '{"message":"Halo!","agent_id":"agt_uuid","stream":false}'