MATIH Platform is in active MVP development. Documentation reflects current implementation status.
7. Tenant Lifecycle
Tenant Management
Self-Service Portal

Self-Service Portal

The SelfServicePortalController at /api/v1/tenants/{tenantId}/portal provides tenant administrators with self-service capabilities for managing settings and team invitations without platform admin intervention.


Settings Management

Tenant settings are organized into categories via the TenantSettings.SettingsCategory enum. Each category stores key-value configuration as JSON.

Endpoints

MethodPathDescription
GET/portal/settingsGet all settings
GET/portal/settings/{category}Get settings by category
POST/portal/settings/initializeInitialize all default settings
PUT/portal/settings/{category}Update settings for a category

Example: Get All Settings

curl http://localhost:8082/api/v1/tenants/{tenantId}/portal/settings \
  -H "Authorization: Bearer $TOKEN"

Example: Update Settings

curl -X PUT http://localhost:8082/api/v1/tenants/{tenantId}/portal/settings/GENERAL \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -H "X-User-Id: user-uuid" \
  -d '{
    "values": {
      "timezone": "America/New_York",
      "dateFormat": "MM/DD/YYYY",
      "language": "en-US"
    }
  }'

Team Invitations

The self-service portal manages team invitations with a complete lifecycle: create, resend, revoke, accept, and decline.

Endpoints

MethodPathDescription
GET/portal/invitationsList invitations (paginated)
GET/portal/invitations/pendingList pending invitations
GET/portal/invitations/summaryGet invitation statistics
POST/portal/invitationsCreate invitation
POST/portal/invitations/bulkBulk invite
GET/portal/invitations/{id}Get invitation by ID
POST/portal/invitations/{id}/resendResend invitation email
POST/portal/invitations/{id}/revokeRevoke invitation
GET/portal/invitations/token/{token}Get invitation by token
POST/portal/invitations/token/{token}/acceptAccept invitation
POST/portal/invitations/token/{token}/declineDecline invitation

Example: Create Invitation

curl -X POST http://localhost:8082/api/v1/tenants/{tenantId}/portal/invitations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -d '{
    "email": "newuser@acme.com",
    "role": "DATA_ANALYST",
    "message": "Join our analytics team"
  }'

Example: Bulk Invite

curl -X POST http://localhost:8082/api/v1/tenants/{tenantId}/portal/invitations/bulk \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -d '[
    { "email": "user1@acme.com", "role": "VIEWER" },
    { "email": "user2@acme.com", "role": "DATA_ANALYST" },
    { "email": "user3@acme.com", "role": "ADMIN" }
  ]'

Source Files

FilePath
Controllercontrol-plane/tenant-service/src/main/java/com/matih/tenant/controller/SelfServicePortalController.java
Servicecontrol-plane/tenant-service/src/main/java/com/matih/tenant/service/SelfServicePortalService.java
Settings Entitycontrol-plane/tenant-service/src/main/java/com/matih/tenant/entity/TenantSettings.java
Invitation Entitycontrol-plane/tenant-service/src/main/java/com/matih/tenant/entity/TeamInvitation.java