{"openapi":"3.1.0","info":{"title":"CFO Portal — DayZero API","version":"1.0.0","description":"CFO Portal endpoints."},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/businesses/{business_id}/cfo-portal/unit-economics":{"get":{"tags":["cfo-portal"],"summary":"Get CFO unit economics","operationId":"cfo_portal_get_unit_economics","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_unit_economics_api_v1_businesses__business_id__cfo_portal_unit_economics_get"}},"/api/v1/businesses/{business_id}/cfo-portal/configuration":{"get":{"tags":["cfo-portal"],"summary":"Get CFO configuration","operationId":"cfo_portal_get_configuration","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_configuration_api_v1_businesses__business_id__cfo_portal_configuration_get"}},"/api/v1/businesses/{business_id}/cfo-portal/monthly-close":{"get":{"tags":["cfo-portal"],"summary":"Get CFO monthly close status","operationId":"cfo_portal_get_monthly_close","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_monthly_close_api_v1_businesses__business_id__cfo_portal_monthly_close_get"}},"/api/v1/businesses/{business_id}/cfo-portal/ar-aging":{"get":{"tags":["cfo-portal"],"summary":"Get CFO AR aging","operationId":"cfo_portal_get_ar_aging","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_ar_aging_api_v1_businesses__business_id__cfo_portal_ar_aging_get"}},"/api/v1/businesses/{business_id}/cfo-portal/ap-aging":{"get":{"tags":["cfo-portal"],"summary":"Get CFO AP aging","operationId":"cfo_portal_get_ap_aging","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_ap_aging_api_v1_businesses__business_id__cfo_portal_ap_aging_get"}},"/api/v1/businesses/{business_id}/cfo-portal/landed-cogs":{"get":{"tags":["cfo-portal"],"summary":"Get CFO landed COGS","operationId":"cfo_portal_get_landed_cogs","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_landed_cogs_api_v1_businesses__business_id__cfo_portal_landed_cogs_get"}},"/api/v1/businesses/{business_id}/cfo-portal/shipping-analysis":{"get":{"tags":["cfo-portal"],"summary":"Get CFO shipping analysis","operationId":"cfo_portal_get_shipping_analysis","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_shipping_analysis_api_v1_businesses__business_id__cfo_portal_shipping_analysis_get"}},"/api/v1/businesses/{business_id}/cfo-portal/shopify":{"get":{"tags":["cfo-portal"],"summary":"Get CFO Shopify metrics","operationId":"cfo_portal_get_shopify","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_shopify_api_v1_businesses__business_id__cfo_portal_shopify_get"}},"/api/v1/businesses/{business_id}/cfo-portal/reports-documents":{"get":{"tags":["cfo-portal"],"summary":"Get CFO reports and documents","operationId":"cfo_portal_get_reports_documents","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_reports_documents_api_v1_businesses__business_id__cfo_portal_reports_documents_get"}},"/api/v1/businesses/{business_id}/cfo-portal/debt-schedule":{"get":{"tags":["cfo-portal"],"summary":"Get CFO debt schedule","operationId":"cfo_portal_get_debt_schedule","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_debt_schedule_api_v1_businesses__business_id__cfo_portal_debt_schedule_get"}},"/api/v1/businesses/{business_id}/cfo-portal/alerts":{"get":{"tags":["cfo-portal"],"summary":"Get CFO financial alerts","operationId":"cfo_portal_get_alerts","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_alerts_api_v1_businesses__business_id__cfo_portal_alerts_get"}},"/api/v1/businesses/{business_id}/cfo-portal/valuation":{"get":{"tags":["cfo-portal"],"summary":"Get CFO valuation inputs","operationId":"cfo_portal_get_valuation","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_valuation_api_v1_businesses__business_id__cfo_portal_valuation_get"}},"/api/v1/businesses/{business_id}/cfo-portal/benchmarks":{"get":{"tags":["cfo-portal"],"summary":"Get CFO benchmarks","operationId":"cfo_portal_get_benchmarks","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_benchmarks_api_v1_businesses__business_id__cfo_portal_benchmarks_get"}},"/api/v1/businesses/{business_id}/cfo-portal/recipe-book":{"get":{"tags":["cfo-portal"],"summary":"Get CFO recipe book","operationId":"cfo_portal_get_recipe_book","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_recipe_book_api_v1_businesses__business_id__cfo_portal_recipe_book_get"}},"/api/v1/businesses/{business_id}/cfo-portal/managerial-pl":{"get":{"tags":["cfo-portal"],"summary":"Get CFO managerial P&L","operationId":"cfo_portal_get_managerial_pl","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start Date"}},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"End Date"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_managerial_pl_api_v1_businesses__business_id__cfo_portal_managerial_pl_get"}},"/api/v1/businesses/{business_id}/cfo-portal/managerial-bs":{"get":{"tags":["cfo-portal"],"summary":"Get CFO managerial balance sheet","operationId":"cfo_portal_get_managerial_bs","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start Date"}},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"End Date"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_managerial_bs_api_v1_businesses__business_id__cfo_portal_managerial_bs_get"}},"/api/v1/businesses/{business_id}/cfo-portal/statements":{"get":{"tags":["cfo-portal"],"summary":"Get CFO statement bundle","operationId":"cfo_portal_get_statements","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start Date"}},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"End Date"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_statements_api_v1_businesses__business_id__cfo_portal_statements_get"}},"/api/v1/businesses/{business_id}/cfo-portal/flux":{"get":{"tags":["cfo-portal"],"summary":"Get CFO flux analysis","operationId":"cfo_portal_get_flux","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start Date"}},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"End Date"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_flux_api_v1_businesses__business_id__cfo_portal_flux_get"}},"/api/v1/businesses/{business_id}/cfo-portal/board-deck":{"get":{"tags":["cfo-portal"],"summary":"Get CFO board deck summary","operationId":"cfo_portal_get_board_deck","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start Date"}},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"End Date"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_board_deck_api_v1_businesses__business_id__cfo_portal_board_deck_get"}},"/api/v1/businesses/{business_id}/cfo-portal/summary":{"get":{"tags":["cfo-portal"],"summary":"Get CFO portal summary","operationId":"cfo_portal_get_summary","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"include_series","in":"query","required":false,"schema":{"type":"boolean","description":"When true, include the 13-week trailing P&L series in ``data.pulse.weekly_series`` and run the heavier DB fan-out.","default":false,"title":"Include Series"},"description":"When true, include the 13-week trailing P&L series in ``data.pulse.weekly_series`` and run the heavier DB fan-out."},{"name":"include_weekly_pl","in":"query","required":false,"schema":{"type":"boolean","description":"When true, include the 4-week P&L table rows in ``data.weekly_pl_rows``.","default":true,"title":"Include Weekly Pl"},"description":"When true, include the 4-week P&L table rows in ``data.weekly_pl_rows``."},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_summary_api_v1_businesses__business_id__cfo_portal_summary_get"}},"/api/v1/businesses/{business_id}/cfo-portal/purchase-orders":{"get":{"tags":["cfo-portal"],"summary":"Get CFO purchase order pipeline","operationId":"get_purchase_orders_handler","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"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_CfoPortalSectionResponse_"}}}},"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_purchase_orders_handler_api_v1_businesses__business_id__cfo_portal_purchase_orders_get"}},"/api/v1/businesses/{business_id}/cfo-portal/cash-forecast":{"get":{"tags":["cfo-portal"],"summary":"Get CFO 13-week cash forecast","description":"Get the cash forecast section with optional budget selection.","operationId":"cfo_portal_get_cash_forecast","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"budget_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Budget Id"}},{"name":"apply_overrides","in":"query","required":false,"schema":{"type":"boolean","description":"When true, the working override scope is folded into the computed cell values. Used by the Demand Planner tab. The live Cash Flow Forecast tab leaves this off so unsaved what-if values don't bleed across views.","default":false,"title":"Apply Overrides"},"description":"When true, the working override scope is folded into the computed cell values. Used by the Demand Planner tab. The live Cash Flow Forecast tab leaves this off so unsaved what-if values don't bleed across views."},{"name":"include_projected_replenishment","in":"query","required":false,"schema":{"type":"boolean","description":"When true, projected (not-yet-placed) replenishment POs from the SKU demand-forecast engine are added to a separate Projected Inventory row so operators see the cash impact of reorders they'll need to make. Off by default to keep the live Forecast tab byte-identical.","default":false,"title":"Include Projected Replenishment"},"description":"When true, projected (not-yet-placed) replenishment POs from the SKU demand-forecast engine are added to a separate Projected Inventory row so operators see the cash impact of reorders they'll need to make. Off by default to keep the live Forecast tab byte-identical."},{"name":"include_unapproved_ap","in":"query","required":false,"schema":{"type":"boolean","description":"When true, pending_approval and forecasted bills (not raised from a PO) are added as their own 'AP – awaiting approval' row by due date. Draft bills never count.","default":false,"title":"Include Unapproved Ap"},"description":"When true, pending_approval and forecasted bills (not raised from a PO) are added as their own 'AP – awaiting approval' row by due date. Draft bills never count."},{"name":"net_bills_against_budget","in":"query","required":false,"schema":{"type":"boolean","description":"When true, open bills coded to a budgeted expense ledger and due in the window are taken off that ledger's budget projection (floor 0), so a contractor budget line and the contractors' bills are not both counted.","default":false,"title":"Net Bills Against Budget"},"description":"When true, open bills coded to a budgeted expense ledger and due in the window are taken off that ledger's budget projection (floor 0), so a contractor budget line and the contractors' bills are not both counted."},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_cash_forecast_api_v1_businesses__business_id__cfo_portal_cash_forecast_get"}},"/api/v1/businesses/{business_id}/cfo-portal/vendor-spend":{"get":{"tags":["cfo-portal"],"summary":"Get CFO vendor spend","description":"Get vendor spend with optional date range, grouping mode, and source filters.","operationId":"cfo_portal_get_vendor_spend","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start Date"}},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"End Date"}},{"name":"group_by","in":"query","required":false,"schema":{"type":"string","default":"counterparty","title":"Group By"}},{"name":"sources","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"Sources"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_vendor_spend_api_v1_businesses__business_id__cfo_portal_vendor_spend_get"}},"/api/v1/businesses/{business_id}/cfo-portal/unit-economics/settings":{"put":{"tags":["cfo-portal"],"summary":"Update Unit Economics configuration","description":"Save Unit Economics settings (Shopify vs manual AOV override).","operationId":"cfo_portal_update_unit_economics_settings","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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/UnitEconomicsSettingsUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_update_unit_economics_settings_api_v1_businesses__business_id__cfo_portal_unit_economics_settings_put"}},"/api/v1/businesses/{business_id}/cfo-portal/cash-forecast/settings":{"put":{"tags":["cfo-portal"],"summary":"Update Cash Forecast configuration","description":"Save Cash Forecast settings (excluded budget ledgers).","operationId":"cfo_portal_update_cash_forecast_settings","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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/CashForecastSettingsUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_update_cash_forecast_settings_api_v1_businesses__business_id__cfo_portal_cash_forecast_settings_put"}},"/api/v1/businesses/{business_id}/cfo-portal/po-forecast-settings":{"get":{"tags":["cfo-portal"],"summary":"List open POs and which forecast column they flow through","description":"List every open PO with its forecast attribution.\n\n**Returns:** ``POForecastSettingsResponse`` — each row identifies\nwhether the PO flows through ``inventory`` (no linked bill yet) or\n``ap_out`` (a ``Bill`` exists with ``source_inventory_order_id``\npointing at this PO), plus the amount and date the forecast uses.\n\n**Why it matters:** Operators auditing the forecast can pinpoint\nwhy a given dollar shows up in AP Out vs. Inventory Payments without\nhaving to cross-reference the bills and PO tables manually.","operationId":"cfo_portal_po_forecast_settings","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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_POForecastSettingsResponse_"}}}},"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":"cfo_portal_po_forecast_settings_api_v1_businesses__business_id__cfo_portal_po_forecast_settings_get"}},"/api/v1/businesses/{business_id}/cfo-portal/cash-forecast/timing":{"get":{"tags":["cfo-portal"],"summary":"List fixed-cost timing rows (lag and pay days per ledger)","description":"List the budget ledgers that pay on a schedule instead of prorated.\n\nA ledger with no row is spread across each month's weeks by overlap\ndays; a ledger with a row pays its month's budget evenly on its pay\ndays, ``lag_months`` after the month it accrues in.","operationId":"cash_forecast_list_ledger_timing","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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_CashForecastLedgerTimingList_"}}}},"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":"cash_forecast_list_ledger_timing_api_v1_businesses__business_id__cfo_portal_cash_forecast_timing_get"},"put":{"tags":["cfo-portal"],"summary":"Set fixed-cost timing rows (lag and pay days per ledger)","description":"Insert or update one timing row per ledger.\n\n**Request Body:** ``rows`` of ``{ledger_id, lag_months 0-12, pay_days}``\nwhere ``pay_days`` lists 1 to 4 distinct days of 1-31 (15 and 31 =\nsemi-monthly; 31 means month end). An invalid row refuses the whole\nrequest with VALIDATION_705; a ledger of another business with\nVALIDATION_706.","operationId":"cash_forecast_upsert_ledger_timing","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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/CashForecastLedgerTimingUpsert"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CashForecastLedgerTimingList_"}}}},"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":"cash_forecast_upsert_ledger_timing_api_v1_businesses__business_id__cfo_portal_cash_forecast_timing_put"}},"/api/v1/businesses/{business_id}/cfo-portal/cash-forecast/one-time-items":{"get":{"tags":["cfo-portal"],"summary":"List one-time payment items applied to the cash forecast","description":"List all one-time payment items for this business.","operationId":"cfo_portal_list_one_time_items","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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_CashForecastOneTimeItemList_"}}}},"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":"cfo_portal_list_one_time_items_api_v1_businesses__business_id__cfo_portal_cash_forecast_one_time_items_get"},"post":{"tags":["cfo-portal"],"summary":"Create a one-time payment item","description":"Create a one-time payment item for the cash forecast.\n\n**Request Body:**\n- ``label``: Short description (e.g. \"Q2 estimated tax\").\n- ``amount_cents``: Positive = cash in, negative = cash out.\n- ``applies_on``: ISO date the cash event lands on.\n- ``notes``: Optional free-form notes.\n\n**Effect:** The item appears in the forecast week whose Sunday\nwindow contains ``applies_on``. The forecast's ``one_time_cents``\ncolumn on that week is incremented by ``amount_cents``.","operationId":"cfo_portal_create_one_time_item","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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/CashForecastOneTimeItemCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CashForecastOneTimeItem_"}}}},"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":"cfo_portal_create_one_time_item_api_v1_businesses__business_id__cfo_portal_cash_forecast_one_time_items_post"}},"/api/v1/businesses/{business_id}/cfo-portal/cash-forecast/one-time-items/{item_id}":{"patch":{"tags":["cfo-portal"],"summary":"Update a one-time payment item","description":"Partially update a one-time payment item.\n\nAny field omitted from the body is left unchanged.","operationId":"cfo_portal_update_one_time_item","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","title":"Item Id"}},{"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/CashForecastOneTimeItemUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CashForecastOneTimeItem_"}}}},"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":"cfo_portal_update_one_time_item_api_v1_businesses__business_id__cfo_portal_cash_forecast_one_time_items__item_id__patch"},"delete":{"tags":["cfo-portal"],"summary":"Delete a one-time payment item","description":"Delete a one-time payment item.","operationId":"cfo_portal_delete_one_time_item","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","title":"Item Id"}},{"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/app__core__success__MessageResponse"}}}},"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":"cfo_portal_delete_one_time_item_api_v1_businesses__business_id__cfo_portal_cash_forecast_one_time_items__item_id__delete"}},"/api/v1/businesses/{business_id}/cfo-portal/cash-forecast/versions":{"get":{"tags":["cfo-portal"],"summary":"List saved cash forecast versions","description":"List saved versions for this business (summary view, no snapshot).\n\n``overrides_captured`` is false for versions saved before cell\noverrides were stored with the version.","operationId":"cfo_portal_list_versions","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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_CashForecastVersionList_"}}}},"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":"cfo_portal_list_versions_api_v1_businesses__business_id__cfo_portal_cash_forecast_versions_get"},"post":{"tags":["cfo-portal"],"summary":"Save the current cash forecast configuration as a named version","description":"Snapshot the current cash forecast configuration + output.\n\nThe version captures the chosen budget, excluded ledgers, embedded\none-time items, cell overrides and forecast switches, along with the\nfull computed forecast JSON. The snapshot is what stays stable as\nlive data drifts; the config is what's replayed on load.\n\n**Request Body:** ``config.overrides`` omitted or null saves the\nworking override set (the Reorder Cash Planner); ``[]`` saves none\n(the live Cash Flow Forecast tab, which ignores overrides). Duplicate\ncells or ``weeks`` outside 1-52 are refused with 400.","operationId":"cfo_portal_create_version","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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/CashForecastVersionCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CashForecastVersionDetail_"}}}},"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":"cfo_portal_create_version_api_v1_businesses__business_id__cfo_portal_cash_forecast_versions_post"}},"/api/v1/businesses/{business_id}/cfo-portal/cash-forecast/versions/{version_id}":{"get":{"tags":["cfo-portal"],"summary":"Get a saved cash forecast version","description":"Get full detail for a saved version, including config + snapshot.","operationId":"cfo_portal_get_version","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"version_id","in":"path","required":true,"schema":{"type":"string","title":"Version Id"}},{"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_CashForecastVersionDetail_"}}}},"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":"cfo_portal_get_version_api_v1_businesses__business_id__cfo_portal_cash_forecast_versions__version_id__get"},"patch":{"tags":["cfo-portal"],"summary":"Rename or describe a saved version","description":"Update a saved version's name or description.\n\nConfiguration and snapshot fields are immutable — save a new\nversion to capture a new scenario.","operationId":"cfo_portal_update_version","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"version_id","in":"path","required":true,"schema":{"type":"string","title":"Version Id"}},{"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/CashForecastVersionUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CashForecastVersionDetail_"}}}},"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":"cfo_portal_update_version_api_v1_businesses__business_id__cfo_portal_cash_forecast_versions__version_id__patch"},"delete":{"tags":["cfo-portal"],"summary":"Delete a saved cash forecast version","description":"Delete a saved version and any overrides pinned to it.","operationId":"cfo_portal_delete_version","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"version_id","in":"path","required":true,"schema":{"type":"string","title":"Version Id"}},{"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/app__core__success__MessageResponse"}}}},"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":"cfo_portal_delete_version_api_v1_businesses__business_id__cfo_portal_cash_forecast_versions__version_id__delete"}},"/api/v1/businesses/{business_id}/cfo-portal/cash-forecast/versions/{version_id}/apply":{"post":{"tags":["cfo-portal"],"summary":"Re-apply a saved version's config to the live forecast","description":"Load a saved version into the user's working scope.\n\nPushes the version's budget exclusion list to business settings\nand replaces the working override set with the version's overrides\nso the forecast recomputes against the saved configuration. A\nversion saved before overrides were captured leaves the working\noverrides untouched and answers ``overrides_restored: false``. The\ncaller should invalidate the cash-forecast query and use\n``budget_id`` and the forecast switches from the response to sync\nlocal state.","operationId":"cfo_portal_apply_version","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"version_id","in":"path","required":true,"schema":{"type":"string","title":"Version Id"}},{"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_CashForecastVersionApplyResponse_"}}}},"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":"cfo_portal_apply_version_api_v1_businesses__business_id__cfo_portal_cash_forecast_versions__version_id__apply_post"}},"/api/v1/businesses/{business_id}/cfo-portal/cash-forecast/overrides":{"get":{"tags":["cfo-portal"],"summary":"List cell-level overrides for the cash forecast","description":"List overrides for either the working set or a saved version.\n\n**Query Parameters:**\n- ``version_id``: Optional. Defaults to the user's working set\n  (``version_id IS NULL``).","operationId":"cfo_portal_list_overrides","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"version_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Saved version id to scope overrides to. Omit for the user's working override set.","title":"Version Id"},"description":"Saved version id to scope overrides to. Omit for the user's working override set."},{"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_CashForecastOverrideList_"}}}},"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":"cfo_portal_list_overrides_api_v1_businesses__business_id__cfo_portal_cash_forecast_overrides_get"},"put":{"tags":["cfo-portal"],"summary":"Replace all cash forecast overrides in a scope","description":"Atomically replace every override row in the matching scope.\n\n**Request Body:**\n- ``version_id``: Optional. If null, replaces the working override\n  set; otherwise replaces overrides pinned to that saved version.\n- ``overrides``: List of cells to override (week_number / column /\n  amount_cents).\n\n- ``merge``: Optional, default false. True sets only the cells sent\n  and keeps the scope's other overrides; the response lists the\n  scope's full set.\n\n**Effect:** Without ``merge``, all existing overrides in the scope\nare deleted, then the provided rows are inserted. Use the empty list\nto clear the scope without deleting the URL.","operationId":"cfo_portal_upsert_overrides","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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/CashForecastOverridesUpsert"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CashForecastOverrideList_"}}}},"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":"cfo_portal_upsert_overrides_api_v1_businesses__business_id__cfo_portal_cash_forecast_overrides_put"},"delete":{"tags":["cfo-portal"],"summary":"Clear all cash forecast overrides in a scope","description":"Clear every override in the matching scope (working set or version).","operationId":"cfo_portal_clear_overrides","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"version_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version Id"}},{"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/app__core__success__MessageResponse"}}}},"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":"cfo_portal_clear_overrides_api_v1_businesses__business_id__cfo_portal_cash_forecast_overrides_delete"}},"/api/v1/businesses/{business_id}/cfo-portal/cash-forecast/overrides/{override_id}":{"delete":{"tags":["cfo-portal"],"summary":"Delete a single cash forecast override row","description":"Delete a single override row by id.","operationId":"cfo_portal_delete_override","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"override_id","in":"path","required":true,"schema":{"type":"string","title":"Override Id"}},{"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/app__core__success__MessageResponse"}}}},"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":"cfo_portal_delete_override_api_v1_businesses__business_id__cfo_portal_cash_forecast_overrides__override_id__delete"}},"/api/v1/businesses/{business_id}/cfo-portal/cash-forecast/demand-plan":{"post":{"tags":["cfo-portal"],"summary":"Evaluate a what-if cash forecast scenario","description":"Run the canonical forecast twice (clean baseline + scenario) and\nreturn the per-week ending-cash delta.\n\nRead-only: ``overrides`` and ``inline_one_time_items`` apply only\nto the scenario pass and are never persisted. Persisting a\nscenario is a separate call to ``PUT /cash-forecast/overrides``.","operationId":"cfo_portal_evaluate_demand_plan","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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/DemandPlanScenarioRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_DemandPlanScenarioResponse_"}}}},"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":"cfo_portal_evaluate_demand_plan_api_v1_businesses__business_id__cfo_portal_cash_forecast_demand_plan_post"}},"/api/v1/businesses/{business_id}/cfo-portal/budget-vs-actual":{"get":{"tags":["cfo-portal"],"summary":"Get CFO budget vs actual","description":"Get the budget-vs-actual section with optional budget/date filters.","operationId":"cfo_portal_get_budget_vs_actual","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"budget_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Budget Id"}},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start Date"}},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"End Date"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_get_budget_vs_actual_api_v1_businesses__business_id__cfo_portal_budget_vs_actual_get"}},"/api/v1/businesses/{business_id}/cfo-portal/debt-schedule/parse-contract":{"post":{"tags":["cfo-portal"],"summary":"Parse debt contract into a draft payment schedule","description":"Parse an uploaded lending contract into structured terms and schedule.\n\n**Request Body:**\n- `s3_key`: S3 key of an uploaded contract document (required).\n\n**Returns:** A draft :class:`ParsedDebtContract` and projected payout table.\nFixed-term loans return up to 12 months of amortization; revenue-based\nfinancing returns a single \"until cap\" row instead of fabricated rows.","operationId":"cfo_portal_parse_debt_contract","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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/DebtContractParseRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_ParseDebtContractResponse_"}}}},"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":"cfo_portal_parse_debt_contract_api_v1_businesses__business_id__cfo_portal_debt_schedule_parse_contract_post"}},"/api/v1/businesses/{business_id}/cfo-portal/debt-schedule/approve-contract":{"post":{"tags":["cfo-portal"],"summary":"Approve parsed debt contract and create debt instrument","description":"Create a debt instrument from approved parsed contract terms.\n\n**Request Body:**\n- `contract`: ParsedDebtContract from the parse endpoint (required).\n- `contract_s3_key`: S3 key of the original PDF (optional, persisted\n  on the debt instrument for later retrieval).\n\n**Returns:** The new debt instrument's ``id``, ``name``, and ``lender``.","operationId":"cfo_portal_approve_debt_contract","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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/DebtContractApproveRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_DebtContractApproveResponse_"}}}},"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":"cfo_portal_approve_debt_contract_api_v1_businesses__business_id__cfo_portal_debt_schedule_approve_contract_post"}},"/api/v1/businesses/{business_id}/cfo-portal/debt-schedule/instruments/{instrument_id}/payments":{"post":{"tags":["cfo-portal"],"summary":"Record a payment against a debt instrument","description":"Record a payment on a loan, posting a balanced principal/interest entry.\n\n**Request Body:**\n- `payment_amount_cents`: total payment, split into principal + interest.\n- `cash_ledger_id`: bank/cash account the money moves through.\n- `payment_date`: optional, defaults to today.\n- `memo`: optional journal-entry memo.\n- `transaction_id`: optional — when supplied, rebook the transaction's\n  existing journal entry into the principal/interest split and link the\n  subledger row to that transaction.\n\nThe principal and interest accounts are resolved by direction:\ndebt we owe pays down Long-Term Debt with Interest Expense; a note\nreceivable collects against Notes Receivable with Interest Income.\nDecrements the instrument's outstanding balance by the principal\nportion.","operationId":"cfo_portal_record_debt_payment","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"instrument_id","in":"path","required":true,"schema":{"type":"string","title":"Instrument Id"}},{"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/DebtPaymentRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_DebtPaymentResponse_"}}}},"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":"cfo_portal_record_debt_payment_api_v1_businesses__business_id__cfo_portal_debt_schedule_instruments__instrument_id__payments_post"}},"/api/v1/businesses/{business_id}/cfo-portal/debt-schedule/instruments/{instrument_id}":{"patch":{"tags":["cfo-portal"],"summary":"Update a debt instrument","description":"Update editable fields on an existing debt instrument.\n\n**Request Body:** Any of ``name``, ``current_balance_cents``, ``notes``,\n``amount_repaid_cents``, ``revenue_share_bps``, ``total_repayment_cap_cents``.\n\n**Returns:** The updated instrument snapshot.","operationId":"cfo_portal_update_debt_instrument","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"instrument_id","in":"path","required":true,"schema":{"type":"string","title":"Instrument Id"}},{"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/DebtInstrumentUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_DebtInstrumentUpdateResponse_"}}}},"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":"cfo_portal_update_debt_instrument_api_v1_businesses__business_id__cfo_portal_debt_schedule_instruments__instrument_id__patch"},"delete":{"tags":["cfo-portal"],"summary":"Soft-delete a debt instrument","description":"Remove a debt instrument from the schedule (soft delete).","operationId":"cfo_portal_delete_debt_instrument","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"instrument_id","in":"path","required":true,"schema":{"type":"string","title":"Instrument Id"}},{"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/app__core__success__MessageResponse"}}}},"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":"cfo_portal_delete_debt_instrument_api_v1_businesses__business_id__cfo_portal_debt_schedule_instruments__instrument_id__delete"}},"/api/v1/businesses/{business_id}/cfo-portal/debt-schedule/instruments/{instrument_id}/payment-schedule":{"get":{"tags":["cfo-portal"],"summary":"Get a loan's customizable paydown table","description":"Return the persisted, editable paydown schedule for a loan.","operationId":"cfo_portal_get_debt_schedule_table","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"instrument_id","in":"path","required":true,"schema":{"type":"string","title":"Instrument Id"}},{"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_DebtScheduleResponse_"}}}},"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":"cfo_portal_get_debt_schedule_table_api_v1_businesses__business_id__cfo_portal_debt_schedule_instruments__instrument_id__payment_schedule_get"}},"/api/v1/businesses/{business_id}/cfo-portal/debt-schedule/instruments/{instrument_id}/payment-schedule/generate":{"post":{"tags":["cfo-portal"],"summary":"Generate or rebuild a loan's paydown table","description":"(Re)generate a loan's paydown table from its terms.\n\n**Request Body:**\n- `overwrite_custom`: when true, discard hand-edited rows and rebuild\n  the whole table; when false, preserve customized rows.","operationId":"cfo_portal_generate_debt_schedule","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"instrument_id","in":"path","required":true,"schema":{"type":"string","title":"Instrument Id"}},{"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/DebtScheduleGenerateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_DebtScheduleResponse_"}}}},"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":"cfo_portal_generate_debt_schedule_api_v1_businesses__business_id__cfo_portal_debt_schedule_instruments__instrument_id__payment_schedule_generate_post"}},"/api/v1/businesses/{business_id}/cfo-portal/debt-schedule/instruments/{instrument_id}/payment-schedule/rows":{"post":{"tags":["cfo-portal"],"summary":"Add a row to a loan's paydown table","description":"Add a user-defined payment row to a loan's paydown table.","operationId":"cfo_portal_add_debt_schedule_row","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"instrument_id","in":"path","required":true,"schema":{"type":"string","title":"Instrument Id"}},{"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/DebtScheduleRowCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_DebtScheduleResponse_"}}}},"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":"cfo_portal_add_debt_schedule_row_api_v1_businesses__business_id__cfo_portal_debt_schedule_instruments__instrument_id__payment_schedule_rows_post"}},"/api/v1/businesses/{business_id}/cfo-portal/debt-schedule/payment-schedule/rows/{row_id}":{"patch":{"tags":["cfo-portal"],"summary":"Edit a loan paydown-table row","description":"Edit a single paydown-table row (date, principal, interest, status).","operationId":"cfo_portal_update_debt_schedule_row","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"row_id","in":"path","required":true,"schema":{"type":"string","title":"Row Id"}},{"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/DebtScheduleRowUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_DebtScheduleResponse_"}}}},"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":"cfo_portal_update_debt_schedule_row_api_v1_businesses__business_id__cfo_portal_debt_schedule_payment_schedule_rows__row_id__patch"},"delete":{"tags":["cfo-portal"],"summary":"Delete a loan paydown-table row","description":"Remove a row from a loan's paydown table.","operationId":"cfo_portal_delete_debt_schedule_row","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"row_id","in":"path","required":true,"schema":{"type":"string","title":"Row Id"}},{"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_DebtScheduleResponse_"}}}},"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":"cfo_portal_delete_debt_schedule_row_api_v1_businesses__business_id__cfo_portal_debt_schedule_payment_schedule_rows__row_id__delete"}},"/api/v1/businesses/{business_id}/cfo-portal/debt-schedule/instruments/{instrument_id}/covenants":{"get":{"tags":["cfo-portal"],"summary":"List covenants for a debt instrument","description":"List financial covenants attached to a debt instrument.","operationId":"cfo_portal_list_debt_covenants","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"instrument_id","in":"path","required":true,"schema":{"type":"string","title":"Instrument Id"}},{"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_list_DebtCovenantResponse__"}}}},"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":"cfo_portal_list_debt_covenants_api_v1_businesses__business_id__cfo_portal_debt_schedule_instruments__instrument_id__covenants_get"},"post":{"tags":["cfo-portal"],"summary":"Add a covenant to a debt instrument","description":"Attach a financial covenant to a loan.","operationId":"cfo_portal_create_debt_covenant","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"instrument_id","in":"path","required":true,"schema":{"type":"string","title":"Instrument Id"}},{"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/DebtCovenantCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_DebtCovenantResponse_"}}}},"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":"cfo_portal_create_debt_covenant_api_v1_businesses__business_id__cfo_portal_debt_schedule_instruments__instrument_id__covenants_post"}},"/api/v1/businesses/{business_id}/cfo-portal/debt-schedule/covenants/{covenant_id}":{"delete":{"tags":["cfo-portal"],"summary":"Delete a debt covenant","description":"Remove a covenant rule from a debt instrument.","operationId":"cfo_portal_delete_debt_covenant","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"covenant_id","in":"path","required":true,"schema":{"type":"string","title":"Covenant Id"}},{"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/app__core__success__MessageResponse"}}}},"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":"cfo_portal_delete_debt_covenant_api_v1_businesses__business_id__cfo_portal_debt_schedule_covenants__covenant_id__delete"}},"/api/v1/businesses/{business_id}/cfo-portal/recipe-book/managerial-mappings":{"put":{"tags":["cfo-portal"],"summary":"Upsert managerial bucket assignments for GL accounts","description":"Save bucket assignments edited on the Recipe Book page.\n\nThe response is the refreshed Recipe Book section so the frontend\ncan swap state in one round-trip without a follow-up GET.","operationId":"cfo_portal_upsert_managerial_mappings","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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/ManagerialMappingUpsertRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_upsert_managerial_mappings_api_v1_businesses__business_id__cfo_portal_recipe_book_managerial_mappings_put"}},"/api/v1/businesses/{business_id}/cfo-portal/recipe-book/managerial-builders":{"put":{"tags":["cfo-portal"],"summary":"Upsert managerial builder line account selections","description":"Save account selections for CM1/CM2 and cash-outflow builder lines.","operationId":"cfo_portal_upsert_managerial_builders","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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/ManagerialBuildersUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_upsert_managerial_builders_api_v1_businesses__business_id__cfo_portal_recipe_book_managerial_builders_put"}},"/api/v1/businesses/{business_id}/cfo-portal/recipe-book/auto-assign":{"post":{"tags":["cfo-portal"],"summary":"AI auto-assign ledgers to managerial buckets","description":"AI auto-assign ledgers to managerial buckets based on account names.","operationId":"cfo_portal_auto_assign_ledgers","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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_CfoPortalSectionResponse_"}}}},"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":"cfo_portal_auto_assign_ledgers_api_v1_businesses__business_id__cfo_portal_recipe_book_auto_assign_post"}},"/api/v1/businesses/{business_id}/cfo-portal/board-deck/memo":{"post":{"tags":["cfo-portal"],"summary":"Generate an AI board memo/report from CFO board-deck data","description":"Generate a board-ready memo using the latest board-deck metrics.","operationId":"cfo_portal_generate_board_memo","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start Date"}},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"End Date"}},{"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_CfoPortalBoardMemoResponse_"}}}},"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":"cfo_portal_generate_board_memo_api_v1_businesses__business_id__cfo_portal_board_deck_memo_post"}},"/api/v1/businesses/{business_id}/cfo-portal/board-deck/pdf":{"get":{"tags":["cfo-portal"],"summary":"Download board deck summary as PDF","description":"Build and download the board deck summary PDF on demand.","operationId":"cfo_portal_download_board_deck_pdf","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start Date"}},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"End Date"}},{"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":{}}}},"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":"cfo_portal_download_board_deck_pdf_api_v1_businesses__business_id__cfo_portal_board_deck_pdf_get"}},"/api/v1/businesses/{business_id}/cfo-portal/board-deck/memo/export":{"post":{"tags":["cfo-portal"],"summary":"Export AI board memo as PDF or HTML","description":"Export the current AI board memo in a user-selected format.","operationId":"cfo_portal_export_board_memo","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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/CfoPortalBoardMemoExportRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"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":"cfo_portal_export_board_memo_api_v1_businesses__business_id__cfo_portal_board_deck_memo_export_post"}},"/api/v1/businesses/{business_id}/cfo-portal/ask":{"post":{"tags":["cfo-portal"],"summary":"Ask Regent a question from the CFO portal","operationId":"cfo_portal_ask","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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/CfoPortalAskRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CfoPortalAskResponse_"}}}},"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":"cfo_portal_ask_api_v1_businesses__business_id__cfo_portal_ask_post"}},"/api/v1/businesses/{business_id}/cfo-portal/buckets":{"get":{"tags":["cfo-portal"],"summary":"List all managerial buckets (default + custom)","description":"Return all managerial buckets available for this business.\n\nThe response includes both the built-in default buckets and any\ncustom buckets defined by this business. Default buckets have\n``is_default: true`` rows are built-in buckets with fixed keys; use\nPUT ``.../buckets/{bucket_key}`` to customize ``label`` and ``color``.","operationId":"cfo_portal_list_buckets","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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_CustomBucketsListResponse_"}}}},"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":"cfo_portal_list_buckets_api_v1_businesses__business_id__cfo_portal_buckets_get"},"post":{"tags":["cfo-portal"],"summary":"Create a custom managerial bucket","description":"Create a new custom managerial bucket for categorizing GL accounts.\n\nThe bucket key must be unique and cannot conflict with default\nbucket keys. Use lowercase letters, numbers, and underscores only.","operationId":"cfo_portal_create_bucket","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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/CustomBucketCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CustomBucketResponse_"}}}},"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":"cfo_portal_create_bucket_api_v1_businesses__business_id__cfo_portal_buckets_post"}},"/api/v1/businesses/{business_id}/cfo-portal/buckets/{bucket_key}":{"put":{"tags":["cfo-portal"],"summary":"Update a managerial bucket","description":"Update a managerial bucket.\n\nBuilt-in buckets accept ``label`` and ``color`` only (display\noverrides). Custom buckets accept any field included in the body.","operationId":"cfo_portal_update_bucket","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"bucket_key","in":"path","required":true,"schema":{"type":"string","title":"Bucket Key"}},{"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/CustomBucketUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CustomBucketResponse_"}}}},"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":"cfo_portal_update_bucket_api_v1_businesses__business_id__cfo_portal_buckets__bucket_key__put"},"delete":{"tags":["cfo-portal"],"summary":"Delete or disable a managerial bucket","description":"Delete or disable a managerial bucket.\n\nThis also clears any GL account mappings that reference the\ndeleted bucket. Some built-in buckets are locked and cannot\nbe deleted.","operationId":"cfo_portal_delete_bucket","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"bucket_key","in":"path","required":true,"schema":{"type":"string","title":"Bucket Key"}},{"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/app__core__success__MessageResponse"}}}},"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":"cfo_portal_delete_bucket_api_v1_businesses__business_id__cfo_portal_buckets__bucket_key__delete"}},"/api/v1/businesses/flux/narrative-packet":{"get":{"tags":["cfo-portal"],"summary":"Get CFO narrative flux close packet with subledger drill-through","description":"Build a live narrative flux close packet with subledger drill-through and optional PII redaction.","operationId":"get_cfo_narrative_flux_packet","parameters":[{"name":"period_end","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Period End"}},{"name":"materiality_bps","in":"query","required":false,"schema":{"type":"integer","maximum":10000,"minimum":0,"default":200,"title":"Materiality Bps"}},{"name":"redact_pii","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Redact Pii"}},{"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_NarrativeFluxPacketResponse_"}}}},"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_cfo_narrative_flux_packet_api_v1_businesses_flux_narrative_packet_get"}},"/api/v1/businesses/{business_id}/cfo-portal/flux/narrative-packet":{"get":{"tags":["cfo-portal"],"summary":"Get CFO narrative flux close packet for a business","description":"Build a live narrative flux close packet for ``business_id``.","operationId":"cfo_portal_get_narrative_flux_packet","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"period_end","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Period End"}},{"name":"materiality_bps","in":"query","required":false,"schema":{"type":"integer","maximum":10000,"minimum":0,"default":200,"title":"Materiality Bps"}},{"name":"redact_pii","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Redact Pii"}},{"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_NarrativeFluxPacketResponse_"}}}},"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":"cfo_portal_get_narrative_flux_packet_api_v1_businesses__business_id__cfo_portal_flux_narrative_packet_get"}},"/api/v1/businesses/flux/time-travel-audit":{"get":{"tags":["cfo-portal"],"summary":"Run 60-Second Time-Travel Audit across historical feeds, subledgers, and GL","description":"Scan historical transactions, bills, commerce clearing, and MCA drains in one pass.","operationId":"get_cfo_time_travel_audit","parameters":[{"name":"lookback_days","in":"query","required":false,"schema":{"type":"integer","maximum":730,"minimum":30,"default":365,"title":"Lookback Days"}},{"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_TimeTravelAuditResponse_"}}}},"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_cfo_time_travel_audit_api_v1_businesses_flux_time_travel_audit_get"}},"/api/v1/businesses/{business_id}/cfo-portal/flux/time-travel-audit":{"get":{"tags":["cfo-portal"],"summary":"Run 60-Second Time-Travel Audit for a business","description":"Scan historical transactions, bills, commerce clearing, and MCA drains for ``business_id``.","operationId":"cfo_portal_get_time_travel_audit","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"lookback_days","in":"query","required":false,"schema":{"type":"integer","maximum":730,"minimum":30,"default":365,"title":"Lookback Days"}},{"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_TimeTravelAuditResponse_"}}}},"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":"cfo_portal_get_time_travel_audit_api_v1_businesses__business_id__cfo_portal_flux_time_travel_audit_get"}},"/api/v1/businesses/flux/lineage":{"get":{"tags":["cfo-portal"],"summary":"Get 4-stage money-flow provenance lineage for a GL account","description":"Trace a GL account line back through journal entries, clearing, and source feeds.","operationId":"get_cfo_money_flow_lineage","parameters":[{"name":"ledger_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ledger Id"}},{"name":"account_name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Name"}},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start Date"}},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"End Date"}},{"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_MoneyFlowLineageResponse_"}}}},"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_cfo_money_flow_lineage_api_v1_businesses_flux_lineage_get"}},"/api/v1/businesses/{business_id}/cfo-portal/flux/lineage":{"get":{"tags":["cfo-portal"],"summary":"Get 4-stage money-flow provenance lineage for a business GL account","description":"Trace a GL account line back through journal entries, clearing, and source feeds for ``business_id``.","operationId":"cfo_portal_get_money_flow_lineage","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"ledger_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ledger Id"}},{"name":"account_name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Name"}},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start Date"}},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"End Date"}},{"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_MoneyFlowLineageResponse_"}}}},"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":"cfo_portal_get_money_flow_lineage_api_v1_businesses__business_id__cfo_portal_flux_lineage_get"}}},"components":{"schemas":{"BudgetCalculationItem":{"properties":{"ledger_id":{"type":"string","title":"Ledger Id"},"ledger_name":{"type":"string","title":"Ledger Name"},"amount_cents":{"type":"integer","title":"Amount Cents"}},"type":"object","required":["ledger_id","ledger_name","amount_cents"],"title":"BudgetCalculationItem","description":"A single ledger's contribution to a week's budgeted total."},"BudgetCalculationWeekBreakdown":{"properties":{"revenue_items":{"items":{"$ref":"#/components/schemas/BudgetCalculationItem"},"type":"array","title":"Revenue Items"},"expense_items":{"items":{"$ref":"#/components/schemas/BudgetCalculationItem"},"type":"array","title":"Expense Items"}},"type":"object","title":"BudgetCalculationWeekBreakdown","description":"Breakdown of budget calculations for a single week."},"CashForecastLedgerTiming":{"properties":{"ledger_id":{"type":"string","title":"Ledger Id"},"lag_months":{"type":"integer","title":"Lag Months","description":"Months between accrual and payment (0 = same month).","default":1},"pay_days":{"items":{"type":"integer"},"type":"array","title":"Pay Days","description":"One to four days of the month (1-31; 31 = month end). The month's amount splits evenly across them."},"id":{"type":"string","title":"Id"},"ledger_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ledger Name"},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At"}},"type":"object","required":["ledger_id","id"],"title":"CashForecastLedgerTiming"},"CashForecastLedgerTimingList":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CashForecastLedgerTiming"},"type":"array","title":"Items"}},"type":"object","title":"CashForecastLedgerTimingList"},"CashForecastLedgerTimingRow":{"properties":{"ledger_id":{"type":"string","title":"Ledger Id"},"lag_months":{"type":"integer","title":"Lag Months","description":"Months between accrual and payment (0 = same month).","default":1},"pay_days":{"items":{"type":"integer"},"type":"array","title":"Pay Days","description":"One to four days of the month (1-31; 31 = month end). The month's amount splits evenly across them."}},"type":"object","required":["ledger_id"],"title":"CashForecastLedgerTimingRow","description":"When one budgeted ledger pays: a lag in months and its pay days."},"CashForecastLedgerTimingUpsert":{"properties":{"rows":{"items":{"$ref":"#/components/schemas/CashForecastLedgerTimingRow"},"type":"array","title":"Rows"}},"type":"object","title":"CashForecastLedgerTimingUpsert"},"CashForecastOneTimeItem":{"properties":{"label":{"type":"string","maxLength":200,"minLength":1,"title":"Label"},"amount_cents":{"type":"integer","title":"Amount Cents","description":"Positive = cash in, negative = cash out. Integer cents."},"applies_on":{"type":"string","format":"date","title":"Applies On","description":"Date the cash event lands. The week index is derived from this date relative to the forecast's first Sunday."},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes"},"id":{"type":"string","title":"Id"},"business_id":{"type":"string","title":"Business Id"},"created_by_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By User Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["label","amount_cents","applies_on","id","business_id","created_at","updated_at"],"title":"CashForecastOneTimeItem"},"CashForecastOneTimeItemBase":{"properties":{"label":{"type":"string","maxLength":200,"minLength":1,"title":"Label"},"amount_cents":{"type":"integer","title":"Amount Cents","description":"Positive = cash in, negative = cash out. Integer cents."},"applies_on":{"type":"string","format":"date","title":"Applies On","description":"Date the cash event lands. The week index is derived from this date relative to the forecast's first Sunday."},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes"}},"type":"object","required":["label","amount_cents","applies_on"],"title":"CashForecastOneTimeItemBase","description":"Shared fields for one-time payment items."},"CashForecastOneTimeItemCreate":{"properties":{"label":{"type":"string","maxLength":200,"minLength":1,"title":"Label"},"amount_cents":{"type":"integer","title":"Amount Cents","description":"Positive = cash in, negative = cash out. Integer cents."},"applies_on":{"type":"string","format":"date","title":"Applies On","description":"Date the cash event lands. The week index is derived from this date relative to the forecast's first Sunday."},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes"}},"type":"object","required":["label","amount_cents","applies_on"],"title":"CashForecastOneTimeItemCreate"},"CashForecastOneTimeItemList":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CashForecastOneTimeItem"},"type":"array","title":"Items"}},"type":"object","title":"CashForecastOneTimeItemList"},"CashForecastOneTimeItemUpdate":{"properties":{"label":{"anyOf":[{"type":"string","maxLength":200,"minLength":1},{"type":"null"}],"title":"Label"},"amount_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Amount Cents"},"applies_on":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Applies On"},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes"}},"type":"object","title":"CashForecastOneTimeItemUpdate","description":"Partial-update payload for an existing one-time item."},"CashForecastOverride":{"properties":{"id":{"type":"string","title":"Id"},"business_id":{"type":"string","title":"Business Id"},"version_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version Id"},"week_number":{"type":"integer","title":"Week Number"},"column":{"type":"string","enum":["ar_in","ap_out","inventory","debt","debt_in","budget_rev","budget_exp","one_time"],"title":"Column"},"override_amount_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Override Amount Cents"},"source":{"type":"string","enum":["user","ai"],"title":"Source","default":"user"},"ai_scenario_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ai Scenario Label"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","business_id","week_number","column","created_at","updated_at"],"title":"CashForecastOverride","description":"Stored override row."},"CashForecastOverrideInput":{"properties":{"week_number":{"type":"integer","maximum":104.0,"minimum":0.0,"title":"Week Number"},"column":{"type":"string","enum":["ar_in","ap_out","inventory","debt","debt_in","budget_rev","budget_exp","one_time"],"title":"Column"},"amount_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Amount Cents"},"source":{"type":"string","enum":["user","ai"],"title":"Source","default":"user"},"ai_scenario_label":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Ai Scenario Label"},"note":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Note"}},"type":"object","required":["week_number","column"],"title":"CashForecastOverrideInput","description":"One cell-level override applied to a forecast week.\n\n``week_number = 0`` targets the Overdue row, ``1..weeks`` targets a\nweekly cell. ``column`` matches the forecast column names\n(``ar_in``, ``ap_out``, ``inventory``, ``debt``, ``debt_in``,\n``budget_rev``, ``budget_exp``, ``one_time``). ``amount_cents`` is treated as the\nliteral value to use; ``None`` means \"force this cell to zero\"."},"CashForecastOverrideList":{"properties":{"version_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version Id"},"items":{"items":{"$ref":"#/components/schemas/CashForecastOverride"},"type":"array","title":"Items"}},"type":"object","title":"CashForecastOverrideList"},"CashForecastOverridesUpsert":{"properties":{"version_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version Id"},"overrides":{"items":{"$ref":"#/components/schemas/CashForecastOverrideInput"},"type":"array","title":"Overrides"},"merge":{"type":"boolean","title":"Merge","description":"False (default) replaces every override in the scope. True sets only the cells sent and keeps the scope's other overrides (applying a Scenario Lab result to the plan).","default":false}},"type":"object","title":"CashForecastOverridesUpsert","description":"Bulk upsert for the user's working override set.\n\nThe service replaces all overrides for the matching\n``(business_id, version_id)`` scope with the rows provided here, so\nthe frontend can save the entire override map in one round-trip."},"CashForecastSettingsUpdateRequest":{"properties":{"excluded_budget_ledger_ids":{"items":{"type":"string"},"type":"array","title":"Excluded Budget Ledger Ids","description":"List of ledger IDs to exclude from budget projections"}},"type":"object","title":"CashForecastSettingsUpdateRequest","description":"Request payload for updating cash forecast configuration."},"CashForecastVersionApplyResponse":{"properties":{"version_id":{"type":"string","title":"Version Id"},"budget_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Budget Id"},"excluded_budget_ledger_ids":{"items":{"type":"string"},"type":"array","title":"Excluded Budget Ledger Ids"},"applied_override_count":{"type":"integer","title":"Applied Override Count"},"overrides_restored":{"type":"boolean","title":"Overrides Restored","description":"False when the version predates override capture: the working overrides were left unchanged instead of being cleared.","default":true},"include_projected_replenishment":{"type":"boolean","title":"Include Projected Replenishment","default":false},"include_unapproved_ap":{"type":"boolean","title":"Include Unapproved Ap","default":false},"net_bills_against_budget":{"type":"boolean","title":"Net Bills Against Budget","default":false}},"type":"object","required":["version_id","applied_override_count"],"title":"CashForecastVersionApplyResponse","description":"Response from applying a saved version to the live view.\n\nThe ``budget_id`` is returned explicitly so the frontend can sync\nits local \"selected budget\" state (it is per-request via query\nparameter, not stored on the business)."},"CashForecastVersionConfig":{"properties":{"budget_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Budget Id"},"excluded_budget_ledger_ids":{"items":{"type":"string"},"type":"array","title":"Excluded Budget Ledger Ids"},"weeks":{"type":"integer","maximum":52.0,"minimum":1.0,"title":"Weeks","default":13},"one_time_items_snapshot":{"items":{"$ref":"#/components/schemas/CashForecastOneTimeItemBase"},"type":"array","title":"One Time Items Snapshot","description":"Snapshot of the one-time items as they existed when the version was saved. Replays against live data don't re-load from the live ``cash_forecast_one_time_items`` table."},"overrides":{"anyOf":[{"items":{"$ref":"#/components/schemas/CashForecastOverrideInput"},"type":"array","maxItems":1000},{"type":"null"}],"title":"Overrides","description":"Cell overrides saved with the version. On save, omit (null) to capture the working override set, pass [] to save none (the live Cash Flow Forecast tab, which ignores overrides). On read, null means the version predates override capture."},"include_projected_replenishment":{"type":"boolean","title":"Include Projected Replenishment","description":"Projected replenishment POs were in the forecast.","default":false},"include_unapproved_ap":{"type":"boolean","title":"Include Unapproved Ap","description":"Bills awaiting approval were in the forecast.","default":false},"net_bills_against_budget":{"type":"boolean","title":"Net Bills Against Budget","description":"Open bills were netted against their budget line.","default":false}},"type":"object","title":"CashForecastVersionConfig","description":"Captured configuration when a version is saved.\n\nThe runtime can replay these inputs against live data to recompute\nthe forecast, or use the embedded ``snapshot_output`` for a stable\nhistorical view if requested."},"CashForecastVersionCreate":{"properties":{"name":{"type":"string","maxLength":200,"minLength":1,"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Description"},"config":{"$ref":"#/components/schemas/CashForecastVersionConfig"}},"type":"object","required":["name"],"title":"CashForecastVersionCreate","description":"Request payload for creating a saved forecast version."},"CashForecastVersionDetail":{"properties":{"id":{"type":"string","title":"Id"},"business_id":{"type":"string","title":"Business Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"created_by_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By User Id"},"snapshot_as_of":{"type":"string","format":"date-time","title":"Snapshot As Of"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"overrides_captured":{"type":"boolean","title":"Overrides Captured","description":"True when the version stored its cell overrides. False for versions saved before that: loading one keeps the working overrides as they are.","default":false},"config":{"$ref":"#/components/schemas/CashForecastVersionConfig"},"snapshot_output":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Snapshot Output","description":"Full ``CashForecast`` JSON captured at save time. Provides a stable historical view that doesn't shift as live data changes."}},"type":"object","required":["id","business_id","name","snapshot_as_of","created_at","updated_at"],"title":"CashForecastVersionDetail","description":"Full detail for a saved forecast version, including snapshot."},"CashForecastVersionList":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CashForecastVersionSummary"},"type":"array","title":"Items"}},"type":"object","title":"CashForecastVersionList"},"CashForecastVersionSummary":{"properties":{"id":{"type":"string","title":"Id"},"business_id":{"type":"string","title":"Business Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"created_by_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By User Id"},"snapshot_as_of":{"type":"string","format":"date-time","title":"Snapshot As Of"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"overrides_captured":{"type":"boolean","title":"Overrides Captured","description":"True when the version stored its cell overrides. False for versions saved before that: loading one keeps the working overrides as they are.","default":false}},"type":"object","required":["id","business_id","name","snapshot_as_of","created_at","updated_at"],"title":"CashForecastVersionSummary","description":"List-view summary of a saved forecast version."},"CashForecastVersionUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":200,"minLength":1},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Description"}},"type":"object","title":"CashForecastVersionUpdate","description":"Partial-update for a saved forecast version (name/description only)."},"CashForecastWeek":{"properties":{"week":{"type":"integer","title":"Week","description":"1-indexed week within the horizon"},"start_date":{"type":"string","format":"date","title":"Start Date","description":"Inclusive start date"},"end_date":{"type":"string","format":"date","title":"End Date","description":"Inclusive end date"},"cash_in_cents":{"type":"integer","title":"Cash In Cents","description":"Projected inflows from open invoices due in this week","default":0},"ap_out_cents":{"type":"integer","title":"Ap Out Cents","description":"Projected outflows from open bills due in this week","default":0},"po_out_cents":{"type":"integer","title":"Po Out Cents","description":"Projected outflows from POs with expected delivery in this week","default":0},"projected_po_out_cents":{"type":"integer","title":"Projected Po Out Cents","description":"Projected outflows from replenishment POs the business has not placed yet but the forecast engine expects it will need to, based on per-SKU demand forecasts and safety stock. Zero unless projected replenishment is explicitly enabled (Demand Planner).","default":0},"debt_out_cents":{"type":"integer","title":"Debt Out Cents","description":"Projected outflows from scheduled debt payments in this week","default":0},"debt_in_cents":{"type":"integer","title":"Debt In Cents","description":"Projected inflows from scheduled note-receivable repayments in this week","default":0},"budget_revenue_cents":{"type":"integer","title":"Budget Revenue Cents","description":"Weekly budgeted revenue projection (prorated from monthly budget lines)","default":0},"budget_expense_cents":{"type":"integer","title":"Budget Expense Cents","description":"Weekly budgeted expense projection (prorated from monthly budget lines)","default":0},"budget_breakdown":{"$ref":"#/components/schemas/BudgetCalculationWeekBreakdown","description":"Detailed ledger-by-ledger breakdown of budgeted amounts"},"one_time_cents":{"type":"integer","title":"One Time Cents","description":"Net one-time payment delta for this week from user-defined one-time items (positive = inflow, negative = outflow).","default":0},"unapproved_ap_out_cents":{"type":"integer","title":"Unapproved Ap Out Cents","description":"AP awaiting approval: pending_approval and forecasted bills due this week. Zero unless include_unapproved_ap is on.","default":0},"ending_cash_cents":{"type":"integer","title":"Ending Cash Cents","description":"Projected ending cash balance after this week. = prior ending + cash_in + debt_in + budget_rev + one_time - (ap + unapproved_ap + po + debt + budget_exp)","default":0},"ar_in_overridden":{"type":"boolean","title":"Ar In Overridden","default":false},"ap_out_overridden":{"type":"boolean","title":"Ap Out Overridden","default":false},"po_out_overridden":{"type":"boolean","title":"Po Out Overridden","default":false},"projected_po_out_overridden":{"type":"boolean","title":"Projected Po Out Overridden","default":false},"debt_out_overridden":{"type":"boolean","title":"Debt Out Overridden","default":false},"debt_in_overridden":{"type":"boolean","title":"Debt In Overridden","default":false},"budget_revenue_overridden":{"type":"boolean","title":"Budget Revenue Overridden","default":false},"budget_expense_overridden":{"type":"boolean","title":"Budget Expense Overridden","default":false},"one_time_overridden":{"type":"boolean","title":"One Time Overridden","default":false}},"type":"object","required":["week","start_date","end_date"],"title":"CashForecastWeek","description":"One week in a cash forecast horizon."},"CfoPortalAskRequest":{"properties":{"question":{"type":"string","maxLength":2000,"minLength":1,"title":"Question"},"context_section":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Context Section","description":"Slug of the CFO portal section the user is currently viewing (e.g. 'weekly-pulse', 'ap-aging'). Used to pick the data slice that grounds the answer."}},"type":"object","required":["question"],"title":"CfoPortalAskRequest","description":"Request payload for the CFO portal AI ask endpoint."},"CfoPortalAskResponse":{"properties":{"answer":{"type":"string","title":"Answer"},"sources":{"items":{"type":"string"},"type":"array","title":"Sources"}},"type":"object","required":["answer"],"title":"CfoPortalAskResponse","description":"Response payload for the CFO portal AI ask endpoint."},"CfoPortalBoardMemoExportRequest":{"properties":{"title":{"type":"string","maxLength":200,"title":"Title","default":"AI Board Memo"},"memo_markdown":{"type":"string","maxLength":100000,"minLength":1,"title":"Memo Markdown"},"generated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Generated At"},"format":{"type":"string","title":"Format","description":"Export format: pdf or html","default":"pdf"}},"type":"object","required":["memo_markdown"],"title":"CfoPortalBoardMemoExportRequest","description":"Request payload for exporting the generated board memo."},"CfoPortalBoardMemoResponse":{"properties":{"title":{"type":"string","title":"Title"},"memo_markdown":{"type":"string","title":"Memo Markdown"},"generated_at":{"type":"string","format":"date-time","title":"Generated At"},"status":{"type":"string","title":"Status","description":"available when AI succeeded, fallback when template text was used","default":"available"},"sources":{"items":{"type":"string"},"type":"array","title":"Sources"}},"type":"object","required":["title","memo_markdown","generated_at"],"title":"CfoPortalBoardMemoResponse","description":"Response payload for the board-deck AI memo endpoint."},"CfoPortalSectionResponse":{"properties":{"business_id":{"type":"string","title":"Business Id"},"section":{"type":"string","title":"Section"},"generated_at":{"type":"string","format":"date-time","title":"Generated At"},"start_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start Date"},"end_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"End Date"},"sources":{"items":{"$ref":"#/components/schemas/CfoPortalSource"},"type":"array","title":"Sources"},"data":{"additionalProperties":true,"type":"object","title":"Data"},"basis":{"anyOf":[{"type":"string","enum":["accrual","cash"]},{"type":"null"}],"title":"Basis","description":"Accounting basis the section's statements were rendered on. The CFO hub has no selector: it follows the business's configured default (``businesses.accounting_basis``, null = accrual). Only set on statement-derived sections (summary, statements, managerial-pl, flux, cash-forecast)."}},"type":"object","required":["business_id","section","generated_at"],"title":"CfoPortalSectionResponse","description":"Typed envelope for a CFO portal section payload."},"CfoPortalSource":{"properties":{"key":{"type":"string","title":"Key"},"label":{"type":"string","title":"Label"},"status":{"type":"string","title":"Status","description":"available, empty, partial, or unavailable","default":"available"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"}},"type":"object","required":["key","label"],"title":"CfoPortalSource","description":"Metadata for a CFO portal section's backing source."},"CustomBucketCreateRequest":{"properties":{"key":{"type":"string","maxLength":40,"minLength":1,"pattern":"^[a-z][a-z0-9_]*$","title":"Key","description":"Unique slug for the bucket (lowercase, underscores allowed)"},"label":{"type":"string","maxLength":100,"minLength":1,"title":"Label","description":"Display name for the bucket"},"color":{"type":"string","maxLength":20,"title":"Color","description":"Color theme: green, orange, indigo, accent, gray","default":"gray"},"classification":{"type":"string","maxLength":40,"title":"Classification","description":"Bucket classification: operating_revenue, cogs, operating_expense, other_income, other_expense","default":"operating_expense"},"sort_order":{"type":"integer","maximum":999.0,"minimum":0.0,"title":"Sort Order","default":100}},"type":"object","required":["key","label"],"title":"CustomBucketCreateRequest","description":"Request payload for creating a new custom managerial bucket."},"CustomBucketResponse":{"properties":{"id":{"type":"string","title":"Id"},"key":{"type":"string","title":"Key"},"label":{"type":"string","title":"Label"},"color":{"type":"string","title":"Color"},"classification":{"type":"string","title":"Classification"},"sort_order":{"type":"integer","title":"Sort Order"},"is_active":{"type":"boolean","title":"Is Active"},"is_default":{"type":"boolean","title":"Is Default","description":"True for built-in default buckets","default":false},"can_delete":{"type":"boolean","title":"Can Delete","description":"Whether the bucket can be deleted from Recipe Book. Some built-in buckets are locked.","default":true}},"type":"object","required":["id","key","label","color","classification","sort_order","is_active"],"title":"CustomBucketResponse","description":"A managerial bucket (built-in or custom).\n\nBuilt-in buckets have stable ``key`` values; optional ``label`` /\n``color`` edits come from per-business display overrides."},"CustomBucketUpdateRequest":{"properties":{"label":{"anyOf":[{"type":"string","maxLength":100,"minLength":1},{"type":"null"}],"title":"Label","description":"Display name for the bucket"},"color":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Color","description":"Color theme: green, orange, indigo, accent, gray"},"classification":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}],"title":"Classification","description":"Bucket classification: operating_revenue, cogs, operating_expense, other_income, other_expense"},"sort_order":{"anyOf":[{"type":"integer","maximum":999.0,"minimum":0.0},{"type":"null"}],"title":"Sort Order"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"}},"type":"object","title":"CustomBucketUpdateRequest","description":"Request payload for updating a custom managerial bucket."},"CustomBucketsListResponse":{"properties":{"buckets":{"items":{"$ref":"#/components/schemas/CustomBucketResponse"},"type":"array","title":"Buckets"}},"type":"object","required":["buckets"],"title":"CustomBucketsListResponse","description":"Response containing all buckets (default + custom) for a business."},"DebtContractApproveRequest":{"properties":{"contract":{"$ref":"#/components/schemas/ParsedDebtContract","description":"Parsed contract payload returned by the parse endpoint."},"contract_s3_key":{"anyOf":[{"type":"string","maxLength":1024},{"type":"null"}],"title":"Contract S3 Key","description":"S3 key of the original uploaded contract; persisted on the debt instrument for later retrieval."}},"type":"object","required":["contract"],"title":"DebtContractApproveRequest","description":"Request payload for approving a parsed lending contract."},"DebtContractApproveResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"lender":{"type":"string","title":"Lender"}},"type":"object","required":["id","name","lender"],"title":"DebtContractApproveResponse","description":"Response payload after persisting an approved parsed contract."},"DebtContractParseRequest":{"properties":{"s3_key":{"type":"string","maxLength":1024,"minLength":1,"title":"S3 Key","description":"S3 key of the uploaded debt contract document."}},"type":"object","required":["s3_key"],"title":"DebtContractParseRequest","description":"Request payload for parsing a lending/debt contract file."},"DebtCovenantCreateRequest":{"properties":{"metric_name":{"type":"string","maxLength":100,"minLength":1,"title":"Metric Name"},"operator":{"type":"string","title":"Operator","description":"CovenantOperatorEnum: greater_than, less_than, greater_than_or_equal, less_than_or_equal."},"threshold_value":{"type":"string","maxLength":50,"minLength":1,"title":"Threshold Value"},"measurement_frequency":{"type":"string","title":"Measurement Frequency","description":"PaymentFrequencyEnum cadence for measurement.","default":"quarterly"},"description":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Description"}},"type":"object","required":["metric_name","operator","threshold_value"],"title":"DebtCovenantCreateRequest","description":"Request payload for attaching a covenant to a debt instrument."},"DebtCovenantResponse":{"properties":{"id":{"type":"string","title":"Id"},"metric_name":{"type":"string","title":"Metric Name"},"operator":{"type":"string","title":"Operator"},"threshold_value":{"type":"string","title":"Threshold Value"},"measurement_frequency":{"type":"string","title":"Measurement Frequency"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"}},"type":"object","required":["id","metric_name","operator","threshold_value","measurement_frequency"],"title":"DebtCovenantResponse","description":"A financial covenant attached to a debt instrument."},"DebtInstrumentUpdateRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Name"},"current_balance_cents":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Current Balance Cents"},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes"},"amount_repaid_cents":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Amount Repaid Cents"},"revenue_share_bps":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Revenue Share Bps"},"total_repayment_cap_cents":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Total Repayment Cap Cents"},"linked_ledger_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Linked Ledger Id","description":"Chart-of-accounts ledger this loan backs. Pass an empty string to clear the link. Used to reconcile the instrument balance against a specific GL account."}},"type":"object","title":"DebtInstrumentUpdateRequest","description":"Fields the CFO portal may update on an existing debt instrument."},"DebtInstrumentUpdateResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"current_balance_cents":{"type":"integer","title":"Current Balance Cents"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"amount_repaid_cents":{"type":"integer","title":"Amount Repaid Cents"},"revenue_share_bps":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Revenue Share Bps"},"total_repayment_cap_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total Repayment Cap Cents"},"linked_ledger_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Linked Ledger Id"}},"type":"object","required":["id","name","current_balance_cents","amount_repaid_cents"],"title":"DebtInstrumentUpdateResponse","description":"Outcome of updating a debt instrument."},"DebtPaymentRequest":{"properties":{"payment_amount_cents":{"anyOf":[{"type":"integer","exclusiveMinimum":0.0},{"type":"null"}],"title":"Payment Amount Cents","description":"Total payment amount in cents (split into principal + interest). Omit when ``transaction_id`` is supplied — the transaction amount is used instead."},"cash_ledger_id":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"Cash Ledger Id","description":"Bank/cash ledger the money moves through — paid from (debt we owe) or received into (a note receivable). Optional when ``transaction_id`` is supplied (derived from the transaction JE)."},"payment_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Payment Date","description":"Payment date (defaults to today)."},"memo":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Memo"},"transaction_id":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"Transaction Id","description":"When set, rebook this bank transaction's journal entry into the principal + interest split instead of creating a standalone JE."}},"type":"object","title":"DebtPaymentRequest","description":"Request payload for recording a payment against a debt instrument."},"DebtPaymentResponse":{"properties":{"journal_entry_id":{"type":"string","title":"Journal Entry Id"},"principal_cents":{"type":"integer","title":"Principal Cents"},"interest_cents":{"type":"integer","title":"Interest Cents"},"remaining_balance_cents":{"type":"integer","title":"Remaining Balance Cents"},"name":{"type":"string","title":"Name"},"direction":{"type":"string","title":"Direction"},"transaction_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transaction Id"}},"type":"object","required":["journal_entry_id","principal_cents","interest_cents","remaining_balance_cents","name","direction"],"title":"DebtPaymentResponse","description":"Result of posting a loan payment."},"DebtScheduleGenerateRequest":{"properties":{"overwrite_custom":{"type":"boolean","title":"Overwrite Custom","description":"When true, discard existing rows (including user-edited ones) and rebuild the whole schedule from the instrument's terms. When false, regeneration preserves rows the user customized.","default":false}},"type":"object","title":"DebtScheduleGenerateRequest","description":"Request to (re)generate a loan's paydown table from its terms."},"DebtScheduleResponse":{"properties":{"instrument_id":{"type":"string","title":"Instrument Id"},"name":{"type":"string","title":"Name"},"direction":{"type":"string","title":"Direction"},"current_balance_cents":{"type":"integer","title":"Current Balance Cents"},"rows":{"items":{"$ref":"#/components/schemas/DebtScheduleRowResponse"},"type":"array","title":"Rows"},"total_principal_cents":{"type":"integer","title":"Total Principal Cents","default":0},"total_interest_cents":{"type":"integer","title":"Total Interest Cents","default":0},"total_payment_cents":{"type":"integer","title":"Total Payment Cents","default":0}},"type":"object","required":["instrument_id","name","direction","current_balance_cents"],"title":"DebtScheduleResponse","description":"The full paydown table for a debt instrument plus summary totals."},"DebtScheduleRowCreateRequest":{"properties":{"due_date":{"type":"string","format":"date","title":"Due Date"},"principal_cents":{"type":"integer","minimum":0.0,"title":"Principal Cents","default":0},"interest_cents":{"type":"integer","minimum":0.0,"title":"Interest Cents","default":0},"note":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Note"}},"type":"object","required":["due_date"],"title":"DebtScheduleRowCreateRequest","description":"Request to add a custom row to a loan's paydown table."},"DebtScheduleRowResponse":{"properties":{"id":{"type":"string","title":"Id"},"debt_instrument_id":{"type":"string","title":"Debt Instrument Id"},"sequence":{"type":"integer","title":"Sequence"},"due_date":{"type":"string","format":"date","title":"Due Date"},"principal_cents":{"type":"integer","title":"Principal Cents"},"interest_cents":{"type":"integer","title":"Interest Cents"},"total_cents":{"type":"integer","title":"Total Cents"},"expected_balance_after_cents":{"type":"integer","title":"Expected Balance After Cents"},"status":{"type":"string","title":"Status"},"is_custom_edited":{"type":"boolean","title":"Is Custom Edited"},"paid_amount_cents":{"type":"integer","title":"Paid Amount Cents"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"}},"type":"object","required":["id","debt_instrument_id","sequence","due_date","principal_cents","interest_cents","total_cents","expected_balance_after_cents","status","is_custom_edited","paid_amount_cents"],"title":"DebtScheduleRowResponse","description":"A single persisted, editable row of a loan's paydown table."},"DebtScheduleRowUpdateRequest":{"properties":{"due_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Due Date"},"principal_cents":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Principal Cents"},"interest_cents":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Interest Cents"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status","description":"scheduled, paid, partially_paid, skipped, or overdue."},"note":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Note"}},"type":"object","title":"DebtScheduleRowUpdateRequest","description":"Request to edit a single paydown-table row."},"DemandPlanScenarioOneTime":{"properties":{"label":{"type":"string","maxLength":200,"minLength":1,"title":"Label"},"amount_cents":{"type":"integer","title":"Amount Cents"},"applies_on":{"type":"string","format":"date","title":"Applies On"}},"type":"object","required":["label","amount_cents","applies_on"],"title":"DemandPlanScenarioOneTime","description":"One inline one-time item to model in a scenario only."},"DemandPlanScenarioOverride":{"properties":{"week_number":{"type":"integer","maximum":104.0,"minimum":0.0,"title":"Week Number"},"column":{"type":"string","enum":["ar_in","ap_out","inventory","debt","debt_in","budget_rev","budget_exp","one_time"],"title":"Column"},"amount_cents":{"type":"integer","title":"Amount Cents"}},"type":"object","required":["week_number","column","amount_cents"],"title":"DemandPlanScenarioOverride","description":"One cell override for an HTTP scenario evaluation request.\n\n``week_number=0`` targets the Overdue row; ``1..weeks`` targets a\nweekly cell. ``amount_cents`` is the literal value to use."},"DemandPlanScenarioRequest":{"properties":{"scenario_description":{"type":"string","maxLength":400,"minLength":1,"title":"Scenario Description"},"overrides":{"items":{"$ref":"#/components/schemas/DemandPlanScenarioOverride"},"type":"array","title":"Overrides"},"inline_one_time_items":{"items":{"$ref":"#/components/schemas/DemandPlanScenarioOneTime"},"type":"array","title":"Inline One Time Items"},"weeks":{"type":"integer","maximum":52.0,"minimum":1.0,"title":"Weeks","default":13},"budget_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Budget Id"},"excluded_budget_ledger_ids":{"items":{"type":"string"},"type":"array","title":"Excluded Budget Ledger Ids"}},"type":"object","required":["scenario_description"],"title":"DemandPlanScenarioRequest","description":"Inputs to ``POST /cfo-portal/cash-forecast/demand-plan``."},"DemandPlanScenarioResponse":{"properties":{"scenario_description":{"type":"string","title":"Scenario Description"},"weeks":{"items":{"$ref":"#/components/schemas/CashForecastWeek"},"type":"array","title":"Weeks"},"week_deltas":{"items":{"$ref":"#/components/schemas/DemandPlanWeekDelta"},"type":"array","title":"Week Deltas"},"starting_cash_cents":{"type":"integer","title":"Starting Cash Cents"},"baseline_ending_cash_cents":{"type":"integer","title":"Baseline Ending Cash Cents"},"scenario_ending_cash_cents":{"type":"integer","title":"Scenario Ending Cash Cents"},"ending_cash_delta_cents":{"type":"integer","title":"Ending Cash Delta Cents"},"baseline_lowest_cash_cents":{"type":"integer","title":"Baseline Lowest Cash Cents"},"scenario_lowest_cash_cents":{"type":"integer","title":"Scenario Lowest Cash Cents"},"lowest_cash_delta_cents":{"type":"integer","title":"Lowest Cash Delta Cents"},"baseline_lowest_cash_week":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Baseline Lowest Cash Week"},"scenario_lowest_cash_week":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Scenario Lowest Cash Week"},"headline":{"type":"string","title":"Headline"},"narrative":{"type":"string","title":"Narrative"},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings"}},"type":"object","required":["scenario_description","weeks","week_deltas","starting_cash_cents","baseline_ending_cash_cents","scenario_ending_cash_cents","ending_cash_delta_cents","baseline_lowest_cash_cents","scenario_lowest_cash_cents","lowest_cash_delta_cents","headline","narrative"],"title":"DemandPlanScenarioResponse","description":"Structured demand-plan scenario output (cents-based).\n\nMirrors the AI tool's output shape but returns integer cents\ninstead of formatted currency strings so the frontend can render\nconsistently with the rest of the cash-forecast UI."},"DemandPlanWeekDelta":{"properties":{"week":{"type":"integer","title":"Week"},"start_date":{"type":"string","format":"date","title":"Start Date"},"baseline_ending_cash_cents":{"type":"integer","title":"Baseline Ending Cash Cents"},"scenario_ending_cash_cents":{"type":"integer","title":"Scenario Ending Cash Cents"},"delta_cents":{"type":"integer","title":"Delta Cents"}},"type":"object","required":["week","start_date","baseline_ending_cash_cents","scenario_ending_cash_cents","delta_cents"],"title":"DemandPlanWeekDelta","description":"One week of baseline-vs-scenario comparison."},"ManagerialBuilderItem":{"properties":{"key":{"type":"string","pattern":"^(cm1|cm2|cash_outflow_debt|cash_outflow_inventory)$","title":"Key","description":"Builder key: cm1, cm2, cash_outflow_debt, cash_outflow_inventory"},"label":{"anyOf":[{"type":"string","maxLength":100,"minLength":1},{"type":"null"}],"title":"Label","description":"Display label for this builder line."},"ledger_ids":{"items":{"type":"string"},"type":"array","title":"Ledger Ids","description":"Chart-of-accounts ledger IDs included in this builder."}},"type":"object","required":["key"],"title":"ManagerialBuilderItem","description":"Configuration for one custom managerial builder line."},"ManagerialBuildersUpdateRequest":{"properties":{"builders":{"items":{"$ref":"#/components/schemas/ManagerialBuilderItem"},"type":"array","title":"Builders"}},"type":"object","title":"ManagerialBuildersUpdateRequest","description":"Bulk update payload for custom managerial builder lines."},"ManagerialMappingItem":{"properties":{"ledger_id":{"type":"string","minLength":1,"title":"Ledger Id"},"bucket":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}],"title":"Bucket"}},"type":"object","required":["ledger_id"],"title":"ManagerialMappingItem","description":"Single GL ledger -> managerial bucket assignment.\n\nA ``bucket`` of ``None`` (or omitting the field on PUT) clears any\nexisting mapping for the ledger.  Otherwise it must be one of the\nallowed bucket keys validated in the service layer\n(``app.models.managerial_account_mappings.MANAGERIAL_BUCKETS``)."},"ManagerialMappingUpsertRequest":{"properties":{"mappings":{"items":{"$ref":"#/components/schemas/ManagerialMappingItem"},"type":"array","title":"Mappings"}},"type":"object","title":"ManagerialMappingUpsertRequest","description":"Bulk upsert payload for the Recipe Book bucket-mapping editor.\n\nSending an empty list is valid and is a no-op; sending a row with\n``bucket: null`` clears that ledger's mapping.  Ledgers not\nreferenced in the payload are left untouched, which lets the\nfrontend save one row at a time without re-sending the whole CoA."},"MoneyFlowLineageEdge":{"properties":{"source_id":{"type":"string","title":"Source Id"},"target_id":{"type":"string","title":"Target Id"},"amount_cents":{"type":"integer","title":"Amount Cents","default":0}},"type":"object","required":["source_id","target_id"],"title":"MoneyFlowLineageEdge","description":"Directed edge in the Money-Flow Provenance Lineage DAG."},"MoneyFlowLineageNode":{"properties":{"id":{"type":"string","title":"Id"},"stage":{"type":"string","enum":["source","clearing","journal","ledger"],"title":"Stage"},"label":{"type":"string","title":"Label"},"amount_cents":{"type":"integer","title":"Amount Cents","default":0},"record_count":{"type":"integer","title":"Record Count","default":0},"status":{"type":"string","enum":["ok","warning"],"title":"Status","default":"ok"}},"type":"object","required":["id","stage","label"],"title":"MoneyFlowLineageNode","description":"One node in the 4-stage Money-Flow Provenance Lineage DAG."},"MoneyFlowLineageResponse":{"properties":{"business_id":{"type":"string","title":"Business Id"},"ledger_id":{"type":"string","title":"Ledger Id"},"account_name":{"type":"string","title":"Account Name"},"ledger_type":{"type":"string","title":"Ledger Type","default":"expense"},"start_date":{"type":"string","format":"date","title":"Start Date"},"end_date":{"type":"string","format":"date","title":"End Date"},"net_amount_cents":{"type":"integer","title":"Net Amount Cents","default":0},"total_debits_cents":{"type":"integer","title":"Total Debits Cents","default":0},"total_credits_cents":{"type":"integer","title":"Total Credits Cents","default":0},"journal_entry_count":{"type":"integer","title":"Journal Entry Count","default":0},"line_count":{"type":"integer","title":"Line Count","default":0},"unmatched_clearing_gap_cents":{"type":"integer","title":"Unmatched Clearing Gap Cents","default":0},"reconciliation_status":{"type":"string","enum":["reconciled","clearing_gap"],"title":"Reconciliation Status","default":"reconciled"},"nodes":{"items":{"$ref":"#/components/schemas/MoneyFlowLineageNode"},"type":"array","title":"Nodes"},"edges":{"items":{"$ref":"#/components/schemas/MoneyFlowLineageEdge"},"type":"array","title":"Edges"},"sample_entries":{"items":{"$ref":"#/components/schemas/MoneyFlowLineageSample"},"type":"array","title":"Sample Entries"}},"type":"object","required":["business_id","ledger_id","account_name","start_date","end_date"],"title":"MoneyFlowLineageResponse","description":"4-stage provenance lineage chain from subledger/feed to GL account total."},"MoneyFlowLineageSample":{"properties":{"journal_entry_id":{"type":"string","title":"Journal Entry Id"},"date":{"type":"string","format":"date","title":"Date"},"origin":{"type":"string","title":"Origin"},"counterparty_or_memo":{"type":"string","title":"Counterparty Or Memo"},"amount_cents":{"type":"integer","title":"Amount Cents","default":0},"reconciled":{"type":"boolean","title":"Reconciled","default":true}},"type":"object","required":["journal_entry_id","date","origin","counterparty_or_memo"],"title":"MoneyFlowLineageSample","description":"Sample underlying journal entry in the provenance chain."},"NarrativeFluxDriver":{"properties":{"date":{"type":"string","format":"date","title":"Date"},"counterparty_or_source":{"type":"string","title":"Counterparty Or Source","description":"Counterparty, vendor, or campaign name; redacted to 'Counterparty #1', 'Vendor #2', etc. when redact_pii=True"},"amount_cents":{"type":"integer","title":"Amount Cents"},"description":{"type":"string","title":"Description"},"source_type":{"type":"string","title":"Source Type","description":"transaction, journal_line, bill, or meta_ads","default":"transaction"},"entity_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entity Id"}},"type":"object","required":["date","counterparty_or_source","amount_cents","description"],"title":"NarrativeFluxDriver","description":"Single underlying subledger driver for a material account variance."},"NarrativeFluxMover":{"properties":{"ledger_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ledger Id"},"account_name":{"type":"string","title":"Account Name"},"category_group":{"type":"string","title":"Category Group","description":"Revenue, COGS, Operating Expenses, or Net Income"},"current_cents":{"type":"integer","title":"Current Cents"},"prior_cents":{"type":"integer","title":"Prior Cents"},"variance_cents":{"type":"integer","title":"Variance Cents"},"variance_bps":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Variance Bps"},"variance_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Variance Pct"},"favorable":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Favorable"},"is_material":{"type":"boolean","title":"Is Material","default":false},"narrative":{"type":"string","title":"Narrative","default":""},"top_drivers":{"items":{"$ref":"#/components/schemas/NarrativeFluxDriver"},"type":"array","title":"Top Drivers"}},"type":"object","required":["account_name","category_group","current_cents","prior_cents","variance_cents"],"title":"NarrativeFluxMover","description":"Account or category-group variance row with narrative and drill-through drivers."},"NarrativeFluxPacketResponse":{"properties":{"business_id":{"type":"string","title":"Business Id"},"period_start":{"type":"string","format":"date","title":"Period Start"},"period_end":{"type":"string","format":"date","title":"Period End"},"prior_start":{"type":"string","format":"date","title":"Prior Start"},"prior_end":{"type":"string","format":"date","title":"Prior End"},"materiality_bps":{"type":"integer","title":"Materiality Bps","default":200},"materiality_cents":{"type":"integer","title":"Materiality Cents","default":50000},"redact_pii":{"type":"boolean","title":"Redact Pii","default":false},"category_groups":{"items":{"$ref":"#/components/schemas/NarrativeFluxMover"},"type":"array","title":"Category Groups"},"account_flux":{"items":{"$ref":"#/components/schemas/NarrativeFluxMover"},"type":"array","title":"Account Flux"},"material_movers":{"items":{"$ref":"#/components/schemas/NarrativeFluxMover"},"type":"array","title":"Material Movers"},"executive_summary":{"items":{"type":"string"},"type":"array","title":"Executive Summary"},"markdown_brief":{"type":"string","title":"Markdown Brief","default":""},"generated_at":{"type":"string","format":"date-time","title":"Generated At"}},"type":"object","required":["business_id","period_start","period_end","prior_start","prior_end","generated_at"],"title":"NarrativeFluxPacketResponse","description":"Live narrative flux close packet with subledger drill-through and PII redaction."},"POForecastDetail":{"properties":{"po_id":{"type":"string","title":"Po Id"},"po_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Po Number"},"vendor_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vendor Name"},"status":{"type":"string","title":"Status"},"total_cents":{"type":"integer","title":"Total Cents","default":0},"balance_cents":{"type":"integer","title":"Balance Cents","default":0},"expected_paid_on":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Expected Paid On"},"is_linked_to_bill":{"type":"boolean","title":"Is Linked To Bill","default":false},"linked_bill_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Linked Bill Id"},"linked_bill_due_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Linked Bill Due Date"},"linked_bill_remaining_balance_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Linked Bill Remaining Balance Cents"},"forecast_column":{"type":"string","enum":["inventory","ap_out"],"title":"Forecast Column"}},"type":"object","required":["po_id","status","forecast_column"],"title":"POForecastDetail","description":"One PO surfaced on the Cash Flow PO Settings panel.\n\nEach row tells the operator (a) which column this PO's cash flows\nthrough (``inventory`` when unlinked, ``ap_out`` when an explicit\n``Bill`` is attached via ``source_inventory_order_id``) and (b) the\namount and date used in that column."},"POForecastSettingsResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/POForecastDetail"},"type":"array","title":"Items"},"total_inventory_outflow_cents":{"type":"integer","title":"Total Inventory Outflow Cents","default":0},"total_ap_outflow_cents":{"type":"integer","title":"Total Ap Outflow Cents","default":0}},"type":"object","title":"POForecastSettingsResponse","description":"Response envelope for the PO settings panel."},"ParseDebtContractResponse":{"properties":{"contract":{"$ref":"#/components/schemas/ParsedDebtContract"},"payment_schedule":{"items":{"$ref":"#/components/schemas/ParsedDebtScheduleRow"},"type":"array","title":"Payment Schedule"}},"type":"object","required":["contract"],"title":"ParseDebtContractResponse","description":"Draft contract terms + projected payout table from a parsed PDF."},"ParsedDebtContract":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"lender":{"type":"string","maxLength":255,"minLength":1,"title":"Lender","description":"Counterparty name. The lender for a loan to us (borrow) or the borrower for a loan we made (lend)."},"direction":{"type":"string","title":"Direction","description":"DebtDirectionEnum value: 'borrow' (a loan to us — a liability) or 'lend' (a loan from us / note receivable — an asset whose interest is income). Defaults to 'borrow'.","default":"borrow"},"debt_type":{"type":"string","title":"Debt Type","description":"DebtTypeEnum value: term_loan, line_of_credit, mortgage, equipment_loan, sba_loan, convertible_note, revenue_based, other."},"original_principal_cents":{"type":"integer","minimum":0.0,"title":"Original Principal Cents"},"current_balance_cents":{"type":"integer","minimum":0.0,"title":"Current Balance Cents"},"interest_rate_bps":{"type":"integer","minimum":0.0,"title":"Interest Rate Bps","description":"Annual interest rate in basis points (e.g. 500 = 5.00%). Set to 0 for revenue-based financing.","default":0},"term_months":{"type":"integer","minimum":0.0,"title":"Term Months","description":"Loan term in months. For revenue-based financing this is an estimate of months to cap based on assumed revenue.","default":0},"start_date":{"type":"string","title":"Start Date","description":"Contract start date as ISO-8601 YYYY-MM-DD."},"maturity_date":{"type":"string","title":"Maturity Date","description":"Maturity/expected payoff date as ISO-8601 YYYY-MM-DD. For RBF this is an estimate based on the share rate."},"payment_frequency":{"type":"string","title":"Payment Frequency","description":"PaymentFrequencyEnum value: monthly, quarterly, semi_annual, annual, bullet, or revenue_share.","default":"monthly"},"payment_amount_cents":{"type":"integer","minimum":0.0,"title":"Payment Amount Cents","description":"Scheduled payment per period (fixed) or 0 for RBF.","default":0},"revenue_share_bps":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Revenue Share Bps","description":"Revenue-share rate in basis points; only set for ``revenue_based`` debt."},"total_repayment_cap_cents":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Total Repayment Cap Cents","description":"Total dollar cap on cumulative repayments; only set for ``revenue_based`` debt."},"summary":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Summary","description":"One-paragraph human summary of the contract."},"confidence":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Confidence","description":"Parsing confidence in [0, 1] reported by the LLM.","default":0.0}},"type":"object","required":["name","lender","debt_type","original_principal_cents","current_balance_cents","start_date","maturity_date"],"title":"ParsedDebtContract","description":"Structured debt-contract terms extracted from a parsed contract.\n\nField names and units match ``DebtInstrument`` so the approve\nendpoint can persist this payload directly. Revenue-based fields\n(``revenue_share_bps`` and ``total_repayment_cap_cents``) are only\npopulated when ``debt_type`` is ``revenue_based``."},"ParsedDebtScheduleRow":{"properties":{"payment_date":{"type":"string","title":"Payment Date","description":"ISO-8601 YYYY-MM-DD."},"amount_cents":{"type":"integer","minimum":0.0,"title":"Amount Cents"},"principal_cents":{"type":"integer","minimum":0.0,"title":"Principal Cents"},"interest_cents":{"type":"integer","minimum":0.0,"title":"Interest Cents"},"remaining_balance_cents":{"type":"integer","minimum":0.0,"title":"Remaining Balance Cents"}},"type":"object","required":["payment_date","amount_cents","principal_cents","interest_cents","remaining_balance_cents"],"title":"ParsedDebtScheduleRow","description":"A single row of a projected payout table."},"SuccessEnvelope_CashForecastLedgerTimingList_":{"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/CashForecastLedgerTimingList"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CashForecastLedgerTimingList]"},"SuccessEnvelope_CashForecastOneTimeItemList_":{"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/CashForecastOneTimeItemList"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CashForecastOneTimeItemList]"},"SuccessEnvelope_CashForecastOneTimeItem_":{"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/CashForecastOneTimeItem"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CashForecastOneTimeItem]"},"SuccessEnvelope_CashForecastOverrideList_":{"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/CashForecastOverrideList"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CashForecastOverrideList]"},"SuccessEnvelope_CashForecastVersionApplyResponse_":{"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/CashForecastVersionApplyResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CashForecastVersionApplyResponse]"},"SuccessEnvelope_CashForecastVersionDetail_":{"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/CashForecastVersionDetail"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CashForecastVersionDetail]"},"SuccessEnvelope_CashForecastVersionList_":{"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/CashForecastVersionList"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CashForecastVersionList]"},"SuccessEnvelope_CfoPortalAskResponse_":{"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/CfoPortalAskResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CfoPortalAskResponse]"},"SuccessEnvelope_CfoPortalBoardMemoResponse_":{"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/CfoPortalBoardMemoResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CfoPortalBoardMemoResponse]"},"SuccessEnvelope_CfoPortalSectionResponse_":{"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/CfoPortalSectionResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CfoPortalSectionResponse]"},"SuccessEnvelope_CustomBucketResponse_":{"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/CustomBucketResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CustomBucketResponse]"},"SuccessEnvelope_CustomBucketsListResponse_":{"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/CustomBucketsListResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CustomBucketsListResponse]"},"SuccessEnvelope_DebtContractApproveResponse_":{"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/DebtContractApproveResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[DebtContractApproveResponse]"},"SuccessEnvelope_DebtCovenantResponse_":{"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/DebtCovenantResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[DebtCovenantResponse]"},"SuccessEnvelope_DebtInstrumentUpdateResponse_":{"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/DebtInstrumentUpdateResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[DebtInstrumentUpdateResponse]"},"SuccessEnvelope_DebtPaymentResponse_":{"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/DebtPaymentResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[DebtPaymentResponse]"},"SuccessEnvelope_DebtScheduleResponse_":{"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/DebtScheduleResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[DebtScheduleResponse]"},"SuccessEnvelope_DemandPlanScenarioResponse_":{"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/DemandPlanScenarioResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[DemandPlanScenarioResponse]"},"SuccessEnvelope_MoneyFlowLineageResponse_":{"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/MoneyFlowLineageResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[MoneyFlowLineageResponse]"},"SuccessEnvelope_NarrativeFluxPacketResponse_":{"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/NarrativeFluxPacketResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[NarrativeFluxPacketResponse]"},"SuccessEnvelope_POForecastSettingsResponse_":{"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/POForecastSettingsResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[POForecastSettingsResponse]"},"SuccessEnvelope_ParseDebtContractResponse_":{"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/ParseDebtContractResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[ParseDebtContractResponse]"},"SuccessEnvelope_TimeTravelAuditResponse_":{"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/TimeTravelAuditResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[TimeTravelAuditResponse]"},"SuccessEnvelope_list_DebtCovenantResponse__":{"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":[{"items":{"$ref":"#/components/schemas/DebtCovenantResponse"},"type":"array"},{"type":"null"}],"title":"Data"}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[list[DebtCovenantResponse]]"},"TimeTravelAuditFinding":{"properties":{"id":{"type":"string","title":"Id"},"category":{"type":"string","title":"Category","description":"duplicate_saas_or_vendor_charge, unamortized_prepaid_expense, shopify_clearing_or_dispute_leak, or shadow_mca_drain"},"severity":{"type":"string","enum":["high","medium","info"],"title":"Severity","default":"medium"},"title":{"type":"string","title":"Title"},"summary":{"type":"string","title":"Summary"},"impact_cents":{"type":"integer","title":"Impact Cents","default":0},"evidence_count":{"type":"integer","title":"Evidence Count","default":0},"suggested_action":{"type":"string","title":"Suggested Action"},"what_if_reclassification":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"What If Reclassification"}},"type":"object","required":["id","category","title","summary","suggested_action"],"title":"TimeTravelAuditFinding","description":"One dollar-denominated finding from the 60-Second Time-Travel Audit."},"TimeTravelAuditResponse":{"properties":{"business_id":{"type":"string","title":"Business Id"},"lookback_days":{"type":"integer","title":"Lookback Days","default":365},"scanned_transactions_count":{"type":"integer","title":"Scanned Transactions Count","default":0},"scanned_bills_count":{"type":"integer","title":"Scanned Bills Count","default":0},"total_recoverable_or_misstated_cents":{"type":"integer","title":"Total Recoverable Or Misstated Cents","default":0},"executive_headline":{"type":"string","title":"Executive Headline"},"findings":{"items":{"$ref":"#/components/schemas/TimeTravelAuditFinding"},"type":"array","title":"Findings"}},"type":"object","required":["business_id","executive_headline"],"title":"TimeTravelAuditResponse","description":"60-Second Time-Travel Audit summary of leaks, duplicates, and misstatements."},"UnitEconomicsSettingsUpdateRequest":{"properties":{"aov_mode":{"type":"string","pattern":"^(shopify|manual)$","title":"Aov Mode","description":"AOV source mode: 'shopify' or 'manual'."},"manual_aov_cents":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Manual Aov Cents","description":"Manual AOV override in cents; required when aov_mode='manual'."},"shopify_sections":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Shopify Sections","description":"Optional list of CFO sections where Shopify data is allowed to flow. If omitted, existing scope is preserved. Example: ['unit-economics', 'shipping-analysis']"}},"type":"object","required":["aov_mode"],"title":"UnitEconomicsSettingsUpdateRequest","description":"Request payload for Unit Economics input settings."},"app__core__success__MessageResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"}},"additionalProperties":true,"type":"object","title":"MessageResponse","description":"Envelope for data-less mutations: ``{success, message, code}``, no ``data``.\n\nCanonical ``response_model`` for deletes and other message-only mutations so\nthe generated TypeScript client gets a single, named ``MessageResponse`` type\ninstead of dozens of empty per-route stubs. Pairs with the\n``SuccessResponse.*`` builders (which already emit this exact shape)."},"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":[]}]}