Admin API

Platform admin endpoints for tenant lifecycle and invite code management.

Overview

The Admin API provides platform-level management of tenants and invite codes. All routes require an API key whose userId is listed in the BRAINSTORMROUTER_PLATFORM_ADMIN_IDS environment variable (comma-separated). This is an allowlist, not RBAC -- only founder-level user IDs have access.

All state-mutating endpoints support ?dry_run=true, which returns what _would_ happen without persisting changes. Useful for Virtual C-Suite agents.

Endpoints

MethodPathDescription
GET/v1/admin/tenantsList tenants
GET/v1/admin/tenants/:idGet tenant detail
POST/v1/admin/tenants/:id/approveApprove a tenant
POST/v1/admin/tenants/:id/rejectReject a tenant
POST/v1/admin/tenants/:id/suspendSuspend a tenant
GET/v1/admin/invite-codesList invite codes
POST/v1/admin/invite-codesCreate an invite code
DELETE/v1/admin/invite-codes/:idDelete an invite code
GET/v1/admin/digestBusiness summary digest

List tenants

curl https://api.brainstormrouter.com/v1/admin/tenants?status=pending \
  -H "Authorization: Bearer br_live_..."

Optional query: ?status=pending|active|suspended|rejected.

Approve / reject / suspend

curl -X POST https://api.brainstormrouter.com/v1/admin/tenants/:id/approve?dry_run=true \
  -H "Authorization: Bearer br_live_..."

Dry-run response:

{
  "dry_run": true,
  "would_execute": { "action": "approve_tenant", "id": "..." }
}

Create invite code

curl -X POST https://api.brainstormrouter.com/v1/admin/invite-codes \
  -H "Authorization: Bearer br_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "code": "LAUNCH2026", "max_uses": 100, "expires_at": "2026-12-31T00:00:00Z" }'

All fields are optional. If code is omitted, one is auto-generated.

Business digest

curl https://api.brainstormrouter.com/v1/admin/digest \
  -H "Authorization: Bearer br_live_..."

Returns an aggregate summary: tenant counts by status, active API keys, and usage metrics.

SDK and MCP

  • TypeScript SDK: client.admin.listTenants(), client.admin.getTenant(id),

client.admin.approveTenant(id), client.admin.rejectTenant(id), client.admin.suspendTenant(id), client.admin.listInviteCodes(), client.admin.createInviteCode(opts), client.admin.deleteInviteCode(id), client.admin.getDigest()

  • MCP tools: br_list_tenants, br_approve_tenant, br_reject_tenant,

br_get_business_digest, br_create_invite_code