openapi: 3.1.0 info: title: Dexwize Remediation Service version: 1.0.0 description: > Remediation requests, approvals, rollout and rollback (E10), and the device command queue. User endpoints take a bearer token; device endpoints take the enrollment-service device credential ("Authorization: Device "). Every command is signed (dexwize-command-v1, ADR-0022) and carries the content-signed action document unchanged. Cross-tenant requests return 404. paths: /v1/remediations: get: summary: List remediation requests, newest first (FindingsRead) operationId: listRemediations security: [{ bearer: [] }] parameters: - { name: status, in: query, schema: { type: string, enum: [PendingApproval, Active, Completed, SuggestionOnly, Rejected, Cancelled] }, description: 'Status name, case-insensitive' } - { name: recommendationId, in: query, schema: { type: string }, description: 'Only requests made for this recommendation' } - { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 500, default: 200 } } responses: '200': description: OK content: application/json: schema: type: array items: { $ref: '#/components/schemas/RemediationSummary' } '400': { description: Unknown status or limit out of range } '403': { description: Missing permission } post: summary: Request a remediation (RemediationExecute) operationId: createRemediation security: [{ bearer: [] }] requestBody: required: true content: application/json: schema: type: object required: [actionId, deviceIds] properties: actionId: { type: string } version: { type: integer } parameters: { type: object, additionalProperties: { type: string } } deviceIds: { type: array, items: { type: string, format: uuid } } recommendationId: { type: string, description: Links the before/after measurement in recommendation-service } windowStart: { type: string, format: date-time } windowEnd: { type: string, format: date-time } onBehalfOf: { type: string, maxLength: 256, description: 'Service callers only (remediation_requester), and required for them: the person the request is for. Audited, and that person cannot approve it.' } originRef: { type: string, maxLength: 256, description: 'Service callers only: where the request came from, for example workflow-run/{id}.' } responses: '201': { description: 'Created (PendingApproval, Active or SuggestionOnly)', content: { application/json: { schema: { $ref: '#/components/schemas/Remediation' } } } } '400': { description: Invalid parameters or window } '403': { description: 'Missing permission, or the tenant plan does not include remote_actions (ADR-0053): {"error":"feature_not_entitled","feature":"remote_actions"}', content: { application/json: { schema: { $ref: '#/components/schemas/FeatureRefusal' } } } } '404': { description: Unknown action or device (including another tenant's device) } '503': { description: 'Entitlements could not be confirmed and nothing usable is cached; remote_actions is refused (fail closed). Retry-After is set.', content: { application/json: { schema: { $ref: '#/components/schemas/FeatureRefusal' } } } } /v1/remediations/keys: get: summary: Public command-signing key(s), delivered to devices by enrollment-service (ADR-0022) operationId: listCommandKeys security: [{ bearer: [] }] responses: '200': description: Current public keys content: application/json: schema: type: array items: type: object required: [keyId, purpose, publicKey] properties: keyId: { type: string } purpose: { type: string, enum: [command] } publicKey: { type: string, contentEncoding: base64, description: 'Ed25519 public key, 32 bytes' } '401': { description: Not authenticated } /v1/remediations/{id}: get: operationId: getRemediation security: [{ bearer: [] }] parameters: [{ $ref: '#/components/parameters/Id' }] responses: '200': { description: OK, content: { application/json: { schema: { $ref: '#/components/schemas/Remediation' } } } } '404': { description: Not found } /v1/remediations/{id}/approve: post: summary: Approve (RecommendationsApprove); the requester can never approve their own request operationId: approveRemediation security: [{ bearer: [] }] parameters: [{ $ref: '#/components/parameters/Id' }] responses: '200': { description: Approved; commands issued for devices the policy allows now, content: { application/json: { schema: { $ref: '#/components/schemas/Remediation' } } } } '400': { description: Self-approval or wrong state } '404': { description: Not found } '403': { description: 'Missing permission, or the tenant plan does not include remote_actions (ADR-0053): {"error":"feature_not_entitled","feature":"remote_actions"}', content: { application/json: { schema: { $ref: '#/components/schemas/FeatureRefusal' } } } } '503': { description: 'Entitlements could not be confirmed and nothing usable is cached; remote_actions is refused (fail closed). Retry-After is set.', content: { application/json: { schema: { $ref: '#/components/schemas/FeatureRefusal' } } } } /v1/remediations/{id}/reject: post: operationId: rejectRemediation security: [{ bearer: [] }] parameters: [{ $ref: '#/components/parameters/Id' }] requestBody: { content: { application/json: { schema: { $ref: '#/components/schemas/Decision' } } } } responses: { '200': { description: Rejected, content: { application/json: { schema: { $ref: '#/components/schemas/Remediation' } } } }, '400': { description: Wrong state }, '404': { description: Not found } } /v1/remediations/{id}/cancel: post: operationId: cancelRemediation security: [{ bearer: [] }] parameters: [{ $ref: '#/components/parameters/Id' }] responses: { '200': { description: Cancelled; undelivered commands expire, content: { application/json: { schema: { $ref: '#/components/schemas/Remediation' } } } }, '400': { description: Wrong state }, '404': { description: Not found } } /v1/remediations/{id}/rollback: post: summary: Issue rollback commands for every device the request changed (within 7 days) operationId: rollbackRemediation security: [{ bearer: [] }] parameters: [{ $ref: '#/components/parameters/Id' }] requestBody: { content: { application/json: { schema: { $ref: '#/components/schemas/Decision' } } } } responses: { '200': { description: Rollback commands issued, content: { application/json: { schema: { $ref: '#/components/schemas/RollbackIssued' } } } }, '400': { description: Action cannot be rolled back automatically }, '404': { description: Not found } } /v1/remediations/{id}/handoff: get: summary: Intune or SCCM detection and remediation scripts for this request operationId: getHandoffPackage security: [{ bearer: [] }] parameters: [{ $ref: '#/components/parameters/Id' }] responses: { '200': { description: Package, content: { application/json: { schema: { $ref: '#/components/schemas/HandoffPackage' } } } }, '400': { description: Operation not available as a package }, '404': { description: Not found }, '403': { description: 'Missing permission, or the tenant plan does not include remote_actions (ADR-0053): {"error":"feature_not_entitled","feature":"remote_actions"}', content: { application/json: { schema: { $ref: '#/components/schemas/FeatureRefusal' } } } }, '503': { description: 'Entitlements could not be confirmed and nothing usable is cached; remote_actions is refused (fail closed). Retry-After is set.', content: { application/json: { schema: { $ref: '#/components/schemas/FeatureRefusal' } } } } } /v1/devices/self/commands: get: summary: Commands waiting for this device (device credential) operationId: pendingCommands security: [{ device: [] }] responses: '200': description: Pending commands; expired commands are closed, not delivered content: application/json: schema: type: object properties: commands: type: array items: type: object required: [command_id, action, command] properties: command_id: { type: string } action: { $ref: '#/components/schemas/SignedDocument' } command: { $ref: '#/components/schemas/SignedDocument' } '401': { description: Missing or invalid device credential } /v1/devices/self/commands/{commandId}/result: post: summary: Report the result of one command (device credential) operationId: reportResult security: [{ device: [] }] parameters: [{ name: commandId, in: path, required: true, schema: { type: string, format: uuid } }] requestBody: required: true content: application/json: schema: type: object required: [command_id, status, duration_ms] properties: command_id: { type: string } status: { type: string, enum: [succeeded, rolled_back, failed, rollback_failed, reverted, denied] } authorization: { type: [string, 'null'] } output: { type: [string, 'null'], maxLength: 4200 } error: { type: [string, 'null'] } duration_ms: { type: integer } responses: '202': { description: Recorded } '400': { description: 'Id mismatch, unknown status or already recorded' } '401': { description: Missing or invalid device credential } '404': { description: Not this device's command } components: securitySchemes: bearer: { type: http, scheme: bearer, bearerFormat: JWT } device: { type: apiKey, in: header, name: Authorization, description: "Device " } parameters: Id: { name: id, 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 } Decision: { type: object, properties: { reason: { type: string } } } RollbackIssued: { type: object, required: [rollback_commands], properties: { rollback_commands: { type: integer, description: Number of rollback commands issued } } } HandoffPackage: type: object description: Intune or SCCM package (detection and remediation scripts plus manifest) generated from a validated built-in operation additionalProperties: true SignedDocument: type: object required: [key_id, signature, document] properties: key_id: { type: string } signature: { type: string, contentEncoding: base64 } document: { type: string, contentEncoding: base64 } RemediationSummary: type: object required: [id, actionId, actionVersion, status, source, requestedBy, deviceCount, createdAt] properties: id: { type: string, format: uuid } actionId: { type: string } actionVersion: { type: integer } status: { type: string, enum: [PendingApproval, Active, Completed, SuggestionOnly, Rejected, Cancelled] } source: { type: string, enum: [Recommendation, SelfHealing, Manual] } sourceRef: { type: [string, 'null'], description: 'Recommendation id or self-healing rule id' } requestedBy: { type: string } onBehalfOf: { type: [string, 'null'], description: 'The person a service request was made for; they cannot approve it either' } approvedBy: { type: [string, 'null'] } deviceCount: { type: integer } createdAt: { type: string, format: date-time } Remediation: type: object properties: id: { type: string, format: uuid } actionId: { type: string } actionVersion: { type: integer } status: { type: string, enum: [PendingApproval, Active, Completed, SuggestionOnly, Rejected, Cancelled] } source: { type: string, enum: [Recommendation, SelfHealing, Manual] } sourceRef: { type: [string, 'null'] } requestedBy: { type: string } approvedBy: { type: [string, 'null'] } note: { type: [string, 'null'] } deviceIds: { type: array, items: { type: string, format: uuid } } commands: type: array items: type: object properties: id: { type: string, format: uuid } deviceId: { type: string, format: uuid } kind: { type: string, enum: [Execute, Rollback] } status: { type: string, enum: [Pending, Delivered, Succeeded, RolledBack, Failed, RollbackFailed, Reverted, Denied, Expired] } authorization: { type: string } rollbackOf: { type: [string, 'null'], format: uuid } issuedAt: { type: string, format: date-time } notAfter: { type: string, format: date-time } output: { type: [string, 'null'] } error: { type: [string, 'null'] } skipped: type: array description: > Devices the request sends nothing to until they change, recorded once and audited. Today only AgentTooOld: the device's agent predates the action's operation kind; it gets the command after it upgrades. items: type: object required: [deviceId, reason, recordedAt] properties: deviceId: { type: string, format: uuid } reason: { type: string, enum: [AgentTooOld] } detail: { type: [string, 'null'], description: 'For example "agent 0.1.0, needs 0.2.0"' } recordedAt: { type: string, format: date-time } agentVersion: type: [string, 'null'] description: AgentTooOld only. The agent version the device last reported; null when it never reported one requiredAgentVersion: type: [string, 'null'] description: AgentTooOld only. The minimum agent version for the action's operation kind