The Enterprise tier adds a full multi-tenancy layer to Shipfastai. Each tenant gets a dedicated PostgreSQL schema containing its ownDocumentation Index
Fetch the complete documentation index at: https://docs.shipfastai.dev/llms.txt
Use this file to discover all available pages before exploring further.
documents, chat_sessions, chat_messages, and fine_tune_jobs tables. Tenant metadata — names, plans, member lists, and API keys — lives in the shared public schema. A FastAPI middleware layer resolves the current tenant on every request before any handler code runs, and an RBAC system controls what each member of a tenant can do.
How tenant isolation works
When a tenant is created, Shipfastai automatically provisions a new PostgreSQL schema named{prefix}{slug} (for example, tenant_acme). All per-tenant application data is written into that schema, not the public schema. This means two tenants can never read each other’s documents or chat sessions, even through direct database queries.
The TenantMiddleware identifies the current tenant on every inbound request using one of three strategies, checked in priority order:
- Header —
X-Tenant-ID(UUID) orX-Tenant-Slug(slug string). - Subdomain —
acme.api.example.comresolves to slugacme. - Path prefix —
/api/v1/acme/...resolves to slugacme.
request.state.tenant. If the tenant is suspended, the request is rejected with 403 Forbidden. Public paths such as /health, /docs, and /api/v1/auth are excluded from tenant resolution.
Tenant API endpoints
All tenant management endpoints live under/api/tenants. Every endpoint requires an authenticated user; the RBAC layer then enforces what that user is allowed to do within the tenant.
| Method | Path | Description |
|---|---|---|
POST | /api/tenants/ | Create a new tenant. The caller becomes the owner. |
GET | /api/tenants/ | List tenants the current user is a member of. |
GET | /api/tenants/{tenant_id} | Get details for a single tenant. |
PATCH | /api/tenants/{tenant_id} | Update tenant name, plan, or settings. Requires tenants:write. |
DELETE | /api/tenants/{tenant_id} | Suspend a tenant (soft delete). Requires tenants:delete. |
POST | /api/tenants/{tenant_id}/transfer | Transfer ownership to another active member. |
Request
Response — 201 Created
starter, growth, and enterprise.
Listing tenants
Request
Response — 200 OK
Per-tenant configuration
Each tenant record includes asettings field (a free-form JSON object) that you can use to store tenant-specific configuration such as allowed LLM providers, custom system prompts, feature flags, or rate limit overrides.
Updating tenant settings
name, plan, max_members, and max_api_keys in the same call. All changes are written to the audit log automatically.
Usage-based billing
The Enterprise tier tracks resource consumption per tenant using theUsageService. Every AI call, RAG query, and API request records a UsageRecord containing a resource_type (such as api_call, llm_token, or storage_mb) and a quantity.
You can query usage data for a tenant through two endpoints:
Aggregated summary
Request
Response — 200 OK
period query parameter accepts 7d, 30d, or 90d.
Detailed records
Request
totals from the summary endpoint to a Stripe metered subscription item at the end of each billing period to charge tenants based on actual consumption.
Both usage endpoints require the usage:read permission, which is granted to the owner and admin roles by default.