openapi: 3.1.0 info: title: Dexwize Recommendation Service version: 1.0.0 description: > Evidence-backed, prioritized recommendations (E07) with an approval workflow, change records and before/after measurement. Analysts request (RemediationExecute), approvers decide (RecommendationsApprove), and the requester can never approve their own request (403). Invalid state transitions return 409. Cross-tenant access returns 404. Enums are serialized as names. servers: - url: https://api.dexwize.example security: - bearer: [] paths: /v1/recommendations: get: summary: List recommendations by priority (FindingsRead) operationId: listRecommendations parameters: - name: status in: query schema: type: string enum: - proposed - approved - rejected - deferred - implemented - verified - regressed responses: '200': description: OK content: application/json: schema: type: array items: $ref: '#/components/schemas/Recommendation' '400': description: Unknown status /v1/recommendations/generate: post: summary: Create proposals for open findings that have none (RemediationExecute); idempotent per finding operationId: generateRecommendations responses: '200': description: The recommendations created by this call content: application/json: schema: type: array items: $ref: '#/components/schemas/Recommendation' '403': { description: 'Missing permission, or the tenant plan does not include recommendations (ADR-0053): {"error":"feature_not_entitled","feature":"recommendations"}', content: { application/json: { schema: { $ref: '#/components/schemas/FeatureRefusal' } } } } '503': { description: 'Entitlements could not be confirmed and nothing usable is cached; recommendations is refused (fail closed). Retry-After is set.', content: { application/json: { schema: { $ref: '#/components/schemas/FeatureRefusal' } } } } /v1/recommendations/{id}: get: operationId: getRecommendation parameters: - $ref: '#/components/parameters/Id' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Recommendation' '404': description: Not found /v1/recommendations/{id}/submit: post: summary: Request approval (RemediationExecute) operationId: submitRecommendation parameters: - $ref: '#/components/parameters/Id' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Recommendation' '404': description: Not found '409': description: Not allowed in the current state '403': { description: 'Missing permission, or the tenant plan does not include recommendations (ADR-0053): {"error":"feature_not_entitled","feature":"recommendations"}', content: { application/json: { schema: { $ref: '#/components/schemas/FeatureRefusal' } } } } '503': { description: 'Entitlements could not be confirmed and nothing usable is cached; recommendations is refused (fail closed). Retry-After is set.', content: { application/json: { schema: { $ref: '#/components/schemas/FeatureRefusal' } } } } /v1/recommendations/{id}/approve: post: summary: Approve and create the change record (RecommendationsApprove; not the requester) operationId: approveRecommendation parameters: - $ref: '#/components/parameters/Id' requestBody: required: true content: application/json: schema: type: object required: - windowStart - windowEnd properties: description: type: - string - 'null' rollbackSteps: type: array items: type: string description: Required for manual instructions. windowStart: type: string format: date-time windowEnd: type: string format: date-time responses: '200': description: Approved content: application/json: schema: $ref: '#/components/schemas/Recommendation' '403': { description: 'Requester cannot approve their own request, missing permission, or the tenant plan does not include recommendations (ADR-0053): {"error":"feature_not_entitled","feature":"recommendations"}', content: { application/json: { schema: { $ref: '#/components/schemas/FeatureRefusal' } } } } '404': description: Not found '409': description: Not requested, invalid window, or missing rollback steps '503': { description: 'Entitlements could not be confirmed and nothing usable is cached; recommendations is refused (fail closed). Retry-After is set.', content: { application/json: { schema: { $ref: '#/components/schemas/FeatureRefusal' } } } } /v1/recommendations/{id}/reject: post: operationId: rejectRecommendation parameters: - $ref: '#/components/parameters/Id' requestBody: required: true content: application/json: schema: type: object required: - reason properties: reason: type: string responses: '200': description: Rejected content: application/json: schema: $ref: '#/components/schemas/Recommendation' '400': description: Reason missing '409': description: Not allowed in the current state '403': { description: 'Missing permission, or the tenant plan does not include recommendations (ADR-0053): {"error":"feature_not_entitled","feature":"recommendations"}', content: { application/json: { schema: { $ref: '#/components/schemas/FeatureRefusal' } } } } '503': { description: 'Entitlements could not be confirmed and nothing usable is cached; recommendations is refused (fail closed). Retry-After is set.', content: { application/json: { schema: { $ref: '#/components/schemas/FeatureRefusal' } } } } /v1/recommendations/{id}/defer: post: operationId: deferRecommendation parameters: - $ref: '#/components/parameters/Id' requestBody: required: true content: application/json: schema: type: object required: - until - reason properties: until: type: string format: date-time reason: type: string responses: '200': description: Deferred; reopens automatically when the deferral ends content: application/json: schema: $ref: '#/components/schemas/Recommendation' '409': description: Not proposed, or the deferral end is not in the future '403': { description: 'Missing permission, or the tenant plan does not include recommendations (ADR-0053): {"error":"feature_not_entitled","feature":"recommendations"}', content: { application/json: { schema: { $ref: '#/components/schemas/FeatureRefusal' } } } } '503': { description: 'Entitlements could not be confirmed and nothing usable is cached; recommendations is refused (fail closed). Retry-After is set.', content: { application/json: { schema: { $ref: '#/components/schemas/FeatureRefusal' } } } } /v1/recommendations/{id}/implemented: post: summary: Record implementation; schedules the before/after measurement 7 days later (RemediationExecute) operationId: markImplemented parameters: - $ref: '#/components/parameters/Id' requestBody: content: application/json: schema: type: object properties: implementedAt: type: - string - 'null' format: date-time responses: '200': description: Implemented content: application/json: schema: $ref: '#/components/schemas/Recommendation' '409': description: Not approved, or implementation time in the future /v1/changes/{changeId}: get: operationId: getChangeRecord parameters: - $ref: '#/components/parameters/ChangeId' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ChangeRecord' '404': description: Not found /v1/changes/{changeId}/package: get: summary: Download the remediation package manifest for the customer's tooling (RemediationExecute; audited) operationId: getRemediationPackage parameters: - $ref: '#/components/parameters/ChangeId' responses: '200': description: dexwize.remediation-package.v1 manifest, SHA-256 stamped; contains no executable content content: application/json: schema: type: object '404': description: Not found /v1/impact-assumptions: get: operationId: getImpactAssumptions responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ImpactAssumptions' put: summary: Replace the tenant's impact assumptions; the version increments (TenantManage; audited) operationId: putImpactAssumptions requestBody: required: true content: application/json: schema: type: object required: - workingDaysPerMonth - defaultMinutesLostPerDevicePerDay properties: workingDaysPerMonth: type: integer minimum: 1 maximum: 31 defaultMinutesLostPerDevicePerDay: type: number minimum: 0 maximum: 480 minutesLostPerDevicePerDayByCategory: type: object additionalProperties: type: number minimum: 0 maximum: 480 responses: '200': description: Saved content: application/json: schema: $ref: '#/components/schemas/ImpactAssumptions' '400': description: Values out of bounds '403': { description: 'Missing permission, or the tenant plan does not include recommendations (ADR-0053): {"error":"feature_not_entitled","feature":"recommendations"}', content: { application/json: { schema: { $ref: '#/components/schemas/FeatureRefusal' } } } } '503': { description: 'Entitlements could not be confirmed and nothing usable is cached; recommendations is refused (fail closed). Retry-After is set.', content: { application/json: { schema: { $ref: '#/components/schemas/FeatureRefusal' } } } } components: securitySchemes: bearer: type: http scheme: bearer bearerFormat: JWT parameters: Id: name: id in: path required: true schema: type: string format: uuid ChangeId: name: changeId in: path required: true schema: type: string format: uuid schemas: FeatureRefusal: description: Module licensing refusal (ADR-0053); 403 feature_not_entitled or 503 entitlements_unavailable. type: object required: [error, feature] properties: error: { type: string, enum: [feature_not_entitled, entitlements_unavailable] } feature: { type: string, description: Feature code, for example remote_actions } ImpactAssumptions: type: object properties: version: type: integer workingDaysPerMonth: type: integer defaultMinutesLostPerDevicePerDay: type: number minutesLostPerDevicePerDayByCategory: type: object additionalProperties: type: number ChangeRecord: type: object properties: id: type: string format: uuid recommendationId: type: string format: uuid description: type: string rollbackSteps: type: array items: type: string minItems: 1 affectedDevices: type: array items: type: string format: uuid windowStart: type: string format: date-time windowEnd: type: string format: date-time approvedBy: type: string createdAt: type: string format: date-time Recommendation: type: object properties: id: type: string format: uuid findingId: type: string format: uuid findingType: type: string title: type: string kind: type: string enum: - Remediation - HardwareUpgrade rootCause: type: string enum: - Software - Configuration - Hardware severity: type: string enum: - Info - Low - Medium - High - Critical confidence: type: number needsReview: type: boolean evidence: type: array minItems: 1 items: type: object properties: deviceId: type: string format: uuid source: type: string batchId: type: - string - 'null' format: uuid recordIndex: type: - integer - 'null' table: type: - string - 'null' rowKey: type: - string - 'null' affectedDeviceIds: type: array items: type: string format: uuid impact: type: object properties: devicesAffected: type: integer minutesLostPerDevicePerDay: type: number workingDaysPerMonth: type: integer hoursSavedPerMonth: type: number assumptionsVersion: type: integer priorityScore: type: number description: hours saved per month x confidence x severity weight priority: type: string enum: - P1 - P2 - P3 - P4 action: type: object properties: kind: type: string enum: - ContentAction - ManualInstruction key: type: string status: type: string enum: - Proposed - Approved - Rejected - Deferred - Implemented - Verified - Regressed requestedBy: type: - string - 'null' deferredUntil: type: - string - 'null' format: date-time change: oneOf: - $ref: '#/components/schemas/ChangeRecord' - type: 'null' implementedAt: type: - string - 'null' format: date-time measurement: type: - object - 'null' properties: metric: type: string outcome: type: string enum: - Improved - NoChange - Regressed - Inconclusive pairedDevices: type: integer meanBefore: type: number meanAfter: type: number relativeChange: type: number pValue: type: number history: type: array items: type: object properties: from: type: string to: type: string actor: type: string at: type: string format: date-time reason: type: - string - 'null'