MATIH Platform is in active MVP development. Documentation reflects current implementation status.
7. Tenant Lifecycle
Tenant Endpoints

Tenant Endpoints

The tenant endpoints manage the core tenant lifecycle, including creation, retrieval, updates, tier upgrades, suspension, activation, and deletion. Served by TenantController at /api/v1/tenants.


Endpoints

MethodEndpointDescription
POST/api/v1/tenantsCreate tenant and start provisioning
GET/api/v1/tenantsList tenants (paginated, filterable)
GET/api/v1/tenants/:idGet tenant by ID
GET/api/v1/tenants/slug/:slugGet tenant by slug
PUT/api/v1/tenants/:idUpdate tenant properties
POST/api/v1/tenants/:id/upgradeUpgrade tenant tier
POST/api/v1/tenants/:id/suspendSuspend tenant access
POST/api/v1/tenants/:id/activateReactivate suspended tenant
DELETE/api/v1/tenants/:idSoft delete tenant
GET/api/v1/tenants/:id/resourcesGet provisioned resources
GET/api/v1/tenants/statsGet tenant statistics

POST /api/v1/tenants

Creates a new tenant and initiates asynchronous provisioning. Returns the tenant record immediately while provisioning runs in the background.

{
  "name": "Acme Corporation",
  "slug": "acme-corp",
  "tier": "PROFESSIONAL",
  "adminEmail": "admin@acme.com",
  "region": "us-east-1",
  "settings": {
    "maxUsers": 100,
    "dataRetentionDays": 365
  }
}
StatusDescription
201Tenant created, provisioning started
400Invalid request
409Tenant with slug already exists

GET /api/v1/tenants

Returns a paginated list of tenants with filtering and search.

ParameterTypeDefaultDescription
pageint0Page number
sizeint20Page size
sortBystringcreatedAtSort field
sortDirstringdescSort direction (asc or desc)
statusenum--Filter by status (ACTIVE, SUSPENDED, etc.)
searchstring--Search by name or slug

Tenant Tier Upgrade

POST /api/v1/tenants/:id/upgrade
{
  "newTier": "ENTERPRISE"
}

Supported tiers: FREE, STARTER, PROFESSIONAL, ENTERPRISE.


Suspend and Activate

Suspending a tenant disables all access. An optional reason can be provided.

POST /api/v1/tenants/:id/suspend?reason=Payment%20overdue
POST /api/v1/tenants/:id/activate

DELETE /api/v1/tenants/:id

Performs a soft delete. The tenant record is retained for audit purposes but all provisioned resources are scheduled for deprovisioning.