Tenants API
Create and manage client tenants, settings, and custom domains. All tenant management endpoints require tenants.manage permission (MSP admin only).
List tenants
httpGET /api/tenants Authorization: Bearer {msp-token} Host: atechsolutions.org # Returns array of all tenants with id, name, slug, active status, asset count
Get tenant
httpGET /api/tenants/{id} Authorization: Bearer {msp-token}
Create tenant
httpPOST /api/tenants Authorization: Bearer {msp-token} Content-Type: application/json {{ "name": "Acme Corp", "slug": "acme", "currency": "USD", "accent_color": "#3b82f6", "logo_url": "https://acme.com/logo.png" }} # On success, also seeds default categories and locations. # Returns the created tenant object.
Update tenant
httpPUT /api/tenants/{id} Authorization: Bearer {msp-token} Content-Type: application/json {{ "name": "Acme Corporation", "slug": "acme", # changing this changes the subdomain "currency": "CAD", "accent_color": "#10b981", "logo_url": "https://acme.com/new-logo.png", "active": true }}
Changing the slug changes the subdomain URL
Updating the slug immediately invalidates the old subdomain. All users' bookmarks and any previously shared invite links for the old URL stop working.
Delete tenant
httpDELETE /api/tenants/{id} Authorization: Bearer {msp-token} # Returns 200 OK on success # Permanently deletes the tenant and ALL its data
Deletion is permanent and immediate
There is no confirmation step in the API. Calling DELETE immediately destroys all tenant data with no recovery. Always take a database backup before deleting a tenant.
Tenant settings
http# Get current tenant settings (public endpoint — no auth) GET /api/public/branding Host: acme.atechsolutions.org # Returns: {{ "name": "Acme Corp", "logo_url": "https://acme.com/logo.png", "accent_color": "#3b82f6", "is_tenant": true }} # Update settings (requires settings.manage permission) PUT /api/settings Authorization: Bearer {client-admin-token} Content-Type: application/json {{ "name": "Acme Corp", "currency": "USD", "logo_url": "https://acme.com/logo.png", "accent_color": "#3b82f6" }}
Custom domains
http# List custom domains for a tenant GET /api/tenants/{id}/domains Authorization: Bearer {msp-token} # Add a custom domain POST /api/tenants/{id}/domains?domain=assets.acme.com Authorization: Bearer {msp-token} # Verify a domain (checks CNAME resolves correctly) PUT /api/tenants/{id}/domains/{did}/verify Authorization: Bearer {msp-token} # Remove a custom domain DELETE /api/tenants/{id}/domains/{did} Authorization: Bearer {msp-token}
MSP dashboard stats
httpGET /api/dashboard/msp Authorization: Bearer {msp-token} Host: atechsolutions.org # Returns aggregate stats across all tenants: {{ "total_assets": 847, "total_value": 412500, "total_tenants": 12, "total_users": 34, "expiring_warranties": 3, "open_requests": 6, "by_status": {{ "available": 312, "deployed": 489, "maintenance": 28, "retired": 18 }}, "tenants": [ {{ "id": 1, "name": "Acme Corp", "slug": "acme", "total_assets": 142, "total_value": 68000, "expiring_warranties": 1, "open_requests": 2 }} ] }}