Multi-Tenant Setup
Configure Zihin for SaaS applications with multiple tenants.
Overview
Each tenant in Zihin is a completely isolated workspace with its own:
- Users, roles, and permissions
- Agents and configurations
- API keys and quotas
- Usage data and billing
Setting Up Tenants
1. Create a Tenant
Tenants are created through the console at console.zihin.ai.
2. Invite Team Members
Use the Team API to invite users:
POST https://tenant-api.zihin.ai/api/tenants/:id/invites
Or invite via the console: Settings > Team > Invite.
3. Assign Roles
| Role | Permissions |
|---|---|
owner | Full access, billing, delete tenant |
admin | Manage users, agents, connections |
editor | Create/edit agents and configurations |
viewer | Read-only access to dashboards |
4. Generate API Keys
Each tenant has independent API keys. Generate at Settings > API Keys.
Authentication in Multi-Tenant Apps
Use JWT authentication with tenant context:
curl -X POST https://llm.zihin.ai/api/v3/llm/call \
-H "Authorization: Bearer <jwt-token>" \
-H "x-tenant-id: <tenant-uuid>" \
-H "x-agent-id: <agent-uuid>" \
-H "Content-Type: application/json" \
-d '{"query": "Hello", "model": "auto"}'
The x-tenant-id header ensures complete data isolation between tenants.