REST API Reference
The StudioBrain backend exposes a RESTful API on port 8201. All endpoints use JSON request/response bodies and are prefixed with /api/ unless otherwise noted.
Interactive API documentation is available at /docs (Swagger UI) and /redoc (ReDoc) when the backend is running.
Authentication
Most endpoints require a JWT bearer token or session cookie.
Header-based auth:
Authorization: Bearer {jwt_token}Cookie-based auth (web sessions):
The web auth endpoints set httpOnly cookies automatically. Subsequent requests from the browser include the cookie without explicit header configuration.
Obtaining a token:
POST /api/auth/web/login
Content-Type: application/json
{
"email": "user@example.com",
"password": "secretpassword"
}Response:
{
"access_token": "eyJ...",
"token_type": "bearer",
"tenant_id": "abc123",
"user_id": "user456",
"role": "admin"
}Common Response Patterns
Success (list)
{
"total": 42,
"offset": 0,
"limit": 50,
"entities": [...]
}Success (single entity)
{
"entity_type": "character",
"entity_id": "rex_marshall",
"name": "Rex Marshall",
"status": "active",
"fields": { ... },
"markdown_body": "...",
"primary_asset": "/Characters/rex_marshall/images/portrait.png",
"validation_errors": [],
"is_valid": true
}Error
{
"detail": "Entity not found: character/unknown_id"
}Common HTTP status codes:
| Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Created |
| 400 | Bad request (validation error, malformed input) |
| 401 | Unauthorized (missing or invalid token) |
| 403 | Forbidden (insufficient permissions or feature gate) |
| 404 | Not found |
| 409 | Conflict (entity already exists, sync conflict) |
| 422 | Unprocessable entity (Pydantic validation failure) |
| 429 | Rate limited |
| 500 | Internal server error |
Entities
Unified entity CRUD for all 16 entity types. The {type} path parameter accepts: character, location, district, brand, faction, item, job, quest, campaign, event, dialogue, timeline, assembly, style_bible, universe.
Prefix: /api/entity
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /{type}/schema | Get template schema for entity type | No |
| GET | /{type} | List entities with filtering and pagination | Yes |
| GET | /{type}/{id} | Get single entity by ID | Yes |
| POST | /{type} | Create new entity | Yes |
| PUT | /{type}/{id} | Update entity fields and/or markdown body | Yes |
| DELETE | /{type}/{id} | Soft-delete entity (moves to recycle bin) | Yes |
| POST | /{type}/smart-merge | AI-assisted merge of two entity versions | Yes |
| POST | /{type}/compare | Diff two entity versions | Yes |
| POST | /{type}/import | Import entity from raw markdown content | Yes |
Query Parameters (list endpoint)
| Param | Type | Default | Description |
|---|---|---|---|
offset | int | 0 | Pagination offset |
limit | int | 50 | Maximum results (max 200) |
search | string | — | Full-text search across name and fields |
status | string | — | Filter by status (active, archived, draft) |
sort_by | string | updated_at | Sort field |
sort_order | string | desc | asc or desc |
Create Entity
POST /api/entity/character
Content-Type: application/json
Authorization: Bearer {token}
{
"entity_id": "rex_marshall",
"name": "Rex Marshall",
"status": "active",
"fields": {
"age": "34",
"gender": "male",
"faction": "independent",
"personality_traits": ["resourceful", "paranoid"]
},
"markdown_body": "# Rex Marshall\n\n## Background\n\nA former mechanic..."
}Update Entity
PUT /api/entity/character/rex_marshall
Content-Type: application/json
Authorization: Bearer {token}
{
"fields": {
"age": "35",
"personality_traits": ["resourceful", "paranoid", "loyal"]
}
}Only the provided fields are updated. Omitted fields are unchanged.
Auth and Users
Prefix: /api
Web Auth (cookie-based)
| Method | Path | Description | Auth |
|---|---|---|---|
| POST | /auth/web/login | Login with email/password, sets httpOnly cookie | No |
| POST | /auth/web/google-sso | Login via Google SSO token | No |
| GET | /auth/web/session | Get current session info from cookie | Cookie |
| POST | /auth/web/select-tenant | Switch active tenant | Cookie |
User Management
| Method | Path | Description | Auth |
|---|---|---|---|
| POST | /auth/register | Register new user | No |
| POST | /auth/login | Login (returns JWT) | No |
| POST | /auth/refresh | Refresh JWT token | Yes |
| POST | /auth/logout | Logout / revoke token | Yes |
| GET | /auth/me | Get current user profile | Yes |
| POST | /auth/set-password | Set new password | Yes |
| POST | /auth/forgot-password | Request password reset email | No |
| POST | /auth/reset-password | Reset password with token | No |
| POST | /auth/create-invite | Create user invitation link | Yes (admin) |
| GET | /auth/validate-invite/{token} | Validate invite token | No |
| POST | /auth/register-with-invite | Register using invite token | No |
OAuth
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /auth/oauth/providers | List configured OAuth providers | No |
| GET | /auth/oauth/google | Initiate Google OAuth flow | No |
| GET | /auth/oauth/google/callback | Google OAuth callback | No |
| GET | /auth/oauth/microsoft | Initiate Microsoft OAuth flow | No |
| GET | /auth/oauth/microsoft/callback | Microsoft OAuth callback | No |
| GET | /auth/oauth/google/drive | Initiate Google Drive OAuth | Yes |
| GET | /auth/oauth/google/drive/callback | Google Drive OAuth callback | Yes |
Teams and Users (Admin)
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /users | List all users | Yes (admin) |
| GET | /users/current | Get current user | Yes |
| GET | /users/{id} | Get user by ID | Yes (admin) |
| PUT | /users/{id} | Update user | Yes (admin) |
| DELETE | /users/{id} | Delete user | Yes (admin) |
| PUT | /users/{id}/password | Change user password | Yes (admin) |
| GET | /users/{id}/api-key | Get user AI API key | Yes |
| POST | /users/{id}/api-key/regenerate | Regenerate AI API key | Yes |
| GET | /users/{id}/subscription | Get user subscription | Yes |
| PUT | /users/{id}/subscription | Update subscription tier | Yes (admin) |
| POST | /users/{id}/invite | Send user invite | Yes (admin) |
| POST | /teams | Create team | Yes |
| GET | /teams | List teams | Yes |
| GET | /teams/{id} | Get team details | Yes |
| POST | /api-keys | Create API key | Yes |
| GET | /api-keys | List API keys | Yes |
| POST | /permission-templates | Create permission template | Yes (admin) |
| GET | /permission-templates | List permission templates | Yes |
Tenants
| Method | Path | Description | Auth |
|---|---|---|---|
| POST | /tenants | Create tenant | Yes (admin) |
| GET | /tenants/me | Get current tenant | Yes |
| PUT | /tenants/me | Update current tenant | Yes |
Registration
| Method | Path | Description | Auth |
|---|---|---|---|
| POST | /register | Register new tenant + user | No |
| POST | /register/with-invite | Register with beta invite code | No |
Sync and File Operations
Markdown Sync
Prefix: /api
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /sync/status | Get sync status (running, last result) | No |
| GET | /sync/check-changes | Check for pending file changes | Yes |
| POST | /sync/import-changes | Import detected file changes | Yes |
| POST | /sync/save-to-markdown/{type}/{id} | Write entity to markdown file | Yes |
| POST | /sync/from-markdown/{type}/{id} | Read entity from markdown file into DB | Yes |
| POST | /sync/refresh-all | Full re-sync all markdown to DB | Yes |
| GET | /sync/file-watcher/status | Hybrid file watcher status | No |
Entity Sync (bulk)
| Method | Path | Description | Auth |
|---|---|---|---|
| POST | /api/entity/sync/all | Sync all entity types from markdown | Yes |
| POST | /api/entity/sync/{type} | Sync specific entity type | Yes |
| POST | /api/entity/validate/all | Validate all entities | Yes |
Markdown Operations
| Method | Path | Description | Auth |
|---|---|---|---|
| POST | /markdown/validate-frontmatter | Validate YAML frontmatter | Yes |
| POST | /markdown/sync-from-files | Sync from filesystem | Yes |
| POST | /markdown/export/{type}/{id} | Export entity as markdown | Yes |
Import
| Method | Path | Description | Auth |
|---|---|---|---|
| POST | /import/preview | Preview markdown import without saving | Yes |
| POST | /import/smart | Smart import with AI-assisted field mapping | Yes |
| POST | /markdown/format | Format/normalize markdown content | Yes |
| POST | /validation/fix | Auto-fix common validation issues | Yes |
| POST | /rename-entity | Rename entity (updates ID, files, references) | Yes |
Cloud Sync
App-level Cloud Sync
Prefix: /api/cloud-sync
| Method | Path | Description | Auth |
|---|---|---|---|
| POST | /push | Push local changes to cloud (PostgreSQL RLS) | Yes |
| GET | /pull | Pull cloud changes to local | Yes |
| GET | /status | Cloud sync status | Yes |
Desktop Cloud Sync
Prefix: /api/desktop/sync
| Method | Path | Description | Auth |
|---|---|---|---|
| POST | /push | Push from desktop to cloud | Yes |
| GET | /pull | Pull from cloud to desktop | Yes |
| GET | /presence | Get online presence info | Yes |
Conflicts
Prefix: /api/conflicts
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | “ | List unresolved sync conflicts | Yes |
| POST | /{conflict_id}/resolve | Resolve a conflict (pick winner) | Yes |
Google Drive
Drive Storage
Prefix: /api/drive/oauth
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /status | Drive connection status | Yes |
| GET | /folders | List Drive folders for picker | Yes |
| POST | /select-folder | Set project folder | Yes |
| POST | /disconnect | Disconnect Drive storage | Yes |
| POST | /test | Test Drive connection | Yes |
Drive Files
Prefix: /api/drive
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /status | Drive connection status | Yes |
| GET | /files | List Drive files | Yes |
| GET | /files/{file_id} | Get file metadata | Yes |
| GET | /files/{file_id}/download | Download file content | Yes |
| POST | /export-entity | Export entity as Google Doc | Yes |
| PUT | /files/{file_id} | Update Drive file content | Yes |
| POST | /files/{file_id}/share | Share file with another user | Yes |
Drive Webhooks
Prefix: /api/drive/webhook
| Method | Path | Description | Auth |
|---|---|---|---|
| POST | “ | Receive Drive change notifications | No (webhook) |
| POST | /register | Register push notification channel | Yes |
| DELETE | /unregister | Stop watching for changes | Yes |
| GET | /status | Webhook registration status | Yes |
Drive Cloud Sync
Prefix: /api/drive
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /cloud-sync-status | Cloud Drive sync worker status | Yes |
| POST | /force-sync | Force immediate Drive sync | Yes |
Billing
Prefix: /api/billing
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /prices | List available subscription prices | No |
| GET | /subscription | Get current subscription details | Yes |
| GET | /usage | Get current BrainBits usage | Yes |
| POST | /checkout | Create Stripe checkout session | Yes |
| POST | /portal | Create Stripe customer portal session | Yes |
| GET | /portal | Redirect to Stripe customer portal | Yes |
| POST | /webhook | Stripe webhook receiver | No (webhook) |
| GET | /status | Billing system status | Yes |
| GET | /invoices | List invoices | Yes |
| PUT | /quota | Update team quota allocation | Yes (admin) |
| POST | /consume-tokens | Consume BrainBits tokens | Yes |
| GET | /team/members | List team members with billing info | Yes |
| PUT | /team/user-quota | Update per-user quota | Yes (admin) |
| GET | /usage-history | Usage history over time | Yes |
| GET | /token-blocks | List available token block purchases | Yes |
| POST | /purchase-tokens | Purchase additional BrainBits | Yes |
| GET | /purchase-history | Token purchase history | Yes |
| GET | /brainbits | Get BrainBits balance | Yes |
| POST | /brainbits/consume | Consume BrainBits | Yes |
Beta Program
Prefix: /api/beta
| Method | Path | Description | Auth |
|---|---|---|---|
| POST | /invite | Create beta invite code | Yes (admin) |
| GET | /validate/{code} | Validate invite code | No |
| POST | /redeem | Redeem invite code | Yes |
| POST | /invite/revoke | Revoke an invite code | Yes (admin) |
| POST | /extend | Extend beta period | Yes (admin) |
| GET | /stats | Beta program statistics | Yes (admin) |
| POST | /feedback | Submit beta feedback | Yes |
| GET | /feedback | List feedback submissions | Yes (admin) |
| PATCH | /feedback/{id} | Update feedback status | Yes (admin) |
| POST | /waitlist | Join waitlist | No |
| GET | /waitlist | List waitlist entries | Yes (admin) |
| POST | /waitlist/promote | Promote waitlist entry to invite | Yes (admin) |
Desktop
Prefix: /api/desktop
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /projects | List local projects | No |
| POST | /projects | Create new project | No |
| DELETE | /projects/{name} | Delete project | No |
| POST | /projects/{name}/activate | Activate project | No |
| POST | /projects/{name}/scan | Scan project for entities | No |
| GET | /watcher/status | File watcher status | No |
| POST | /watcher/start | Start file watcher | No |
| POST | /watcher/stop | Stop file watcher | No |
| GET | /sync/status | Desktop sync status | No |
| GET | /sync/queue | View sync queue | No |
| POST | /sync/start | Start sync worker | No |
| POST | /sync/stop | Stop sync worker | No |
| POST | /sync/now | Trigger immediate sync | No |
| POST | /sync/force-push | Force push to cloud | No |
| POST | /sync/force-pull | Force pull from cloud | No |
| GET | /sync/conflicts | List sync conflicts | No |
| POST | /sync/conflicts/{id}/resolve | Resolve conflict | No |
| POST | /ai/chat | Desktop AI chat (offline-capable) | No |
| GET | /ai/providers | List available AI providers | No |
| POST | /auth/login | Desktop auth login | No |
| POST | /auth/callback | Desktop auth callback | No |
| POST | /auth/logout | Desktop auth logout | No |
| GET | /auth/status | Desktop auth status | No |
| POST | /ws/connect | Connect desktop WebSocket | No |
| POST | /ws/disconnect | Disconnect desktop WebSocket | No |
Templates and Rules
Templates
Prefix: /api
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /templates | List all templates | No |
| GET | /templates/entity-types | List available entity types | No |
| POST | /templates/reload | Reload templates from disk | Yes |
| GET | /templates/{name} | Get template content | No |
| PUT | /templates/{name} | Update template | Yes |
| GET | /templates/{name}/instructions | Get AI generation instructions | No |
| PUT | /templates/{name}/instructions | Update AI instructions | Yes |
Rules
Prefix: /api
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /rules | List all rule files | No |
| POST | /rules/reload | Reload rules from disk | Yes |
| GET | /rules/index | Get rules index | No |
| GET | /rules/settings | Get rules settings | No |
| PUT | /rules/settings | Update rules settings | Yes |
| POST | /rules/validate/{type} | Validate entity against rules | Yes |
| GET | /rules/{type} | Get parsed rules for entity type | No |
| GET | /rules/{type}/markdown | Get raw rule markdown | No |
| PUT | /rules/{type}/markdown | Update rule markdown | Yes |
| PUT | /rules/{type}/system-prompt | Update AI system prompt | Yes |
| POST | /rules/{type} | Add new rule | Yes |
| PUT | /rules/{type}/{rule_id} | Update specific rule | Yes |
| DELETE | /rules/{type}/{rule_id} | Delete specific rule | Yes |
Schemas
Prefix: /api
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /schemas | List all entity schemas | No |
| GET | /schemas/{type} | Get schema for entity type | No |
Assets
Prefix: /api
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /assets | List assets with filtering | Yes |
| GET | /assets/test | Asset system test | No |
| GET | /assets/linked | List assets linked to entities | Yes |
| GET | /assets/uploaders | List available upload providers | Yes |
| GET | /assets/{id} | Get asset by ID | Yes |
| POST | /assets | Create asset record | Yes |
| PUT | /assets/{id} | Update asset metadata | Yes |
| DELETE | /assets/{id} | Delete asset | Yes |
| POST | /assets/scan | Scan all entity folders for new assets | Yes |
| POST | /assets/scan/{type}/{id} | Scan specific entity for assets | Yes |
| POST | /assets/sanitize-ids | Fix invalid asset IDs | Yes |
| POST | /assets/upload | Upload asset file | Yes |
| POST | /assets/auto-tag | AI auto-tag asset | Yes |
| POST | /assets/thumbnail | Generate thumbnail | Yes |
| POST | /assets/ai-rescan | Re-analyze asset with AI | Yes |
| GET | /assets/by-brand/{brand_id} | Get assets for brand | Yes |
| GET | /assets/duplicates | Find duplicate assets | Yes |
| PUT | /assets/{id}/status | Update asset status | Yes |
| POST | /assets/{id}/relationships | Add asset relationship | Yes |
| GET | /assets/{id}/relationships | Get asset relationships | Yes |
| GET | /assets/stats/overview | Asset statistics | Yes |
Asset Queue
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /asset-queue/status | Queue processing status | Yes |
| POST | /asset-queue/pause | Pause queue processing | Yes |
| POST | /asset-queue/resume | Resume queue processing | Yes |
| GET | /asset-queue/asset/{id} | Get asset queue entry | Yes |
| POST | /asset-queue/vram-pressure | Report VRAM pressure | Yes |
| POST | /asset-queue/rescan/{id} | Re-queue asset for analysis | Yes |
| POST | /asset-queue/batch-rescan | Batch re-queue assets | Yes |
File Serving
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /files/{path} | Serve static file | No |
| POST | /upload/character/{id}/image | Upload character image | Yes |
| POST | /upload/location/{id}/image | Upload location image | Yes |
| POST | /upload/brand/{id}/image | Upload brand image | Yes |
| POST | /upload/{type}/{id} | Upload file for any entity | Yes |
Plugins
Plugin Management
Prefix: /api/plugins
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | “ | List all plugins | Yes |
| POST | /install | Install plugin from URL/archive | Yes (admin) |
| POST | /{id}/enable | Enable plugin | Yes (admin) |
| POST | /{id}/disable | Disable plugin | Yes (admin) |
| POST | /{id}/update | Update plugin | Yes (admin) |
| DELETE | /{id} | Uninstall plugin | Yes (admin) |
| POST | /{id}/backup | Backup plugin data | Yes (admin) |
| POST | /{id}/restore | Restore plugin from backup | Yes (admin) |
| GET | /{id}/backups | List plugin backups | Yes |
| GET | /{id}/settings | Get plugin settings | Yes |
| PUT | /{id}/settings | Update plugin settings | Yes (admin) |
| GET | /{id}/settings/user | Get user-specific settings | Yes |
| PUT | /{id}/settings/user | Update user-specific settings | Yes |
| GET | /page/{id} | Serve plugin page | Yes |
| GET | /page/{id}/{subpath} | Serve plugin subpage | Yes |
| GET | /panel/{id}/{panel_id} | Serve plugin panel HTML | Yes |
Plugin Data
Prefix: /api/plugins
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /{id}/data/{record_type} | List plugin data records | Yes |
| POST | /{id}/data/{record_type} | Create data record | Yes |
| GET | /{id}/data/{record_type}/{record_id} | Get data record | Yes |
| PUT | /{id}/data/{record_type}/{record_id} | Update data record | Yes |
| DELETE | /{id}/data/{record_type}/{record_id} | Delete data record | Yes |
Plugin Marketplace
Prefix: /api/marketplace
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | “ | Browse marketplace | No |
| GET | /info | Marketplace info | No |
| GET | /{id} | Get plugin details | No |
| POST | /registry | Register plugin in marketplace | Yes (admin) |
| GET | /tenant/installed | List tenant’s installed plugins | Yes |
| POST | /tenant/install | Install from marketplace | Yes |
| POST | /tenant/{id}/enable | Enable installed plugin | Yes |
| POST | /tenant/{id}/disable | Disable installed plugin | Yes |
| DELETE | /tenant/{id} | Uninstall marketplace plugin | Yes |
Search and Relationships
Prefix: /api
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /search | Search across entity types | Yes |
| GET | /search/all | Full-text search all entities | Yes |
| GET | /recent | Recently updated entities | Yes |
| GET | /relationships/{type}/{id} | Get entity relationships | Yes |
| GET | /graph/universe | Get full entity relationship graph | Yes |
| GET | /graph/entity/{type}/{id} | Get entity-centric subgraph | Yes |
Cross-References and Context
Prefix: /api/entity
| Method | Path | Description | Auth |
|---|---|---|---|
| POST | /cross-reference/query | Query cross-references | Yes |
| POST | /cross-reference/context | Build cross-reference context | Yes |
| POST | /cross-reference/romance | Find romantic connections | Yes |
| POST | /cross-reference/faction-war | Find faction conflicts | Yes |
| GET | /cross-reference/validate/{type}/{id} | Validate references | Yes |
| POST | /hybrid-relationships | Discover hybrid relationships | Yes |
| POST | /semantic-connections | Find semantic connections via embeddings | Yes |
| POST | /structured-relationships | Structured relationship query | Yes |
| POST | /enhanced-context | Build enhanced entity context for AI | Yes |
Layouts
Prefix: /api/layouts
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | “ | List all layout definitions | No |
| GET | /{type} | Get layout for entity type | No |
| PUT | /{type} | Update layout for entity type | Yes |
| POST | /{type}/reset | Reset layout to defaults | Yes |
| DELETE | /{type} | Delete custom layout | Yes |
Timeline
Prefix: /api/timeline
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | “ | List timeline events with filtering | Yes |
| POST | /auto-populate | Auto-populate timeline from entity data | Yes |
| GET | /conflicts | Find timeline conflicts | Yes |
| POST | /export | Export timeline data | Yes |
Assembly System
Prefix: /api/assembly
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /{id}/slots | List assembly slots | Yes |
| GET | /{id}/slots/{group} | Get slots by group | Yes |
| POST | /{id}/slots | Add slot to assembly | Yes |
| DELETE | /{id}/slots/{group}/{name} | Remove slot | Yes |
| PUT | /{id}/slots/reorder | Reorder slots | Yes |
| PUT | /{id}/slots/{group}/{name}/transform | Transform slot | Yes |
| POST | /{id}/parent | Set parent assembly | Yes |
| DELETE | /{id}/parent | Remove parent | Yes |
| GET | /{id}/inheritance | Get inheritance chain | Yes |
| POST | /{id}/slots/lock | Lock slots | Yes |
| POST | /{id}/slots/unlock | Unlock slots | Yes |
| GET | /{id}/zombie/{stage} | Get zombie stage data | Yes |
| POST | /{id}/zombie/validate | Validate zombie assembly | Yes |
| GET | /export/profiles | List export profiles | Yes |
| POST | /{id}/export/{profile} | Export assembly | Yes |
| GET | /{id}/manifest/{profile} | Get export manifest | Yes |
| POST | /{id}/validate | Validate assembly | Yes |
| GET | /{id}/validate/status | Validation status | Yes |
| GET | /{id}/completeness | Check assembly completeness | Yes |
| GET | /{id}/preview | Preview assembly | Yes |
| GET | /by-asset/{asset_id} | Find assemblies using asset | Yes |
| POST | /auto-detect-slot | Auto-detect slot type for asset | Yes |
| GET | /template/types | List assembly template types | Yes |
| GET | /template/slot-definitions | Get slot definitions | Yes |
| POST | /export/profiles/reload | Reload export profiles | Yes |
Recycle Bin
Prefix: /api
Entities
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /recycle-bin/entity | List recycled entities | Yes |
| POST | /recycle-bin/entity/{type}/{id}/restore | Restore entity | Yes |
| DELETE | /recycle-bin/entity/{type}/{id}/permanent | Permanently delete | Yes (admin) |
| POST | /recycle-bin/entity/empty | Empty entity recycle bin | Yes (admin) |
Assets
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /recycle-bin | List recycled assets | Yes |
| POST | /recycle-bin/{id}/restore | Restore asset | Yes |
| DELETE | /recycle-bin/{id}/permanent | Permanently delete asset | Yes (admin) |
| POST | /recycle-bin/empty | Empty asset recycle bin | Yes (admin) |
| POST | /recycle-bin/auto-cleanup | Auto-cleanup old items | Yes (admin) |
Services and Health
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /health | Basic health check | No |
| GET | /api/health | Basic health check (prefixed) | No |
| GET | /health/detailed | Detailed health with DB status | No |
| GET | /api/check-entity-id/{id} | Check if entity ID is available | No |
| GET | /api/services/status | Service status (backend, AI, DB) | Yes |
| POST | /api/services/restart/{service} | Restart a service | Yes (admin) |
| POST | /api/services/terminate/ai | Terminate AI service | Yes (admin) |
| GET | /api/services/logs/{service} | Get service logs | Yes |
| POST | /api/services/logs/{service}/clear | Clear service logs | Yes (admin) |
| GET | /api/services/logs/list | List available log files | Yes |
| POST | /api/logs/frontend | Submit frontend log entries | No |
WebSocket
Endpoint: ws://host:8201/api/ws
Connect with a JWT token as a query parameter or in the first message. The WebSocket channel provides real-time events:
| Event | Description |
|---|---|
entity_updated | Entity was created, updated, or deleted |
sync_completed | Markdown sync finished |
presence_update | User came online/offline/started editing |
brainbits_deducted | BrainBits consumed for AI operation |
asset_processed | Asset analysis completed |
Presence
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /api/presence/{tenant_id} | Get online users for tenant | Yes |
| GET | /api/presence/{tenant_id}/editing | Get who is editing what | Yes |
Settings
Prefix: /api/settings
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | “ | Get user settings | Yes |
| PUT | “ | Update user settings | Yes |
| GET | /keys | List configured AI provider keys | Yes |
| PUT | /keys/{provider} | Set AI provider key | Yes |
| DELETE | /keys/{provider} | Remove AI provider key | Yes |
Feature Gates
Prefix: /api/features
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | “ | Get enabled features for current tier | Yes |
| GET | /tiers | List all tiers and their features | No |
Groups and Quotas
Groups
Prefix: /api/groups
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /presets | List group presets | Yes |
| GET | /user/{user_id} | Get user’s groups | Yes |
| POST | “ | Create group | Yes (admin) |
| GET | “ | List groups | Yes |
| GET | /{id} | Get group | Yes |
| PUT | /{id} | Update group | Yes (admin) |
| DELETE | /{id} | Delete group | Yes (admin) |
| POST | /{id}/members | Add member to group | Yes (admin) |
| DELETE | /{id}/members/{user_id} | Remove member | Yes (admin) |
Quota Groups
Prefix: /api/quota-groups
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | / | List quota groups | Yes |
| PUT | /{id}/quota | Update group quota | Yes (admin) |
| GET | /{id}/usage | Get group usage | Yes |
| POST | /{id}/reset | Reset group usage counters | Yes (admin) |
Sharing
Prefix: (none, uses full paths)
| Method | Path | Description | Auth |
|---|---|---|---|
| POST | /api/shares | Create share link | Yes |
| GET | /api/shares | List shares | Yes |
| DELETE | /api/shares/{id} | Delete share | Yes |
| GET | /api/share/{code} | Access shared content | No |
| GET | /api/share/{code}/entities/{type} | List entities in share | No |
Database Admin
Prefix: /api
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /database/test | Test database connection | Yes |
| GET | /database/tables | List database tables | Yes (admin) |
| GET | /database/tables/{name}/data | View table data | Yes (admin) |
| POST | /database/query | Execute read-only SQL query | Yes (admin) |
| GET | /database/statistics | Database statistics | Yes |
| GET | /database/entities | Entity count by type | Yes |
| POST | /database/export | Export database | Yes (admin) |
| POST | /database/import | Import database | Yes (admin) |
| POST | /database/backup | Create database backup | Yes (admin) |
AI (Backend-Proxied)
These backend endpoints proxy specific AI operations. Most AI operations go directly to the AI service on port 8202.
Prefix: /api
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /image/styles/{type} | Get image generation styles for entity type | Yes |
| POST | /generate/character | Generate character via AI | Yes |
| POST | /enhance/character/{id} | Enhance existing character | Yes |
| POST | /generate/dialogue/{id} | Generate dialogue for character | Yes |
Image Presets
Prefix: /api
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /presets | List image generation presets | Yes |
| POST | /presets | Create preset | Yes |
| GET | /presets/{id} | Get preset | Yes |
| PUT | /presets/{id} | Update preset | Yes |
| DELETE | /presets/{id} | Delete preset | Yes |
Context Profiles
Prefix: /api/context-profiles
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | “ | List context profiles | Yes |
| POST | “ | Create context profile | Yes |
| GET | /{id} | Get context profile | Yes |
| PUT | /{id} | Update context profile | Yes |
| DELETE | /{id} | Delete context profile | Yes |
| POST | /{id}/resolve | Resolve profile (expand entity refs) | Yes |
Prompt Templates
Prefix: /api/prompt-templates
| Method | Path | Description | Auth |
|---|---|---|---|
| POST | /resolve | Resolve template variables | Yes |
| POST | /resolve-batch | Batch resolve templates | Yes |
| GET | /available-fields/{type} | List available template fields | Yes |
Inventory
Prefix: /api
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /items | List inventory items | Yes |
| GET | /items/categories | List item categories | Yes |
| GET | /items/{id} | Get item details | Yes |
| POST | /items | Create item | Yes |
| PUT | /items/{id} | Update item | Yes |
| DELETE | /items/{id} | Delete item | Yes |
| POST | /items/import/verse | Import items from Verse format | Yes |
| POST | /items/import/json | Import items from JSON | Yes |
| GET | /items/export/json | Export items as JSON | Yes |
| GET | /items/export/verse | Export items as Verse | Yes |
Migration and Archive
Prefix: /api
| Method | Path | Description | Auth |
|---|---|---|---|
| POST | /migration/import | Import full data export | Yes (admin) |
| GET | /migration/export | Export all data | Yes (admin) |
| GET | /archive/fallbacks | List archived fallback data | Yes |
| POST | /archive/fallbacks/restore | Restore from archive | Yes |
| POST | /archive/fallbacks/cleanup | Cleanup old archives | Yes (admin) |
Statistics and Activity
Prefix: /api
| Method | Path | Description | Auth |
|---|---|---|---|
| GET | /stats/dashboard | Dashboard statistics | Yes |
| GET | /activity/recent | Recent activity feed | Yes |
| GET | /activity/history | Full activity history | Yes |