openapi: 3.1.0 info: title: Dexwize Notification Service version: 1.0.0 description: > Email, Microsoft Teams and signed webhook notifications in English and Arabic (ADR-0024). Services with the notification_sender role raise notifications; tenant admins configure channels. Targets and secrets are stored encrypted and never returned. servers: - url: https://api.dexwize.example security: - bearer: [] paths: /v1/notifications: post: summary: Raise a notification for a tenant (services only) operationId: sendNotification requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/SendRequest' } responses: '202': description: Accepted (or already accepted for this idempotency key) content: application/json: schema: { $ref: '#/components/schemas/AcceptResult' } '400': { description: 'Invalid event, locale, data or idempotency key' } '403': { description: Caller lacks the notification_sender role } '429': { description: Tenant notification limit reached; see Retry-After } /v1/notification-settings: get: summary: The caller's tenant notification settings (targets redacted) operationId: getNotificationSettings responses: '200': description: OK content: application/json: schema: { $ref: '#/components/schemas/SettingsView' } put: summary: Set email recipients per event and the preferred language operationId: putNotificationSettings requestBody: required: true content: application/json: schema: type: object properties: emailRecipients: type: object additionalProperties: { type: array, maxItems: 50, items: { type: string, format: email } } locale: { type: string, enum: [en, ar] } responses: '200': description: Saved content: application/json: schema: { $ref: '#/components/schemas/SettingsView' } '400': { description: Unknown event or invalid recipient } /v1/notification-settings/teams: put: summary: Configure the Teams channel (incoming webhook or Power Automate workflow URL; write-only) operationId: putTeams requestBody: required: true content: application/json: schema: type: object required: [url, events] properties: url: { type: string, format: uri } events: { type: array, items: { $ref: '#/components/schemas/EventType' } } responses: '200': description: Saved content: application/json: schema: { $ref: '#/components/schemas/SettingsView' } '400': { description: Not a Teams or workflow URL } delete: summary: Remove the Teams channel operationId: deleteTeams responses: '204': { description: Removed } /v1/notification-settings/webhooks: post: summary: Add a signed webhook endpoint; the signing secret is returned once operationId: addWebhook requestBody: required: true content: application/json: schema: type: object required: [url, events] properties: url: { type: string, format: uri, description: https on a public DNS name } events: { type: array, items: { $ref: '#/components/schemas/EventType' } } responses: '201': description: Created content: application/json: schema: type: object required: [id, host, events, secret] properties: id: { type: string, format: uuid } host: { type: string } events: { type: array, items: { $ref: '#/components/schemas/EventType' } } secret: { type: string, description: 'Shown once; verify Dexwize-Signature with it' } '400': { description: 'Invalid URL, unknown event or too many webhooks' } /v1/notification-settings/webhooks/{id}: delete: summary: Remove a webhook endpoint operationId: deleteWebhook parameters: - { name: id, in: path, required: true, schema: { type: string, format: uuid } } responses: '204': { description: Removed } '404': { description: Not found } /v1/notification-settings/test: post: summary: Send a test notification to the configured channels operationId: sendTest responses: '202': description: Accepted content: application/json: schema: { $ref: '#/components/schemas/AcceptResult' } /v1/notification-settings/smtp: get: summary: The caller's organisation's own email server (vendor, partner or customer); the password is never returned operationId: getSmtpSettings description: > Needs EmailSettingsManage (tenant admins, and partner admins for their partner's home tenant). effectiveSender says which server sends this tenant's email now: its own, the vendor default, or the platform. responses: '200': description: OK content: application/json: schema: { $ref: '#/components/schemas/SmtpView' } '403': { description: Missing EmailSettingsManage } put: summary: Save the organisation's email server and sender operationId: putSmtpSettings description: > TLS is always required (STARTTLS on 587 and 2525, implicit TLS on 465). The host must resolve only to public addresses unless the installation allows private relays. Temporary support (JIT) sessions are refused. requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/SmtpRequest' } responses: '200': description: Saved content: application/json: schema: { $ref: '#/components/schemas/SmtpView' } '400': { description: Invalid settings (validation problem under "smtp") } '403': { description: 'Missing EmailSettingsManage, or a JIT session' } delete: summary: Remove the organisation's email server (email falls back to the vendor default or the platform sender) operationId: deleteSmtpSettings responses: '204': { description: Removed } '403': { description: 'Missing EmailSettingsManage, or a JIT session' } '404': { description: Not configured } /v1/notification-settings/smtp/test: post: summary: Send one test email through the saved settings now and record the outcome (5 per 10 minutes) operationId: testSmtpSettings requestBody: required: true content: application/json: schema: type: object required: [to] properties: to: { type: string, format: email, maxLength: 254 } responses: '200': description: Tried; succeeded is false with the server's answer in error when sending failed content: application/json: schema: type: object required: [succeeded, settings] properties: succeeded: { type: boolean } error: { type: [string, 'null'], maxLength: 500 } settings: { $ref: '#/components/schemas/SmtpView' } '400': { description: 'Invalid address, or no settings saved' } '403': { description: 'Missing EmailSettingsManage, or a JIT session' } '429': { description: Too many tests; see Retry-After } components: securitySchemes: bearer: { type: http, scheme: bearer, bearerFormat: JWT } schemas: EventType: type: string enum: [report_ready, assessment_completed, recommendation_approval_requested, test_notification] SendRequest: type: object required: [tenantId, eventType, idempotencyKey] properties: tenantId: { type: string, format: uuid } eventType: { $ref: '#/components/schemas/EventType' } locale: { type: string, enum: [en, ar], description: Omit to use the tenant's preferred language } idempotencyKey: { type: string, minLength: 1, maxLength: 128 } data: type: object maxProperties: 16 propertyNames: { pattern: '^[a-z][a-z0-9_]{0,39}$' } additionalProperties: { type: string, maxLength: 500 } AcceptResult: type: object required: [notificationId, created, deliveries] properties: notificationId: { type: string, format: uuid } created: { type: boolean } deliveries: { type: integer } SettingsView: type: object required: [emailRecipients, teamsConfigured, teamsEvents, webhooks, locale] properties: emailRecipients: type: object additionalProperties: { type: array, items: { type: string } } teamsConfigured: { type: boolean } teamsEvents: { type: array, items: { $ref: '#/components/schemas/EventType' } } webhooks: type: array items: type: object required: [id, host, events] properties: id: { type: string, format: uuid } host: { type: string } events: { type: array, items: { $ref: '#/components/schemas/EventType' } } locale: { type: string, enum: [en, ar] } SmtpSecurity: type: string enum: [StartTls, Tls] description: StartTls on ports 587 and 2525, Tls (implicit) on 465. Unencrypted submission is not offered. SmtpRequest: type: object required: [host, fromAddress] properties: host: { type: string, maxLength: 253, description: 'Host name, for example smtp.office365.com (not an IP address)' } port: { type: integer, enum: [465, 587, 2525], default: 587 } security: { $ref: '#/components/schemas/SmtpSecurity' } username: { type: [string, 'null'], maxLength: 256 } password: type: [string, 'null'] maxLength: 512 description: Omit or null to keep the stored password; an empty string removes it. Never returned. fromAddress: { type: string, format: email, maxLength: 254 } fromName: { type: [string, 'null'], maxLength: 100 } enabled: { type: boolean, default: true } useForAllTenants: type: boolean default: false description: Vendor (platform tenant) only; its server then sends for every tenant without its own. SmtpView: type: object required: [configured, passwordSet, enabled, useForAllTenants, isPlatformTenant, effectiveSender] properties: configured: { type: boolean } host: { type: [string, 'null'] } port: { type: [integer, 'null'] } security: oneOf: - { $ref: '#/components/schemas/SmtpSecurity' } - { type: 'null' } username: { type: [string, 'null'] } passwordSet: { type: boolean } fromAddress: { type: [string, 'null'] } fromName: { type: [string, 'null'] } enabled: { type: boolean } useForAllTenants: { type: boolean } isPlatformTenant: { type: boolean } effectiveSender: type: string enum: [own, vendor, platform] description: Which server sends this tenant's email now. updatedAt: { type: [string, 'null'], format: date-time } updatedBy: { type: [string, 'null'] } lastTestedAt: { type: [string, 'null'], format: date-time } lastTestSucceeded: { type: [boolean, 'null'] } lastTestError: { type: [string, 'null'] }