openapi: 3.1.0 info: title: Dexwize Report Service version: 1.0.0 description: > Instant Assessment engagements and versioned, immutable reports (HTML and PDF, English and Arabic). Every request needs a bearer token with tid, sub and role claims; another tenant's report or engagement returns 404. On-demand generation forwards the caller's token to upstream services. Reports are retained for 7 years in WORM storage; regenerating creates a new version and never overwrites one. servers: - url: https://api.dexwize.example security: - bearer: [] paths: /v1/assessments: post: summary: Start an Instant Assessment (TenantManage) operationId: startAssessment requestBody: required: true content: application/json: schema: type: object required: [deviceCoverageTarget] properties: windowDays: { type: integer, minimum: 1, maximum: 90, default: 14 } deviceCoverageTarget: { type: integer, minimum: 1, maximum: 1000000 } responses: '201': { description: Started, content: { application/json: { schema: { $ref: '#/components/schemas/AssessmentView' } } } } '400': { description: Window or target out of range } '403': { description: Missing TenantManage } get: summary: List engagements (ReportsRead) operationId: listAssessments responses: '200': { description: OK, content: { application/json: { schema: { type: array, items: { $ref: '#/components/schemas/Assessment' } } } } } /v1/assessments/{id}: get: summary: Engagement with progress (enrolled devices, days of data, coverage) operationId: getAssessment parameters: [{ $ref: '#/components/parameters/Id' }] responses: '200': { description: OK, content: { application/json: { schema: { $ref: '#/components/schemas/AssessmentView' } } } } '404': { description: Not found or another tenant } /v1/assessments/{id}/report: post: summary: Generate the assessment report now from data so far (ReportsGenerate); the engagement keeps collecting operationId: generateAssessmentReport parameters: [{ $ref: '#/components/parameters/Id' }] responses: '201': { description: Generated, content: { application/json: { schema: { $ref: '#/components/schemas/Report' } } } } '404': { description: Not found or another tenant } '409': { description: Engagement cancelled } /v1/assessments/{id}/cancel: post: summary: Cancel an engagement (TenantManage) operationId: cancelAssessment parameters: [{ $ref: '#/components/parameters/Id' }] responses: '200': { description: Cancelled, content: { application/json: { schema: { $ref: '#/components/schemas/Assessment' } } } } '404': { description: Not found } '409': { description: Not collecting } /v1/reports: post: summary: Generate an on-demand executive report (ReportsGenerate) operationId: generateReport requestBody: required: true content: application/json: schema: type: object required: [type] properties: type: { type: string, enum: [Executive], description: 'Assessment reports come from /v1/assessments; sustainability reports come from /v1/reports/sustainability; Xla and IaEvidence are not available here (400).' } from: { type: string, format: date-time, description: Defaults to 30 days before "to". } to: { type: string, format: date-time, description: Defaults to now. At most one year after "from". } responses: '201': { description: Generated, content: { application/json: { schema: { $ref: '#/components/schemas/Report' } } } } '400': { description: Unsupported type or invalid period } '403': { description: Missing ReportsGenerate } get: summary: List the tenant's reports, newest first (ReportsRead) operationId: listReports responses: '200': { description: OK, content: { application/json: { schema: { type: array, items: { $ref: '#/components/schemas/Report' } } } } } /v1/reports/{id}: get: summary: Report metadata, artifacts and hashes (ReportsRead) operationId: getReport parameters: [{ $ref: '#/components/parameters/Id' }] responses: '200': { description: OK, content: { application/json: { schema: { $ref: '#/components/schemas/Report' } } } } '404': { description: Not found or another tenant } /v1/reports/{id}/artifacts/{format}: get: summary: Download an artifact (audited). Refused if the stored bytes no longer match the recorded SHA-256. operationId: downloadReport parameters: - { $ref: '#/components/parameters/Id' } - { name: format, in: path, required: true, schema: { type: string, enum: [html, pdf, csv, json] } } - { name: language, in: query, schema: { type: string, enum: [English, Arabic], default: English } } responses: '200': description: The artifact (csv and json are the results and signed manifest of an ia_evidence pack) content: application/pdf: { schema: { type: string, format: binary } } text/html: { schema: { type: string } } text/csv: { schema: { type: string } } application/json: { schema: { type: object, additionalProperties: true } } '404': { description: 'Not found, another tenant, or unknown format or language' } '409': { description: Integrity check failed } /v1/reports/ia-evidence: post: summary: Store an IA evidence pack built by compliance-service as an immutable ia_evidence report version (ReportsGenerate) operationId: storeEvidencePack requestBody: required: true content: application/json: schema: type: object required: [sourceRef, resultsCsvBase64, manifestBase64] properties: sourceRef: { type: string, description: 'ia-evidence/' } resultsCsvBase64: { type: string, contentEncoding: base64 } manifestBase64: { type: string, contentEncoding: base64, description: Must list results.csv with its SHA-256 } responses: '201': description: Stored content: application/json: schema: { $ref: '#/components/schemas/Report' } '400': { description: 'Invalid files, source reference or manifest' } '403': { $ref: '#/components/responses/FeatureNotEntitled' } '413': { description: A file exceeds 20 MB } '503': { $ref: '#/components/responses/EntitlementsUnavailable' } /v1/reports/{id}/verify: get: summary: Re-read and re-hash every artifact and the manifest (ReportsRead; auditors included) operationId: verifyReport parameters: [{ $ref: '#/components/parameters/Id' }] responses: '200': description: Verification result content: application/json: schema: type: object properties: intact: { type: boolean } manifestIntact: { type: boolean } mismatchedArtifacts: { type: array, items: { type: string } } missingArtifacts: { type: array, items: { type: string } } '404': { description: Not found or another tenant } /v1/report-settings: get: summary: Per-tenant report settings (ReportsRead) operationId: getReportSettings responses: '200': { description: OK, content: { application/json: { schema: { $ref: '#/components/schemas/Settings' } } } } put: summary: Change report settings (TenantManage; audited) operationId: putReportSettings requestBody: { required: true, content: { application/json: { schema: { $ref: '#/components/schemas/Settings' } } } } responses: '200': { description: Saved, content: { application/json: { schema: { $ref: '#/components/schemas/Settings' } } } } '403': { description: Missing TenantManage } /v1/report-schedules/executive: post: summary: Schedule a monthly executive report on the first day of each month (TenantManage; audited) operationId: scheduleExecutive responses: '202': { description: Scheduled } /v1/reports/sustainability: post: summary: Generate an immutable sustainability report version for a month in English and Arabic (ReportsGenerate; Enterprise feature sustainability_reporting) operationId: generateSustainabilityReport requestBody: required: true content: application/json: schema: type: object required: [period] properties: period: { type: string, description: 'Month as yyyy-MM', pattern: '^[0-9]{4}-[0-9]{2}$' } responses: '201': description: Stored as sustainability.en.html, sustainability.ar.html and sustainability.json content: application/json: schema: { $ref: '#/components/schemas/Report' } '400': { description: The period is not a month in the form yyyy-MM } '403': { $ref: '#/components/responses/FeatureNotEntitled' } '503': { $ref: '#/components/responses/EntitlementsUnavailable' } components: securitySchemes: bearer: { type: http, scheme: bearer, bearerFormat: JWT } parameters: Id: { name: id, in: path, required: true, schema: { type: string, format: uuid } } responses: FeatureNotEntitled: description: The caller lacks the permission (empty body), or the tenant's plan, add-ons, licence and overrides do not include the feature (error feature_not_entitled, ADR-0053). content: { application/json: { schema: { $ref: '#/components/schemas/EntitlementRefusal' } } } EntitlementsUnavailable: description: The tenant's entitlements could not be confirmed and nothing usable was cached, so the paid feature is refused (fail closed, ADR-0053). Retry-After is set. content: { application/json: { schema: { $ref: '#/components/schemas/EntitlementRefusal' } } } schemas: EntitlementRefusal: description: Module licensing refusal (ADR-0053). type: object required: [error, feature] properties: error: { type: string, enum: [feature_not_entitled, entitlements_unavailable] } feature: { type: string, description: Catalogue feature code, for example query } Assessment: type: object properties: id: { type: string, format: uuid } tenantId: { type: string, format: uuid } startedAt: { type: string, format: date-time } windowDays: { type: integer } deviceCoverageTarget: { type: integer } startedBy: { type: string } status: { type: string, enum: [Collecting, Reported, Cancelled] } finalReportId: { type: [string, 'null'], format: uuid } windowEnd: { type: string, format: date-time } AssessmentView: type: object properties: engagement: { $ref: '#/components/schemas/Assessment' } progress: type: object properties: enrolledDevices: { type: integer } deviceCoverageTarget: { type: integer } coveragePercent: { type: number } daysOfData: { type: integer } windowDays: { type: integer } windowComplete: { type: boolean } coverageMet: { type: boolean } Report: type: object properties: id: { type: string, format: uuid } type: { type: string, enum: [Assessment, Executive, Xla, Sustainability, IaEvidence] } version: { type: integer, minimum: 1 } sourceRef: { type: string, description: 'assessment/{id}, executive/{yyyy-MM} or executive/on-demand/{from}-{to}' } createdAt: { type: string, format: date-time } createdBy: { type: string } retainUntil: { type: string, format: date-time } immutableHash: { type: string, description: SHA-256 manifest hash over identity, version and every artifact hash } aiPromptVersions: { type: array, items: { type: string } } artifacts: type: array items: type: object properties: format: { type: string, enum: [Html, Pdf, Csv, Json] } language: { type: string, enum: [English, Arabic] } storageKey: { type: string } sha256: { type: string } length: { type: integer } Settings: type: object required: [aiNarrative, arabicIndicDigits] properties: aiNarrative: { type: boolean, description: 'False forces template narrative (no AI).' } arabicIndicDigits: { type: boolean }