openapi: 3.1.0 info: title: Dexwize Tenant Service version: 1.0.0 description: > Tenant lifecycle, residency and privacy settings. Every request requires a bearer token issued by identity-service carrying `tid` (tenant), `sub` and `role` claims. Cross-tenant access returns 404, indistinguishable from a missing resource. servers: - url: https://api.dexwize.example security: - bearer: [] paths: /v1/sandboxes: post: operationId: createSandboxTenant description: > An expiring sandbox tenant for an Academy lab (service token with lab_provisioner only). Sandboxes are SaaS tenants on the academy-lab plan and must expire within seven days. requestBody: required: true content: application/json: schema: type: object required: [name, expiresAt] properties: name: { type: string, maxLength: 120 } expiresAt: { type: string, format: date-time } responses: '201': description: Created content: application/json: schema: type: object required: [id, expiresAt] properties: id: { type: string, format: uuid } expiresAt: { type: string, format: date-time } '400': { description: Invalid name or lifetime } /v1/sandboxes/{id}: delete: operationId: removeSandboxTenant description: Suspends a sandbox tenant. Tenants on any other plan are never touched (404). parameters: - { name: id, in: path, required: true, schema: { type: string, format: uuid } } responses: '204': { description: Removed } '404': { description: Not a sandbox } /v1/tenants: post: summary: Create a tenant description: Platform operators may create any tenant; partner admins only under their own partner id. operationId: createTenant requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateTenantRequest' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/Tenant' '400': $ref: '#/components/responses/ValidationProblem' '401': description: Missing or invalid token '403': description: Caller may not create this tenant get: summary: 'List tenants: platform scope sees all (audited operator path); a partner admin sees only its own customers' operationId: listTenants parameters: - name: status in: query required: false schema: type: string enum: - active - suspended - offboarding - name: partnerId in: query required: false schema: type: string format: uuid - name: q in: query required: false description: Case-insensitive name contains (wildcards matched literally) schema: type: string maxLength: 200 - name: offset in: query required: false schema: type: integer minimum: 0 default: 0 - name: limit in: query required: false schema: type: integer minimum: 1 maximum: 200 default: 50 responses: '200': description: OK content: application/json: schema: type: object properties: items: type: array items: $ref: '#/components/schemas/Tenant' nextOffset: type: - integer - 'null' description: Pass as offset for the next page; null on the last page '400': description: Invalid filter '401': description: Missing or invalid token '403': description: Not a platform-scope operator or a partner admin with a partner claim /v1/tenants/me: get: summary: The caller's own tenant operationId: getMyTenant responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Tenant' '401': description: Missing or invalid token '403': description: Missing tenant read permission /v1/tenants/{id}: get: summary: Get a tenant visible to the caller operationId: getTenant parameters: - $ref: '#/components/parameters/TenantId' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Tenant' '401': description: Missing or invalid token '404': description: Not found or not visible to the caller /v1/tenants/{id}/suspend: post: summary: Suspend a tenant (platform operator) operationId: suspendTenant parameters: - $ref: '#/components/parameters/TenantId' responses: '200': description: Suspended content: application/json: schema: $ref: '#/components/schemas/Tenant' '403': description: Not a platform operator '404': description: Not found '409': description: Tenant is not active /v1/tenants/{id}/privacy-mode: put: summary: Set privacy mode (tenant admin, own tenant only) operationId: setPrivacyMode parameters: - $ref: '#/components/parameters/TenantId' requestBody: required: true content: application/json: schema: type: object required: - mode properties: mode: type: string enum: - Standard - Strict responses: '200': description: Updated content: application/json: schema: $ref: '#/components/schemas/Tenant' '403': description: Missing privacy settings permission '404': description: Not found or not the caller's tenant /v1/tenants/{id}/autonomy: put: summary: Set remediation autonomy for the tenant and per action category (tenant admin, own tenant only, audited) description: Each category level must be at most maxAutonomy. Air-gapped tenants cannot be Autonomous. operationId: setAutonomy parameters: - $ref: '#/components/parameters/TenantId' requestBody: required: true content: application/json: schema: type: object required: - maxAutonomy properties: maxAutonomy: $ref: '#/components/schemas/AutonomyLevel' categories: type: object maxProperties: 64 propertyNames: pattern: '^[a-z0-9._-]{1,64}$' additionalProperties: $ref: '#/components/schemas/AutonomyLevel' responses: '200': description: Updated content: application/json: schema: $ref: '#/components/schemas/Tenant' '400': description: Unknown level, malformed category or a category above maxAutonomy '403': description: Missing TenantManage '404': description: Not found or not the caller's tenant /v1/internal/tenant-regions: get: summary: Hosting region of every tenant for platform KPIs (operator-console only) description: > Platform-level service token with the service-only role revenue_kpi_reader (operator-console, ADR-0050). The id, region and deployment model of each tenant; no names, partners or settings. Not routed through the gateway. operationId: tenantRegionsInternal responses: '200': description: OK content: application/json: schema: type: array items: type: object required: - tenantId - region - deploymentModel properties: tenantId: type: string format: uuid region: type: string deploymentModel: type: string enum: - SharedSaas - Dedicated - AirGapped '403': description: Not a platform-level service token with revenue_kpi_reader /v1/tenants/{id}/sign-in-status: get: summary: Lifecycle status for identity-service sign-in checks (workload role tenant_status_reader only) operationId: tenantSignInStatus parameters: - name: id in: path required: true schema: type: string format: uuid responses: '200': description: OK content: application/json: schema: type: object properties: status: type: string enum: - Active - Suspended - Offboarding '403': description: Missing TenantStatusRead '404': description: Unknown tenant components: securitySchemes: bearer: type: http scheme: bearer bearerFormat: JWT parameters: TenantId: name: id in: path required: true schema: type: string format: uuid responses: ValidationProblem: description: Validation failed content: application/problem+json: schema: type: object properties: title: type: string errors: type: object additionalProperties: type: array items: type: string schemas: AutonomyLevel: type: string enum: - Suggest - Approve - AutoPilotRing - Autonomous CreateTenantRequest: type: object required: - name - deploymentModel - region - planId properties: name: type: string minLength: 1 maxLength: 200 deploymentModel: type: string enum: - SharedSaas - Dedicated - AirGapped region: type: string enum: - uaenorth - uaecentral - customer-hosted description: SaaS and dedicated tenants must use a UAE region; air-gapped tenants use customer-hosted. planId: type: string partnerId: type: - string - 'null' format: uuid RetentionPolicy: type: object properties: rawBatchDays: type: integer detailedTelemetryDays: type: integer aggregateDays: type: integer findingsAndReportsDays: type: integer auditDays: type: integer Tenant: type: object required: - id - name - deploymentModel - region - planId - status - privacyMode - maxAutonomy - retention - createdAt - categoryAutonomy properties: id: type: string format: uuid name: type: string partnerId: type: - string - 'null' format: uuid deploymentModel: type: string enum: - SharedSaas - Dedicated - AirGapped region: type: string planId: type: string status: type: string enum: - Active - Suspended - Offboarding privacyMode: type: string enum: - Standard - Strict maxAutonomy: $ref: '#/components/schemas/AutonomyLevel' retention: $ref: '#/components/schemas/RetentionPolicy' createdAt: type: string format: date-time categoryAutonomy: description: Autonomy per action category (content manifest category); unlisted categories use maxAutonomy type: object additionalProperties: $ref: '#/components/schemas/AutonomyLevel'