openapi: 3.1.0 info: title: Dexwize Scoring Service version: 1.0.0 description: > Digital Experience score (docs/scoring.md), baselines, anomalies, suggested thresholds, alerts, and hardware and network health views (E12). Tenant-scoped through the bearer token; unknown or other-tenant ids return 404. Group and fleet results never cover fewer than 5 devices. servers: - url: https://api.dexwize.example security: - bearer: [] paths: /v1/scoring/model: get: operationId: getScoringModel summary: The active score definition (weights, bounds, version) responses: '200': description: OK content: application/json: schema: { $ref: '#/components/schemas/ModelView' } '403': description: "Missing permission, or the tenant is not entitled to experience_score (error feature_not_entitled)" content: { application/json: { schema: { $ref: '#/components/schemas/EntitlementRefusal' } } } '503': { $ref: '#/components/responses/EntitlementsUnavailable' } /v1/scores/devices: get: operationId: listDeviceScores summary: Lowest-scoring devices first parameters: - { name: days, in: query, schema: { type: integer, minimum: 1, maximum: 90 } } - { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 1000 } } responses: '200': description: OK content: application/json: schema: type: object properties: truncated: { type: boolean } devices: type: array items: type: object properties: device_id: { type: string, format: uuid } score: { type: number } coverage: { type: number } top_factor: { type: [string, 'null'] } '403': description: "Missing permission, or the tenant is not entitled to experience_score (error feature_not_entitled)" content: { application/json: { schema: { $ref: '#/components/schemas/EntitlementRefusal' } } } '503': { $ref: '#/components/responses/EntitlementsUnavailable' } /v1/scores/devices/{id}: get: operationId: getDeviceScore parameters: - { $ref: '#/components/parameters/Id' } - { name: days, in: query, schema: { type: integer, minimum: 1, maximum: 90 } } responses: '200': description: Score with contributing factors and evidence content: application/json: schema: { $ref: '#/components/schemas/DeviceScore' } '404': { description: Unknown device or no data in the window } '403': description: "Missing permission, or the tenant is not entitled to experience_score (error feature_not_entitled)" content: { application/json: { schema: { $ref: '#/components/schemas/EntitlementRefusal' } } } '503': { $ref: '#/components/responses/EntitlementsUnavailable' } /v1/scores/groups: get: operationId: listGroupScores parameters: - { name: days, in: query, schema: { type: integer } } responses: '200': description: Groups of at least 5 devices; smaller groups merge into "(other)" content: application/json: schema: { type: array, items: { $ref: '#/components/schemas/GroupScore' } } '403': description: "Missing permission, or the tenant is not entitled to experience_score (error feature_not_entitled)" content: { application/json: { schema: { $ref: '#/components/schemas/EntitlementRefusal' } } } '503': { $ref: '#/components/responses/EntitlementsUnavailable' } /v1/scores/fleet: get: operationId: getFleetScore responses: '200': description: Fleet score, or suppressed when the tenant has fewer than 5 devices content: application/json: schema: oneOf: - { $ref: '#/components/schemas/GroupScore' } - type: object properties: suppressed: { type: boolean } reason: { type: string } '403': description: "Missing permission, or the tenant is not entitled to experience_score (error feature_not_entitled)" content: { application/json: { schema: { $ref: '#/components/schemas/EntitlementRefusal' } } } '503': { $ref: '#/components/responses/EntitlementsUnavailable' } /v1/baselines: get: operationId: listBaselines parameters: - { name: kind, in: query, schema: { type: string, enum: [fleet, model, os_version, device_group] } } - { name: metric, in: query, schema: { type: string } } - { name: days, in: query, schema: { type: integer } } responses: '200': description: OK content: application/json: schema: { type: array, items: { $ref: '#/components/schemas/Baseline' } } '400': { description: Unknown kind } /v1/anomalies: get: operationId: listAnomalies responses: '200': description: Device-day values far from their baseline in the worse direction content: application/json: schema: type: array items: type: object properties: deviceId: { type: string, format: uuid } metric: { type: string } day: { type: string, format: date } value: { type: number } baselineMedian: { type: number } robustZ: { type: number } kind: { type: integer } segment: { type: string } seasonal: { type: boolean } evidence: { type: array, items: { $ref: '#/components/schemas/EvidenceRow' } } /v1/thresholds/suggestions: get: operationId: suggestThresholds summary: Percentile-based threshold proposals (computed, not AI-chosen) parameters: - { name: kind, in: query, schema: { type: string } } - { name: metric, in: query, schema: { type: string } } responses: '200': description: OK content: application/json: schema: type: array items: type: object properties: metric: { type: string } segment: { type: string } level: { type: string, enum: [watch, warning, critical] } value: { type: number } samples: { type: integer } rationale: { type: string } /v1/health/{view}: get: operationId: getHealthView parameters: - { name: view, in: path, required: true, schema: { type: string, enum: [batteries, disks, thermal, network-sites] } } responses: '200': description: Evidence-linked health items, or network sites aggregated by device group content: application/json: schema: { type: array, items: { type: object, additionalProperties: true } } '404': { description: Unknown view } /v1/validation/sentiment: get: operationId: validateAgainstSentiment parameters: - { name: minPairs, in: query, schema: { type: integer, minimum: 4 } } - { name: targetRho, in: query, schema: { type: number, minimum: 0, maximum: 1 } } responses: '200': description: Spearman correlation of group scores with group survey sentiment content: application/json: schema: type: object properties: verdict: { type: integer, description: '0 insufficient data, 1 validated, 2 not validated' } pairs: { type: integer } rho: { type: [number, 'null'] } ciLow: { type: [number, 'null'] } ciHigh: { type: [number, 'null'] } '403': description: "Missing permission, or the tenant is not entitled to experience_score (error feature_not_entitled)" content: { application/json: { schema: { $ref: '#/components/schemas/EntitlementRefusal' } } } '503': { $ref: '#/components/responses/EntitlementsUnavailable' } /v1/internal/tenants/{tenantId}/xla-metrics: get: operationId: getXlaMetricsInternal summary: One tenant's aggregate XLA metrics for a period (partner-service only) description: > Platform-level service token with the service-only role xla_metrics_reader (partner-service, ADR-0014). Inclusive UTC days, at most 31, cut at the current time. Every metric is null when fewer than 5 devices reported. Crashes and hangs are application crash and hang events per 100 devices per week. Not routed through the gateway. parameters: - { name: tenantId, in: path, required: true, schema: { type: string, format: uuid } } - { name: from, in: query, required: true, schema: { type: string, format: date } } - { name: to, in: query, required: true, schema: { type: string, format: date } } responses: '200': description: Aggregates for the period content: application/json: schema: type: object required: [from, to, devices, truncated, modelVersion] properties: from: { type: string, format: date } to: { type: string, format: date } devices: { type: integer } experienceScore: { type: [number, 'null'] } bootTimeP50Seconds: { type: [number, 'null'] } crashesPer100DevicesPerWeek: { type: [number, 'null'] } hangsPer100DevicesPerWeek: { type: [number, 'null'] } truncated: { type: boolean } modelVersion: { type: string } '400': { description: 'Missing, reversed or too long period' } '403': { description: Not a platform-level service token with xla_metrics_reader } /v1/alert-rules: get: operationId: listAlertRules responses: '200': description: OK content: application/json: schema: { type: array, items: { $ref: '#/components/schemas/AlertRule' } } post: operationId: createAlertRule requestBody: required: true content: application/json: schema: type: object required: [name, metric, scope, condition, threshold, severity, cooldownMinutes] properties: name: { type: string, maxLength: 120 } metric: { type: string, description: A model metric id or dx_score } scope: { type: string, enum: [Device, Group, Fleet] } condition: { type: string, enum: [StaticThreshold, BaselineDeviation] } threshold: { type: number } severity: { type: string, enum: [Info, Warning, Critical] } cooldownMinutes: { type: integer, minimum: 5, maximum: 10080 } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/AlertRule' } '400': { description: Invalid rule } /v1/alert-rules/{id}/enabled: put: operationId: setAlertRuleEnabled parameters: [{ $ref: '#/components/parameters/Id' }] requestBody: required: true content: application/json: schema: { type: object, required: [enabled], properties: { enabled: { type: boolean } } } responses: '200': description: Updated content: application/json: schema: { $ref: '#/components/schemas/AlertRule' } '404': { description: Not found } /v1/alerts: get: operationId: listAlerts parameters: - { name: status, in: query, schema: { type: string, enum: [open, acknowledged, resolved, suppressed] } } responses: '200': description: OK content: application/json: schema: { type: array, items: { $ref: '#/components/schemas/Alert' } } /v1/alerts/evaluate: post: operationId: evaluateAlerts responses: '200': description: Transitions applied in this evaluation content: application/json: schema: type: array items: type: object properties: alert_id: { type: string, format: uuid } transition: { type: string, enum: [Opened, Reopened, Updated, Resolved, Suppressed] } notified: { type: boolean } /v1/alerts/{id}/acknowledge: post: operationId: acknowledgeAlert parameters: [{ $ref: '#/components/parameters/Id' }] responses: '200': description: OK content: application/json: schema: { $ref: '#/components/schemas/Alert' } '404': { description: Not found } '409': { description: Not in an acknowledgeable state } /v1/alerts/{id}/resolve: post: operationId: resolveAlert parameters: [{ $ref: '#/components/parameters/Id' }] responses: '200': description: OK content: application/json: schema: { $ref: '#/components/schemas/Alert' } '404': { description: Not found } '409': { description: Already resolved } components: responses: 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' } } } securitySchemes: bearer: { type: http, scheme: bearer, bearerFormat: JWT } parameters: Id: { name: id, in: path, required: true, schema: { type: string, format: uuid } } 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 campaigns } EvidenceRow: type: object properties: table: { type: string } deviceId: { type: string, format: uuid } batchId: { type: string, format: uuid } recordIndex: { type: integer } ts: { type: string, format: date-time } CategoryScore: type: object properties: category: { type: string } score: { type: number } effectiveWeight: { type: number } DeviceScore: type: object properties: deviceId: { type: string, format: uuid } score: { type: [number, 'null'] } coverage: { type: number } categories: { type: array, items: { $ref: '#/components/schemas/CategoryScore' } } missingCategories: { type: array, items: { type: string } } factors: type: array items: type: object properties: metric: { type: string } category: { type: string } value: { type: number } unit: { type: string } normalized: { type: number } effectiveWeight: { type: number } pointsLost: { type: number } evidence: { type: array, items: { $ref: '#/components/schemas/EvidenceRow' } } modelVersion: { type: string } GroupScore: type: object properties: group: { type: string } devices: { type: integer, minimum: 5 } score: { type: [number, 'null'] } categories: { type: array, items: { $ref: '#/components/schemas/CategoryScore' } } sentiment: { type: [number, 'null'] } modelVersion: { type: string } Baseline: type: object properties: metric: { type: string } kind: { type: integer } segment: { type: string } samples: { type: integer } median: { type: number } sigma: { type: number } p90: { type: number } p95: { type: number } p99: { type: number } ModelView: type: object properties: version: { type: string } group_min_devices: { type: integer } categories: { type: array, items: { type: object, additionalProperties: true } } AlertRule: type: object properties: id: { type: string, format: uuid } name: { type: string } metric: { type: string } scope: { type: integer } condition: { type: integer } threshold: { type: number } severity: { type: integer } enabled: { type: boolean } cooldown: { type: string } Alert: type: object properties: id: { type: string, format: uuid } ruleId: { type: string, format: uuid } target: { type: string } severity: { type: string } status: { type: string } openedAt: { type: string, format: date-time } lastSeenAt: { type: string, format: date-time } resolvedAt: { type: [string, 'null'], format: date-time } lastValue: { type: number } detail: { type: string } evidence: { type: array, items: { $ref: '#/components/schemas/EvidenceRow' } }