{"openapi":"3.1.0","info":{"title":"Anomalies — DayZero API","version":"1.0.0","description":"AI-powered anomaly detection for unusual transactions and patterns."},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/anomalies":{"get":{"tags":["anomalies"],"summary":"List transaction anomalies","description":"Return the latest pre-computed anomaly scan for the current business. Results are written by background jobs (daily cron & post-sync). Dismissed anomalies are excluded by default.","operationId":"list_anomalies","parameters":[{"name":"severity","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by severity: low, medium, high","title":"Severity"},"description":"Filter by severity: low, medium, high"},{"name":"anomaly_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by anomaly type (e.g. duplicate_payment, unusual_amount)","title":"Anomaly Type"},"description":"Filter by anomaly type (e.g. duplicate_payment, unusual_amount)"},{"name":"show_dismissed","in":"query","required":false,"schema":{"type":"boolean","description":"Include previously dismissed anomalies","default":false,"title":"Show Dismissed"},"description":"Include previously dismissed anomalies"},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"description":"Optional inclusive lower bound for anomaly date window (YYYY-MM-DD).","title":"Start Date"},"description":"Optional inclusive lower bound for anomaly date window (YYYY-MM-DD)."},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"description":"Optional inclusive upper bound for anomaly date window (YYYY-MM-DD).","title":"End Date"},"description":"Optional inclusive upper bound for anomaly date window (YYYY-MM-DD)."},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_ListAnomaliesResponse_"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"list_anomalies_api_v1_anomalies_get"}},"/api/v1/anomalies/{fingerprint}":{"get":{"tags":["anomalies"],"summary":"Get anomaly finding detail","description":"Return the hydrated detail for a single anomaly fingerprint, including the recommended_action payload and the evidence rows shown in the side-by-side panel on the AnomaliesPage.","operationId":"get_anomaly_detail","parameters":[{"name":"fingerprint","in":"path","required":true,"schema":{"type":"string","title":"Fingerprint"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_GetAnomalyDetailResponse_"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"get_anomaly_detail_api_v1_anomalies__fingerprint__get"}},"/api/v1/anomalies/{fingerprint}/resolve":{"post":{"tags":["anomalies"],"summary":"Execute a recommended action and dismiss the anomaly","description":"Run the `recommended_action` attached to the finding (e.g. void duplicate payments, merge duplicate vendors) and record a `resolved` dismissal in the same call. For void actions the endpoint records the user's intent and stages the dismissal; the actual journal-entry mutation must be confirmed on the transaction itself to keep posting side-effects observable to the audit log.","operationId":"resolve_anomaly","parameters":[{"name":"fingerprint","in":"path","required":true,"schema":{"type":"string","title":"Fingerprint"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ResolveRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_ResolveAnomalyResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"resolve_anomaly_api_v1_anomalies__fingerprint__resolve_post"}},"/api/v1/anomalies/dismiss":{"post":{"tags":["anomalies"],"summary":"Dismiss an anomaly","description":"Mark a detected anomaly as dismissed with a reason and optional notes.","operationId":"dismiss_anomaly","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__v1__schemas__anomaly__DismissRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_DismissAnomalyResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"dismiss_anomaly_api_v1_anomalies_dismiss_post"}},"/api/v1/anomalies/restore":{"post":{"tags":["anomalies"],"summary":"Restore a dismissed anomaly","description":"Remove a dismissal so the anomaly appears in active results again.","operationId":"restore_anomaly","parameters":[{"name":"fingerprint","in":"query","required":true,"schema":{"type":"string","description":"Fingerprint of the anomaly to restore","title":"Fingerprint"},"description":"Fingerprint of the anomaly to restore"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_RestoreAnomalyResponse_"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"restore_anomaly_api_v1_anomalies_restore_post"}},"/api/v1/anomalies/dismiss-type":{"post":{"tags":["anomalies"],"summary":"Bulk dismiss all anomalies of a given type","description":"Dismiss every active anomaly matching the specified type in one operation.","operationId":"bulk_dismiss_type","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkDismissRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_BulkDismissTypeResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"bulk_dismiss_type_api_v1_anomalies_dismiss_type_post"}},"/api/v1/anomalies/dismiss-all":{"post":{"tags":["anomalies"],"summary":"Bulk dismiss all active anomalies","description":"Dismiss every active anomaly in the latest scan for the current business. Used by the notifications inbox when clearing the anomaly topic in bulk.","operationId":"bulk_dismiss_all","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkDismissAllRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_BulkDismissAllResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"bulk_dismiss_all_api_v1_anomalies_dismiss_all_post"}},"/api/v1/anomalies/dismiss-by-period":{"post":{"tags":["anomalies"],"summary":"Bulk dismiss anomalies in a date range","description":"Dismiss every active anomaly whose date metadata overlaps the given period. Used by the close checklist's 'Dismiss all anomalies' CTA for historical periods that were reviewed offline.","operationId":"bulk_dismiss_by_period","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkDismissByPeriodRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_BulkDismissByPeriodResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"bulk_dismiss_by_period_api_v1_anomalies_dismiss_by_period_post"}},"/api/v1/anomalies/rescan":{"post":{"tags":["anomalies"],"summary":"Trigger an on-demand anomaly rescan","description":"Start a Temporal workflow that re-runs the anomaly detection engine for the current business and refreshes the cached scan results. Returns immediately; clients should refetch `GET /anomalies` shortly afterwards. Rate-limited to one rescan per business every 5 minutes.","operationId":"rescan_anomalies","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_RescanAnomaliesResponse_"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too Many Requests - Rate limit exceeded; back off and retry","content":{"application/json":{"example":{"error":"rate_limited","message":"Too many requests. Please slow down.","code":"GEN_005","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"rescan_anomalies_api_v1_anomalies_rescan_post"}}},"components":{"schemas":{"AnomalyDismissalState":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"dismissed_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dismissed By"},"dismissed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dismissed At"}},"additionalProperties":true,"type":"object","title":"AnomalyDismissalState"},"AnomalyFindingItem":{"properties":{"anomaly_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Anomaly Type"},"severity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Severity"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"transaction_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Transaction Ids"},"entity_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Entity Ids"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"},"fingerprint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fingerprint"},"recommended_action":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Recommended Action"},"evidence":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Evidence"},"dismissed":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Dismissed"},"dismissal":{"anyOf":[{"$ref":"#/components/schemas/AnomalyDismissalState"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"AnomalyFindingItem"},"AnomalyResolutionDismissal":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"fingerprint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fingerprint"},"anomaly_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Anomaly Type"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"additionalProperties":true,"type":"object","title":"AnomalyResolutionDismissal"},"AnomalySummary":{"properties":{"count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Count"},"by_type":{"anyOf":[{"additionalProperties":{"type":"integer"},"type":"object"},{"type":"null"}],"title":"By Type"},"by_severity":{"anyOf":[{"additionalProperties":{"type":"integer"},"type":"object"},{"type":"null"}],"title":"By Severity"},"dismissed_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Dismissed Count"}},"additionalProperties":true,"type":"object","title":"AnomalySummary"},"BulkDismissAllRequest":{"properties":{"reason":{"type":"string","title":"Reason","description":"One of: expected, resolved, false_positive, other"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes","description":"Optional user-provided notes"}},"type":"object","required":["reason"],"title":"BulkDismissAllRequest"},"BulkDismissAllResponse":{"properties":{"dismissed_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Dismissed Count"}},"additionalProperties":true,"type":"object","title":"BulkDismissAllResponse","description":"Response for ``bulk_dismiss_all``."},"BulkDismissByPeriodRequest":{"properties":{"start_date":{"type":"string","format":"date","title":"Start Date","description":"Inclusive lower bound for anomaly date window (YYYY-MM-DD)."},"end_date":{"type":"string","format":"date","title":"End Date","description":"Inclusive upper bound for anomaly date window (YYYY-MM-DD)."},"reason":{"type":"string","title":"Reason","description":"One of: expected, resolved, false_positive, other"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes","description":"Optional user-provided notes"}},"type":"object","required":["start_date","end_date","reason"],"title":"BulkDismissByPeriodRequest"},"BulkDismissByPeriodResponse":{"properties":{"dismissed_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Dismissed Count"}},"additionalProperties":true,"type":"object","title":"BulkDismissByPeriodResponse","description":"Response for ``bulk_dismiss_by_period``."},"BulkDismissRequest":{"properties":{"anomaly_type":{"type":"string","title":"Anomaly Type","description":"Dismiss all active anomalies of this type"},"reason":{"type":"string","title":"Reason","description":"One of: expected, resolved, false_positive, other"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes","description":"Optional user-provided notes"}},"type":"object","required":["anomaly_type","reason"],"title":"BulkDismissRequest"},"BulkDismissTypeResponse":{"properties":{"dismissed_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Dismissed Count"}},"additionalProperties":true,"type":"object","title":"BulkDismissTypeResponse","description":"Response for ``bulk_dismiss_type``."},"DismissAnomalyResponse":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"fingerprint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fingerprint"},"anomaly_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Anomaly Type"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"}},"additionalProperties":true,"type":"object","title":"DismissAnomalyResponse","description":"Response for ``dismiss_anomaly``."},"GetAnomalyDetailResponse":{"properties":{"anomaly_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Anomaly Type"},"severity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Severity"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"transaction_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Transaction Ids"},"entity_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Entity Ids"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"},"fingerprint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fingerprint"},"recommended_action":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Recommended Action"},"evidence":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Evidence"},"dismissed":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Dismissed"},"dismissal":{"anyOf":[{"$ref":"#/components/schemas/AnomalyDismissalState"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"GetAnomalyDetailResponse","description":"Response for ``get_anomaly_detail``."},"ListAnomaliesResponse":{"properties":{"anomalies":{"anyOf":[{"items":{"$ref":"#/components/schemas/AnomalyFindingItem"},"type":"array"},{"type":"null"}],"title":"Anomalies"},"summary":{"anyOf":[{"$ref":"#/components/schemas/AnomalySummary"},{"type":"null"}]},"lookback_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Lookback Days"},"last_scanned":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Scanned"}},"additionalProperties":true,"type":"object","title":"ListAnomaliesResponse","description":"Response for ``list_anomalies``."},"RescanAnomaliesResponse":{"properties":{"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"workflow_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workflow Id"},"business_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Id"}},"additionalProperties":true,"type":"object","title":"RescanAnomaliesResponse","description":"Response for ``rescan_anomalies``."},"ResolveAnomalyResponse":{"properties":{"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"action":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Action"},"merge_summary":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Merge Summary"},"dismissal":{"anyOf":[{"$ref":"#/components/schemas/AnomalyResolutionDismissal"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"ResolveAnomalyResponse","description":"Response for ``resolve_anomaly``."},"ResolveRequest":{"properties":{"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes","description":"Optional notes captured alongside the resolution."},"keep_vendor_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Keep Vendor Id","description":"For merge_vendors: override the surviving ('keep') vendor. Defaults to the finding's recommended keep vendor."}},"type":"object","title":"ResolveRequest"},"RestoreAnomalyResponse":{"properties":{"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},"additionalProperties":true,"type":"object","title":"RestoreAnomalyResponse","description":"Response for ``restore_anomaly``."},"SuccessEnvelope_BulkDismissAllResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/BulkDismissAllResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[BulkDismissAllResponse]"},"SuccessEnvelope_BulkDismissByPeriodResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/BulkDismissByPeriodResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[BulkDismissByPeriodResponse]"},"SuccessEnvelope_BulkDismissTypeResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/BulkDismissTypeResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[BulkDismissTypeResponse]"},"SuccessEnvelope_DismissAnomalyResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/DismissAnomalyResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[DismissAnomalyResponse]"},"SuccessEnvelope_GetAnomalyDetailResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/GetAnomalyDetailResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GetAnomalyDetailResponse]"},"SuccessEnvelope_ListAnomaliesResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/ListAnomaliesResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[ListAnomaliesResponse]"},"SuccessEnvelope_RescanAnomaliesResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/RescanAnomaliesResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[RescanAnomaliesResponse]"},"SuccessEnvelope_ResolveAnomalyResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/ResolveAnomalyResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[ResolveAnomalyResponse]"},"SuccessEnvelope_RestoreAnomalyResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/RestoreAnomalyResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[RestoreAnomalyResponse]"},"app__api__v1__schemas__anomaly__DismissRequest":{"properties":{"fingerprint":{"type":"string","title":"Fingerprint","description":"SHA-256 fingerprint of the anomaly"},"anomaly_type":{"type":"string","title":"Anomaly Type","description":"Type key, e.g. duplicate_payment"},"reason":{"type":"string","title":"Reason","description":"One of: expected, resolved, false_positive, other"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Snapshot of the anomaly description"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes","description":"Optional user-provided notes"}},"type":"object","required":["fingerprint","anomaly_type","reason"],"title":"DismissRequest"},"ErrorResponse":{"title":"ErrorResponse","type":"object","description":"Envelope returned by every non-2xx response. Branch on `code` (stable) rather than `message` (human-readable, may change).","required":["error","message","code"],"properties":{"error":{"type":"string","description":"Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`."},"message":{"type":"string","description":"Human-readable explanation, safe to show to end users."},"code":{"type":"string","description":"Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`)."},"request_id":{"type":"string","description":"Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied."},"errors":{"type":"object","additionalProperties":{"type":"string"},"description":"Field-level validation messages keyed by field name. Present on 400/422 validation failures only."}}}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}