Multi-Tenant API Reference
All multi-tenant endpoints are prefixed with /api/tenants.
Authentication
Most endpoints require authentication via Bearer token:
Authorization: Bearer {access_token}
Public Endpoints
Register New Organization
POST /api/tenants/register
Submit a new organization registration request.
Request Body:
{
"email": "user@example.com",
"password": "securepassword",
"company_name": "Acme Corp",
"contact_name": "John Doe",
"phone": "+1234567890",
"desired_org_name": "Acme Corp",
"desired_org_slug": "acme-corp",
"utm_source": "google",
"utm_medium": "cpc",
"utm_campaign": "summer"
}
Registration Management (Superadmin)
List Registration Requests
GET /api/tenants/requests?status={status}
Query params: status (pending_approval, approved, rejected, active)
Get Request Details
GET /api/tenants/requests/{request_id}
Approve Request
POST /api/tenants/requests/{request_id}/approve
Request Body:
{
"org_name": "Custom Name",
"org_slug": "custom-slug",
"initial_credit_limit": 5000,
"storage_limit_gb": 20,
"max_users": 25
}
Reject Request
POST /api/tenants/requests/{request_id}/reject
Request Body:
{
"reason": "Invalid business information provided"
}
Provision Approved Request
POST /api/tenants/requests/{request_id}/provision
Partner Groups (Superadmin)
List Partner Groups
GET /api/tenants/partner-groups
Create Partner Group
POST /api/tenants/partner-groups
Request Body:
{
"name": "Gold Partners",
"description": "Premium partner tier",
"credit_discount_percent": 20
}
Update Partner Group
PUT /api/tenants/partner-groups/{id}
Delete Partner Group
DELETE /api/tenants/partner-groups/{id}
Admin Management (Superadmin)
List Admins
GET /api/tenants/admins
Create Admin
POST /api/tenants/admins
Request Body:
{
"name": "Agency XYZ",
"contact_email": "admin@agency.com",
"company_name": "Agency XYZ Ltd",
"phone": "+1234567890",
"partner_group_id": 1
}
Get Admin Details
GET /api/tenants/admins/{id}
Update Admin
PUT /api/tenants/admins/{id}
Grant Credits to Admin
POST /api/tenants/admins/{id}/grant-credits
Request Body:
{
"admin_id": 1,
"amount": 10000,
"reason": "Monthly allocation"
}
Suspend Admin
POST /api/tenants/admins/{id}/suspend
Request Body:
{
"reason": "Payment overdue"
}
Reactivate Admin
POST /api/tenants/admins/{id}/reactivate
Assign Owner User to Admin
POST /api/tenants/admins/{id}/assign-owner
Request Body:
{
"user_id": 123
}
Organizations
List All Organizations (Superadmin)
GET /api/tenants/organizations?status={status}
Get Organization Details
GET /api/tenants/organizations/{org_id}/detail
Update Organization
PUT /api/tenants/organizations/{org_id}/edit
Request Body:
{
"name": "New Name",
"custom_domain": "app.example.com",
"enabled_plugins": ["ecommerce", "linkedin", "calendar"],
"credit_limit": 10000,
"storage_limit_gb": 50,
"max_users": 100,
"bandwidth_limit_gb": 500
}
Update Organization Status
PUT /api/tenants/organizations/{org_id}/status
Request Body:
{
"status": "suspended"
}
Get Organization Usage
GET /api/tenants/organizations/{org_id}/usage
Update Organization Limits
PUT /api/tenants/organizations/{org_id}/limits
Set Credit Limit
PUT /api/tenants/organizations/{org_id}/credit-limit
Add Credits
POST /api/tenants/organizations/{org_id}/credits/add
Get Enabled Plugins
GET /api/tenants/organizations/{org_id}/plugins
Current User Endpoints
Get My Organization's Plugins
GET /api/tenants/my-organization/plugins
Returns plugins enabled for the current user's organization. Superadmins get all plugins.
Get Current Branding
GET /api/tenants/branding/current
Returns white-label branding config for the current context.
Branding (Admin/Superadmin)
Get Admin Branding
GET /api/tenants/admins/{admin_id}/branding
Update Admin Branding
PUT /api/tenants/admins/{admin_id}/branding
Request Body:
{
"branding": {
"logo_url": "https://example.com/logo.png",
"favicon_url": "https://example.com/favicon.ico",
"primary_color": "#FF5733",
"secondary_color": "#33FF57",
"app_name": "My App",
"footer_text": "© 2024 My Company",
"support_email": "support@example.com",
"hide_powered_by": true
}
}
Audit Logs
List Audit Logs
GET /api/tenants/audit-logs?action={action}&target_type={type}&limit={n}&offset={n}
Returns logs based on visibility rules (superadmin sees all, admin sees their orgs).
Get Audit Stats
GET /api/tenants/audit-logs/stats?days={n}
Notifications
List Notifications
GET /api/tenants/notifications?unread_only={bool}&limit={n}
Get Unread Count
GET /api/tenants/notifications/unread-count
Mark as Read
POST /api/tenants/notifications/{id}/read
Mark All as Read
POST /api/tenants/notifications/read-all
Platform Settings (Superadmin)
Get Settings
GET /api/tenants/settings
Update Settings
PUT /api/tenants/settings
Request Body:
{
"auto_approve_registrations": false,
"default_storage_limit_gb": 10,
"default_max_users": 10,
"default_bandwidth_limit_gb": 100,
"default_credit_limit": 0
}
Available Plugins
List Available Plugins
GET /api/tenants/available-plugins
Returns list of core plugins that can be enabled for organizations.