{"openapi":"3.1.0","info":{"title":"Businesses — DayZero API","version":"1.0.0","description":"Business entities — the core tenant in DayZero."},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/businesses/nav-preferences":{"get":{"tags":["businesses"],"summary":"Get sidebar navigation preferences","description":"Get the per-business set of hidden nav items. Empty = show everything entitled.","operationId":"get_nav_preferences","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_NavPreferencesResponse_"}}}},"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_nav_preferences_api_v1_businesses_nav_preferences_get"},"put":{"tags":["businesses"],"summary":"Update sidebar navigation preferences","description":"Replace the per-business hidden nav set. Send an empty list to show everything.","operationId":"update_nav_preferences","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NavPreferencesUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_NavPreferencesResponse_"}}}},"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":"update_nav_preferences_api_v1_businesses_nav_preferences_put"}},"/api/v1/businesses/nav-preferences/suggest":{"post":{"tags":["businesses"],"summary":"AI-suggest which nav items to hide","description":"Given a business description and the hideable nav catalog, returns a proposed set of items to hide (with reasons) plus a one-line profile. Proposal only — nothing is saved; apply via PUT /nav-preferences.","operationId":"suggest_nav_preferences","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NavSuggestRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_NavSuggestResponse_"}}}},"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"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"example":{"error":"server_error","message":"An internal error occurred. Please try again.","code":"GEN_003","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":"suggest_nav_preferences_api_v1_businesses_nav_preferences_suggest_post"}},"/api/v1/businesses/user-preferences/table-views":{"get":{"tags":["businesses"],"summary":"List saved table views","description":"Return all DataTable saved views for the current user in the active business.","operationId":"list_table_views","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_TableViewsMapResponse_"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"list_table_views_api_v1_businesses_user_preferences_table_views_get"},"patch":{"tags":["businesses"],"summary":"Merge saved table views","description":"Upsert one or more table view blobs. Send empty views to remove a key. Include the expected ``version`` (or ``If-Match`` header) to avoid lost updates when multiple clients patch concurrently.","operationId":"patch_table_views","parameters":[{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"If-Match"}},{"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/TableViewsPatchRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_TableViewsMapResponse_"}}}},"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"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_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":"patch_table_views_api_v1_businesses_user_preferences_table_views_patch"}},"/api/v1/businesses/user-preferences/table-views/{table_key}":{"get":{"tags":["businesses"],"summary":"Get saved views for one table","description":"Return the saved-views blob for a single DataTable persistKey.","operationId":"get_table_views","parameters":[{"name":"table_key","in":"path","required":true,"schema":{"type":"string","title":"Table 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/SuccessEnvelope_TableSavedViewsDataSchema_"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"get_table_views_api_v1_businesses_user_preferences_table_views__table_key__get"}},"/api/v1/businesses":{"get":{"tags":["businesses"],"summary":"List businesses","description":"Retrieve businesses the authenticated user has access to.","operationId":"list_businesses","parameters":[{"name":"id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"}},{"name":"name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"}},{"name":"stripe_account_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Account Id"}},{"name":"shopify_shop_domain","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Shopify Shop Domain"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Cursor for pagination","title":"Cursor"},"description":"Cursor for pagination"},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":1000,"minimum":1},{"type":"null"}],"description":"Pagination limit","title":"Limit"},"description":"Pagination limit"},{"name":"direction","in":"query","required":false,"schema":{"type":"string","description":"Pagination direction: 'next' or 'prev'","default":"next","title":"Direction"},"description":"Pagination direction: 'next' or 'prev'"},{"name":"include_total_count","in":"query","required":false,"schema":{"type":"boolean","description":"Whether to include total count (expensive - avoid if possible)","default":false,"title":"Include Total Count"},"description":"Whether to include total count (expensive - avoid if possible)"},{"name":"sort_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Column name to sort by (e.g. 'created_at', 'amount', 'name'). When changing sort, reset cursor to None.","title":"Sort By"},"description":"Column name to sort by (e.g. 'created_at', 'amount', 'name'). When changing sort, reset cursor to None."},{"name":"descending","in":"query","required":false,"schema":{"type":"boolean","description":"Sort direction: true for descending (newest/largest first), false for ascending","default":true,"title":"Descending"},"description":"Sort direction: true for descending (newest/largest first), false for ascending"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_BusinessCursorListResponse_"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"list_businesses_api_v1_businesses_get"},"post":{"tags":["businesses"],"summary":"Create business","description":"Create a new business entity with optional integrations.","operationId":"create_business","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessCreateRequest"},"example":{"coa_template_id":"standard_accrual","entries_start":"2024-01-01","mailbox":"acme","name":"Acme Corporation","user_id":"019ab37c-05e7-7000-8000-000000000001"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_BusinessResponse_"}}}},"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"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_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":"create_business_api_v1_businesses_post"}},"/api/v1/businesses/validate-coa":{"post":{"tags":["businesses"],"summary":"Validate a custom COA template","description":"Validates a custom chart of accounts template against platform requirements without creating anything.","operationId":"validate_coa_template","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Payload"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_ValidateCoaTemplateResponse_"}}}},"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"}}}},"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":"validate_coa_template_api_v1_businesses_validate_coa_post"}},"/api/v1/businesses/generate-coa":{"post":{"tags":["businesses"],"summary":"Generate a COA template using AI","description":"Uses AI to generate a complete chart of accounts template based on a business description.","operationId":"generate_coa_template","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CoaGenerateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CoaGenerateResponse_"}}}},"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"}}}},"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":"generate_coa_template_api_v1_businesses_generate_coa_post"}},"/api/v1/businesses/mailbox":{"get":{"tags":["businesses"],"summary":"Check mailbox uniqueness","description":"Check if a mailbox is unique; validation and conflicts are handled by the service.\n\nRate-limited per user and per IP — the endpoint is otherwise an\nenumeration oracle for the mailbox namespace.","operationId":"check_mailbox_uniqueness","parameters":[{"name":"mailbox","in":"query","required":true,"schema":{"type":"string","description":"Mailbox to check for uniqueness","title":"Mailbox"},"description":"Mailbox to check for uniqueness"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_MailboxUniquenessResponse_"}}}},"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"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too Many Requests - Rate limit exceeded; back off and retry","content":{"application/json":{"example":{"error":"rate_limited","message":"Too many requests. Please slow down.","code":"GEN_005","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"check_mailbox_uniqueness_api_v1_businesses_mailbox_get"}},"/api/v1/businesses/users":{"get":{"tags":["businesses"],"summary":"List business users","description":"Get users associated with a business, optionally including advisory firm users.","operationId":"list_business_users","parameters":[{"name":"include_advisory_users","in":"query","required":false,"schema":{"type":"boolean","description":"Include users from the parent advisory firm if one exists.","default":false,"title":"Include Advisory Users"},"description":"Include users from the parent advisory firm if one exists."},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Cursor for pagination","title":"Cursor"},"description":"Cursor for pagination"},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":1000,"minimum":1},{"type":"null"}],"description":"Pagination limit","title":"Limit"},"description":"Pagination limit"},{"name":"direction","in":"query","required":false,"schema":{"type":"string","description":"Pagination direction: 'next' or 'prev'","default":"next","title":"Direction"},"description":"Pagination direction: 'next' or 'prev'"},{"name":"include_total_count","in":"query","required":false,"schema":{"type":"boolean","description":"Whether to include total count (expensive - avoid if possible)","default":false,"title":"Include Total Count"},"description":"Whether to include total count (expensive - avoid if possible)"},{"name":"sort_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Column name to sort by (e.g. 'created_at', 'amount', 'name'). When changing sort, reset cursor to None.","title":"Sort By"},"description":"Column name to sort by (e.g. 'created_at', 'amount', 'name'). When changing sort, reset cursor to None."},{"name":"descending","in":"query","required":false,"schema":{"type":"boolean","description":"Sort direction: true for descending (newest/largest first), false for ascending","default":true,"title":"Descending"},"description":"Sort direction: true for descending (newest/largest first), false for ascending"},{"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_AssociatedUserCursorListResponse_"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"list_business_users_api_v1_businesses_users_get"},"post":{"tags":["businesses"],"summary":"Add user to business","description":"Grant a user access to this business with a specified role.","operationId":"add_user_to_business","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessUserAddRequest"},"example":{"id":"019ab37c-05e7-7000-8000-000000000001","role":"member"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_AddUserToBusinessResponse_"}}}},"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"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_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":"add_user_to_business_api_v1_businesses_users_post"}},"/api/v1/businesses/source-accounts":{"get":{"tags":["businesses"],"summary":"Get source accounts","description":"List source accounts for the business, including Plaid-linked and manually uploaded.","operationId":"get_source_accounts","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_GenericListResponse_"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"get_source_accounts_api_v1_businesses_source_accounts_get"}},"/api/v1/businesses/auto-numbering":{"get":{"tags":["businesses"],"summary":"Get auto-numbering settings","description":"Get the current auto-numbering configuration for bills and invoices.","operationId":"get_auto_numbering_settings","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_AutoNumberingSettingsResponse_"}}}},"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_auto_numbering_settings_api_v1_businesses_auto_numbering_get"},"put":{"tags":["businesses"],"summary":"Update auto-numbering settings","description":"Configure automatic bill and invoice number generation.","operationId":"update_auto_numbering_settings","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoNumberingSettingsUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_AutoNumberingSettingsResponse_"}}}},"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":"update_auto_numbering_settings_api_v1_businesses_auto_numbering_put"}},"/api/v1/businesses/auto-numbering/preview":{"get":{"tags":["businesses"],"summary":"Preview next auto-generated numbers","description":"See what the next bill and invoice numbers would be without incrementing.","operationId":"preview_auto_numbering","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_AutoNumberingPreviewResponse_"}}}},"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":"preview_auto_numbering_api_v1_businesses_auto_numbering_preview_get"}},"/api/v1/businesses/slack/status":{"get":{"tags":["businesses"],"summary":"Get Slack integration status","description":"Check whether a Slack webhook is configured for this business.","operationId":"get_slack_status","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_SlackIntegrationStatus_"}}}},"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_slack_status_api_v1_businesses_slack_status_get"}},"/api/v1/businesses/slack":{"put":{"tags":["businesses"],"summary":"Save Slack webhook URL","description":"Configure a Slack Incoming Webhook URL for this business.","operationId":"save_business_slack_webhook","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SlackWebhookSaveRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_SlackIntegrationStatus_"}}}},"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":"save_business_slack_webhook_api_v1_businesses_slack_put"}},"/api/v1/businesses/slack/{webhook_id}/preferences":{"put":{"tags":["businesses"],"summary":"Update Slack notification preferences","description":"Toggle which notification categories are sent to Slack.","operationId":"update_slack_notification_preferences","parameters":[{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string","title":"Webhook 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/SlackPreferencesUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_SlackIntegrationStatus_"}}}},"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":"update_slack_notification_preferences_api_v1_businesses_slack__webhook_id__preferences_put"}},"/api/v1/businesses/slack/{webhook_id}/test":{"post":{"tags":["businesses"],"summary":"Test Slack webhook","description":"Send a test message to the business's configured Slack webhook.","operationId":"test_business_slack_webhook","parameters":[{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string","title":"Webhook 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_SlackTestSendResult_"}}}},"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":"test_business_slack_webhook_api_v1_businesses_slack__webhook_id__test_post"}},"/api/v1/businesses/slack/test":{"post":{"tags":["businesses"],"summary":"Test Slack webhook","description":"Send a test message to the business's first configured Slack webhook (legacy).","operationId":"test_business_slack_webhook_legacy","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_SlackTestSendResult_"}}}},"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":"test_business_slack_webhook_legacy_api_v1_businesses_slack_test_post"}},"/api/v1/businesses/slack/{webhook_id}":{"delete":{"tags":["businesses"],"summary":"Disconnect Slack","description":"Remove the business's Slack webhook URL.","operationId":"disconnect_business_slack","parameters":[{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string","title":"Webhook 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_SlackDisconnectResult_"}}}},"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":"disconnect_business_slack_api_v1_businesses_slack__webhook_id__delete"}},"/api/v1/businesses/invoice-settings":{"get":{"tags":["businesses"],"summary":"Get invoice branding settings","description":"Get invoice branding configuration including footer text and logo sync status.","operationId":"get_invoice_settings","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_InvoiceSettingsResponse_"}}}},"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_invoice_settings_api_v1_businesses_invoice_settings_get"},"patch":{"tags":["businesses"],"summary":"Update invoice branding settings","description":"Update the default footer text shown on invoice PDFs.","operationId":"update_invoice_settings","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceSettingsUpdateRequest"},"example":{"invoice_footer":"Thank you for your business. Payment is due within 30 days.","payment_details":{"account_name":"Acme Coffee Roasters LLC","account_number":"000123456789","bank_name":"First Example Bank","routing_number":"021000021"}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_InvoiceSettingsResponse_"}}}},"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":"update_invoice_settings_api_v1_businesses_invoice_settings_patch"}},"/api/v1/businesses/plaid-transaction-settings":{"get":{"tags":["businesses"],"summary":"Get Plaid pending-transaction settings","description":"Whether this business ingests & displays Plaid pending (unsettled) transactions as a read-only awareness layer.","operationId":"get_plaid_transaction_settings","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_PlaidTransactionSettingsResponse_"}}}},"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_plaid_transaction_settings_api_v1_businesses_plaid_transaction_settings_get"},"patch":{"tags":["businesses"],"summary":"Update Plaid pending-transaction settings","description":"Enable or disable ingesting & displaying Plaid pending transactions. Pending rows are financially inert (no journal entries) until they settle. Local accounting engine only.","operationId":"update_plaid_transaction_settings","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlaidTransactionSettingsUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_PlaidTransactionSettingsResponse_"}}}},"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":"update_plaid_transaction_settings_api_v1_businesses_plaid_transaction_settings_patch"}},"/api/v1/businesses/invoice-settings/sync-logo":{"post":{"tags":["businesses"],"summary":"Sync logo to Stripe branding","description":"Upload the business logo to Stripe for invoice branding.","operationId":"sync_logo_to_stripe","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_SyncLogoBrandingResponse_"}}}},"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":"sync_logo_to_stripe_api_v1_businesses_invoice_settings_sync_logo_post"}},"/api/v1/businesses/{business_id}":{"get":{"tags":["businesses"],"summary":"Get business","description":"Retrieve full business details including integrations and settings.","operationId":"get_business","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_BusinessResponse_"}}}},"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_business_api_v1_businesses__business_id__get"},"put":{"tags":["businesses"],"summary":"Update business","description":"Update business details.\n\nThis endpoint supports updating standard business information including:\n- Business name, mailbox, properties\n- Stripe account ID\n- Shopify integration details\n- Stripe subscription items (subscription_items)\n\n**Note:** This endpoint updates business details only.\n\nArgs:\n    business_id (str): The ID of the business to update.\n    payload (BusinessUpdateRequest): The updated business details.\n\nReturns:\n    BusinessResponse: The updated business details.","operationId":"update_business","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/BusinessUpdateRequest"},"example":{"accounting_basis":"accrual","default_currency":"USD","name":"Acme Coffee Roasters","tax_year_end_month":12}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_BusinessResponse_"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"update_business_api_v1_businesses__business_id__put"},"delete":{"tags":["businesses"],"summary":"Delete business","description":"Schedule the deletion of a business after the grace period.\n\n**Safety:** requires a JSON body with ``confirm_name`` matching the\nbusiness's name (case-insensitive, trimmed) and a recent Clerk\nre-verification of the caller (step-up).\n\n**Effect:** nothing is deleted now. The business is scheduled for\npermanent deletion ``BUSINESS_DELETION_GRACE_DAYS`` (default 30) days\nfrom now, as the privacy page promises, and the owners are emailed.\nUntil then the business stays readable, owners and admins can export\neverything (``POST /businesses/{business_id}/data-exports``) or cancel\n(``POST /businesses/{business_id}/deletion/cancel``), and background\nsyncs and scheduled jobs stop. Asking again keeps the original date.\n\n**After the grace period** the nightly sweep runs the hard delete:\nthird-party grants are revoked (Plaid, QuickBooks, Xero, Shopify,\nSquare, Finch...), every business row, S3 object version and AI memory\nis deleted. That part is irreversible.\n\n**Returns:** 202 with ``deletion_scheduled_for`` in ``data``.","operationId":"delete_business","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/BusinessDeleteRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__core__success__MessageResponse"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"delete_business_api_v1_businesses__business_id__delete"}},"/api/v1/businesses/{business_id}/sync":{"get":{"tags":["businesses"],"summary":"Get sync status","description":"Get the current account sync status for a business. Lightweight endpoint for polling.","operationId":"get_business_sync_status","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_SyncStatus_"}}}},"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_business_sync_status_api_v1_businesses__business_id__sync_get"}},"/api/v1/businesses/{business_id}/income-statement":{"get":{"tags":["businesses"],"summary":"Get income statement (sectioned)","description":"Income statement grouped by section. Each section contains ledger line items with period values as top-level keys.","operationId":"get_income_statement","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"start_date","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"Start date (YYYY-MM-DD)","title":"Start Date"},"description":"Start date (YYYY-MM-DD)"},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"End date (YYYY-MM-DD)","title":"End Date"},"description":"End date (YYYY-MM-DD)"},{"name":"hide_zero_rows","in":"query","required":false,"schema":{"type":"boolean","description":"Exclude line items with all-zero values","default":false,"title":"Hide Zero Rows"},"description":"Exclude line items with all-zero values"},{"name":"period_granularity","in":"query","required":false,"schema":{"type":"string","description":"Period grouping: monthly, quarterly, yearly, or total (one column for the whole range, keyed `start_date/end_date`)","default":"monthly","title":"Period Granularity"},"description":"Period grouping: monthly, quarterly, yearly, or total (one column for the whole range, keyed `start_date/end_date`)"},{"name":"tag_ids","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"},"description":"Filter by tag UUIDs — only line entries tagged with at least one of these tags are included","default":[],"title":"Tag Ids"},"description":"Filter by tag UUIDs — only line entries tagged with at least one of these tags are included"},{"name":"basis","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Accounting basis: `accrual` or `cash`. Defaults to the business's configured basis (accrual unless changed). Cash basis recognises invoice revenue and bill expense when paid, not when issued.","title":"Basis"},"description":"Accounting basis: `accrual` or `cash`. Defaults to the business's configured basis (accrual unless changed). Cash basis recognises invoice revenue and bill expense when paid, not when issued."},{"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_GetIncomeStatementResponse_"}}}},"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_income_statement_api_v1_businesses__business_id__income_statement_get"}},"/api/v1/businesses/{business_id}/income-statement-flat":{"get":{"tags":["businesses"],"summary":"Get income statement (flat)","description":"Pre-flattened income statement rows for display. No transformation needed.","operationId":"get_income_statement_flat","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"start_date","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"Start date (YYYY-MM-DD)","title":"Start Date"},"description":"Start date (YYYY-MM-DD)"},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"End date (YYYY-MM-DD)","title":"End Date"},"description":"End date (YYYY-MM-DD)"},{"name":"hide_zero_rows","in":"query","required":false,"schema":{"type":"boolean","description":"Exclude line items with all-zero values","default":false,"title":"Hide Zero Rows"},"description":"Exclude line items with all-zero values"},{"name":"basis","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Accounting basis: `accrual` or `cash`. Defaults to the business's configured basis (accrual unless changed). Cash basis recognises invoice revenue and bill expense when paid, not when issued.","title":"Basis"},"description":"Accounting basis: `accrual` or `cash`. Defaults to the business's configured basis (accrual unless changed). Cash basis recognises invoice revenue and bill expense when paid, not when issued."},{"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_GetIncomeStatementFlatResponse_"}}}},"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_income_statement_flat_api_v1_businesses__business_id__income_statement_flat_get"}},"/api/v1/businesses/{business_id}/ledger/{ledger_id}/vendor-breakdown":{"get":{"tags":["businesses"],"summary":"Get vendor/counterparty breakdown for a ledger account","description":"Returns vendors/counterparties that contributed to a ledger account total in the given date range, with amounts and percentages.","operationId":"get_ledger_vendor_breakdown","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"ledger_id","in":"path","required":true,"schema":{"type":"string","title":"Ledger Id"}},{"name":"start_date","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"Start date (YYYY-MM-DD)","title":"Start Date"},"description":"Start date (YYYY-MM-DD)"},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"End date (YYYY-MM-DD)","title":"End Date"},"description":"End date (YYYY-MM-DD)"},{"name":"cash_flow","in":"query","required":false,"schema":{"type":"boolean","description":"When true, restrict to cash-touching journal entries and use cash flow sign convention","default":false,"title":"Cash Flow"},"description":"When true, restrict to cash-touching journal entries and use cash flow sign convention"},{"name":"basis","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Accounting basis: `accrual` or `cash`. Defaults to the business's configured basis (accrual unless changed). Cash basis recognises invoice revenue and bill expense when paid, not when issued.","title":"Basis"},"description":"Accounting basis: `accrual` or `cash`. Defaults to the business's configured basis (accrual unless changed). Cash basis recognises invoice revenue and bill expense when paid, not when issued."},{"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_GetLedgerVendorBreakdownResponse_"}}}},"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_ledger_vendor_breakdown_api_v1_businesses__business_id__ledger__ledger_id__vendor_breakdown_get"}},"/api/v1/businesses/{business_id}/ledger/{ledger_id}/vendor-period-matrix":{"get":{"tags":["businesses"],"summary":"Get vendor breakdown across all periods for a ledger","description":"Returns vendor/counterparty breakdown with per-period amounts for pivot-table display.","operationId":"get_ledger_vendor_period_matrix","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"ledger_id","in":"path","required":true,"schema":{"type":"string","title":"Ledger Id"}},{"name":"start_date","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"Start date (YYYY-MM-DD)","title":"Start Date"},"description":"Start date (YYYY-MM-DD)"},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"End date (YYYY-MM-DD)","title":"End Date"},"description":"End date (YYYY-MM-DD)"},{"name":"period_granularity","in":"query","required":false,"schema":{"type":"string","description":"monthly, quarterly, or yearly","default":"monthly","title":"Period Granularity"},"description":"monthly, quarterly, or yearly"},{"name":"cash_flow","in":"query","required":false,"schema":{"type":"boolean","description":"When true, restrict to cash-touching journal entries and use cash flow sign convention","default":false,"title":"Cash Flow"},"description":"When true, restrict to cash-touching journal entries and use cash flow sign convention"},{"name":"basis","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Accounting basis: `accrual` or `cash`. Defaults to the business's configured basis (accrual unless changed). Cash basis recognises invoice revenue and bill expense when paid, not when issued.","title":"Basis"},"description":"Accounting basis: `accrual` or `cash`. Defaults to the business's configured basis (accrual unless changed). Cash basis recognises invoice revenue and bill expense when paid, not when issued."},{"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_GetLedgerVendorPeriodMatrixResponse_"}}}},"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_ledger_vendor_period_matrix_api_v1_businesses__business_id__ledger__ledger_id__vendor_period_matrix_get"}},"/api/v1/businesses/{business_id}/ledger/{ledger_id}/vendor-transactions":{"get":{"tags":["businesses"],"summary":"Get individual transactions for a vendor within a ledger","description":"Returns individual line entries for a specific counterparty within a ledger and date range.","operationId":"get_ledger_vendor_transactions","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"ledger_id","in":"path","required":true,"schema":{"type":"string","title":"Ledger Id"}},{"name":"counterparty_name","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"Counterparty/vendor name","title":"Counterparty Name"},"description":"Counterparty/vendor name"},{"name":"start_date","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"Start date (YYYY-MM-DD)","title":"Start Date"},"description":"Start date (YYYY-MM-DD)"},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"End date (YYYY-MM-DD)","title":"End Date"},"description":"End date (YYYY-MM-DD)"},{"name":"basis","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Accounting basis: `accrual` or `cash`. Defaults to the business's configured basis (accrual unless changed). Cash basis recognises invoice revenue and bill expense when paid, not when issued.","title":"Basis"},"description":"Accounting basis: `accrual` or `cash`. Defaults to the business's configured basis (accrual unless changed). Cash basis recognises invoice revenue and bill expense when paid, not when issued."},{"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_GetLedgerVendorTransactionsResponse_"}}}},"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_ledger_vendor_transactions_api_v1_businesses__business_id__ledger__ledger_id__vendor_transactions_get"}},"/api/v1/businesses/{business_id}/ledger/{ledger_id}/statement":{"get":{"tags":["businesses"],"summary":"Get ledger statement for a date range","description":"Returns beginning balance, transactions within the range, and ending balance for a specific ledger account.","operationId":"get_ledger_statement","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"ledger_id","in":"path","required":true,"schema":{"type":"string","title":"Ledger Id"}},{"name":"start_date","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"Start date (YYYY-MM-DD)","title":"Start Date"},"description":"Start date (YYYY-MM-DD)"},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"End date (YYYY-MM-DD)","title":"End Date"},"description":"End date (YYYY-MM-DD)"},{"name":"basis","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Accounting basis: `accrual` or `cash`. Defaults to the business's configured basis (accrual unless changed). Cash basis recognises invoice revenue and bill expense when paid, not when issued.","title":"Basis"},"description":"Accounting basis: `accrual` or `cash`. Defaults to the business's configured basis (accrual unless changed). Cash basis recognises invoice revenue and bill expense when paid, not when issued."},{"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_GetLedgerStatementResponse_"}}}},"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_ledger_statement_api_v1_businesses__business_id__ledger__ledger_id__statement_get"}},"/api/v1/businesses/{business_id}/reports/cash-basis/unapplied":{"get":{"tags":["businesses"],"summary":"List cash-basis unapplied settlements","description":"Customer receipts and vendor payments booked against AR/AP that the cash-basis view could not trace to an invoice or bill. On the cash basis they are recognised as Uncategorized Income / Expense; this list lets the user find and match them. Amounts in cents.","operationId":"get_cash_basis_unapplied","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"start_date","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"Start date (YYYY-MM-DD)","title":"Start Date"},"description":"Start date (YYYY-MM-DD)"},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"End date (YYYY-MM-DD)","title":"End Date"},"description":"End date (YYYY-MM-DD)"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_GetCashBasisUnappliedResponse_"}}}},"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":"get_cash_basis_unapplied_api_v1_businesses__business_id__reports_cash_basis_unapplied_get"}},"/api/v1/businesses/{business_id}/reports/cash-basis/bridge":{"get":{"tags":["businesses"],"summary":"Accrual to cash-basis net income bridge","description":"Accrual net income, cash-basis net income and the rows that decompose the difference (invoices not yet collected, collections recognised, bills not yet paid, bill payments recognised, unapplied receipts / payments, rounding, period close). Amounts in cents; row amounts are the effect on net income.","operationId":"get_cash_basis_bridge","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"start_date","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"Start date (YYYY-MM-DD)","title":"Start Date"},"description":"Start date (YYYY-MM-DD)"},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"End date (YYYY-MM-DD)","title":"End Date"},"description":"End date (YYYY-MM-DD)"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_GetCashBasisBridgeResponse_"}}}},"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":"get_cash_basis_bridge_api_v1_businesses__business_id__reports_cash_basis_bridge_get"}},"/api/v1/businesses/{business_id}/line-entries/recategorize":{"patch":{"tags":["businesses"],"summary":"Recategorize line entries","description":"Move line entries to a different ledger. Used for journal-entry lines that have no bank transaction.","operationId":"recategorize_line_entries","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/RecategorizeLineEntriesRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_RecategorizeLineEntriesResponse_"}}}},"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":"recategorize_line_entries_api_v1_businesses__business_id__line_entries_recategorize_patch"}},"/api/v1/businesses/{business_id}/balance-sheet":{"get":{"tags":["businesses"],"summary":"Get balance sheet (sectioned)","description":"Balance sheet grouped by section (Assets, Liabilities, Equity). Each section contains ledger line items with ledger_id, ledger_name, sort_code, and total_amount.","operationId":"get_balance_sheet","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"as_of_date","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"As-of date (YYYY-MM-DD)","title":"As Of Date"},"description":"As-of date (YYYY-MM-DD)"},{"name":"hide_zero_rows","in":"query","required":false,"schema":{"type":"boolean","description":"Exclude line items with a zero balance","default":false,"title":"Hide Zero Rows"},"description":"Exclude line items with a zero balance"},{"name":"period_granularity","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Optional period grouping: monthly, quarterly, or yearly. When set, requires start_date and adds one as-of balance per period end between start_date and as_of_date.","title":"Period Granularity"},"description":"Optional period grouping: monthly, quarterly, or yearly. When set, requires start_date and adds one as-of balance per period end between start_date and as_of_date."},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Start date (YYYY-MM-DD); required when period_granularity is set","title":"Start Date"},"description":"Start date (YYYY-MM-DD); required when period_granularity is set"},{"name":"basis","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Accounting basis: `accrual` or `cash`. Defaults to the business's configured basis (accrual unless changed). Cash basis recognises invoice revenue and bill expense when paid, not when issued.","title":"Basis"},"description":"Accounting basis: `accrual` or `cash`. Defaults to the business's configured basis (accrual unless changed). Cash basis recognises invoice revenue and bill expense when paid, not when issued."},{"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_GetBalanceSheetResponse_"}}}},"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_balance_sheet_api_v1_businesses__business_id__balance_sheet_get"}},"/api/v1/businesses/{business_id}/trial-balance":{"get":{"tags":["businesses"],"summary":"Get trial balance","description":"Trial balance listing every ledger account with debit and credit balances as of a point-in-time date. All amounts in cents.","operationId":"get_trial_balance","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"as_of_date","in":"query","required":true,"schema":{"type":"string","minLength":1,"description":"As-of date (YYYY-MM-DD)","title":"As Of Date"},"description":"As-of date (YYYY-MM-DD)"},{"name":"hide_zero_rows","in":"query","required":false,"schema":{"type":"boolean","description":"Exclude accounts with zero debit and credit balances","default":false,"title":"Hide Zero Rows"},"description":"Exclude accounts with zero debit and credit balances"},{"name":"basis","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Accounting basis: `accrual` or `cash`. Defaults to the business's configured basis (accrual unless changed). Cash basis recognises invoice revenue and bill expense when paid, not when issued.","title":"Basis"},"description":"Accounting basis: `accrual` or `cash`. Defaults to the business's configured basis (accrual unless changed). Cash basis recognises invoice revenue and bill expense when paid, not when issued."},{"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_GetTrialBalanceResponse_"}}}},"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_trial_balance_api_v1_businesses__business_id__trial_balance_get"}},"/api/v1/businesses/{business_id}/cash-flow-statement":{"get":{"tags":["businesses"],"summary":"Get cash flow statement","description":"Cash flow statement (indirect method) grouped by operating, investing, and financing activities. The operating section walks Net Income through non-cash add-backs and working-capital changes to Net Cash from Operating Activities. Includes ASC 230 supplemental disclosures and §5 validation results. All amounts in cents.","operationId":"get_cash_flow_statement","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"start_date","in":"query","required":true,"schema":{"type":"string","format":"date","description":"Start date (YYYY-MM-DD)","title":"Start Date"},"description":"Start date (YYYY-MM-DD)"},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","format":"date","description":"End date (YYYY-MM-DD)","title":"End Date"},"description":"End date (YYYY-MM-DD)"},{"name":"hide_zero_rows","in":"query","required":false,"schema":{"type":"boolean","description":"Exclude line items with zero cash impact","default":false,"title":"Hide Zero Rows"},"description":"Exclude line items with zero cash impact"},{"name":"basis","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Accounting basis: `accrual` or `cash`. Defaults to the business's configured basis. On the cash basis Net Income is cash-basis net income and AR/AP carry no balance.","title":"Basis"},"description":"Accounting basis: `accrual` or `cash`. Defaults to the business's configured basis. On the cash basis Net Income is cash-basis net income and AR/AP carry no balance."},{"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_GetCashFlowStatementResponse_"}}}},"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":"get_cash_flow_statement_api_v1_businesses__business_id__cash_flow_statement_get"}},"/api/v1/businesses/{business_id}/cash-flow-statement/periodic":{"get":{"tags":["businesses"],"summary":"Get cash flow statements for multiple periods","description":"Batch endpoint returning a cash flow statement for each period in the requested date range. Avoids N round-trips for monthly, quarterly and yearly views. All amounts in cents.","operationId":"get_cash_flow_statements_periodic","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"start_date","in":"query","required":true,"schema":{"type":"string","format":"date","description":"Start date (YYYY-MM-DD)","title":"Start Date"},"description":"Start date (YYYY-MM-DD)"},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","format":"date","description":"End date (YYYY-MM-DD)","title":"End Date"},"description":"End date (YYYY-MM-DD)"},{"name":"grouping","in":"query","required":false,"schema":{"type":"string","pattern":"^(monthly|quarterly|yearly)$","description":"Period grouping: 'monthly', 'quarterly' or 'yearly'","default":"monthly","title":"Grouping"},"description":"Period grouping: 'monthly', 'quarterly' or 'yearly'"},{"name":"hide_zero_rows","in":"query","required":false,"schema":{"type":"boolean","description":"Exclude line items with zero cash impact","default":false,"title":"Hide Zero Rows"},"description":"Exclude line items with zero cash impact"},{"name":"basis","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Accounting basis: `accrual` or `cash`. Defaults to the business's configured basis. On the cash basis Net Income is cash-basis net income and AR/AP carry no balance.","title":"Basis"},"description":"Accounting basis: `accrual` or `cash`. Defaults to the business's configured basis. On the cash basis Net Income is cash-basis net income and AR/AP carry no balance."},{"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_GetCashFlowStatementsPeriodicResponse_"}}}},"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":"get_cash_flow_statements_periodic_api_v1_businesses__business_id__cash_flow_statement_periodic_get"}},"/api/v1/businesses/{business_id}/cash-flow-statement/outflow-breakdown":{"get":{"tags":["businesses"],"summary":"Top categories and vendors by cash outflow","description":"Returns the top N ledger categories and counterparties that powered cash outflows during the requested period, ranked by absolute cash leaving. Powers the 'Where the cash went' tile on /books/cash-flow.","operationId":"get_cash_flow_outflow_breakdown","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"start_date","in":"query","required":true,"schema":{"type":"string","format":"date","description":"Start date (YYYY-MM-DD)","title":"Start Date"},"description":"Start date (YYYY-MM-DD)"},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","format":"date","description":"End date (YYYY-MM-DD)","title":"End Date"},"description":"End date (YYYY-MM-DD)"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"description":"Max rows per list (categories and vendors are returned separately)","default":5,"title":"Limit"},"description":"Max rows per list (categories and vendors are returned separately)"},{"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_GetCashFlowOutflowBreakdownResponse_"}}}},"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":"get_cash_flow_outflow_breakdown_api_v1_businesses__business_id__cash_flow_statement_outflow_breakdown_get"}},"/api/v1/businesses/{business_id}/income-statement/analyze":{"post":{"tags":["businesses"],"summary":"AI analysis of income statement","description":"Uses AI to analyze the income statement for the given period and return structured insights.","operationId":"analyze_income_statement","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/AnalyzeIncomeStatementRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_AnalyzeIncomeStatementResponse_"}}}},"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":"analyze_income_statement_api_v1_businesses__business_id__income_statement_analyze_post"}},"/api/v1/businesses/{business_id}/balance-sheet/analyze":{"post":{"tags":["businesses"],"summary":"AI analysis of balance sheet","description":"Uses AI to analyze the balance sheet as of a given date and return structured insights.","operationId":"analyze_balance_sheet","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/AnalyzeBalanceSheetRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_AnalyzeBalanceSheetResponse_"}}}},"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":"analyze_balance_sheet_api_v1_businesses__business_id__balance_sheet_analyze_post"}},"/api/v1/businesses/{business_id}/cash-flow/analyze":{"post":{"tags":["businesses"],"summary":"AI analysis of cash flow statement","description":"Uses AI to analyze the cash flow statement for the given period and return structured insights.","operationId":"analyze_cash_flow","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/AnalyzeCashFlowRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_AnalyzeCashFlowResponse_"}}}},"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":"analyze_cash_flow_api_v1_businesses__business_id__cash_flow_analyze_post"}},"/api/v1/businesses/entries-start":{"put":{"tags":["businesses"],"summary":"Update entries start date","description":"Set the date from which accounting entries should begin.","operationId":"update_entries_start","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateEntriesStartRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_UpdateEntriesStartResponse_"}}}},"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":"update_entries_start_api_v1_businesses_entries_start_put"}},"/api/v1/businesses/{business_id}/mailbox":{"post":{"tags":["businesses"],"summary":"Provision inbound mailbox","description":"Mint an inbound mailbox slug for a business that has none, so vendor bills can be forwarded to its AP inbox. Idempotent: a business that already has a mailbox gets it back unchanged (never overwritten).","operationId":"provision_business_mailbox","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_BusinessMailboxProvisionResponse_"}}}},"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":"provision_business_mailbox_api_v1_businesses__business_id__mailbox_post"}},"/api/v1/businesses/{business_id}/stripe-subscription":{"put":{"tags":["businesses"],"summary":"Update Stripe subscription","description":"Link a Stripe subscription to a business.","operationId":"update_stripe_subscription","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/UpdateStripeSubscriptionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_UpdateStripeSubscriptionResponse_"}}}},"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":"update_stripe_subscription_api_v1_businesses__business_id__stripe_subscription_put"}},"/api/v1/businesses/users/{user_id}":{"put":{"tags":["businesses"],"summary":"Update user role","description":"Change a user's access level and/or sidebar section visibility in this business.","operationId":"update_user_role_in_business","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User 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/BusinessUserRoleUpdateRequest"},"example":{"role":"accountant","visible_sections":["accounts_payable","banking"]}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_UpdateUserRoleInBusinessResponse_"}}}},"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":"update_user_role_in_business_api_v1_businesses_users__user_id__put"},"delete":{"tags":["businesses"],"summary":"Remove user from business","description":"Remove a user from a specific business.\n\nIMPORTANT: This endpoint removes the user-business association ONLY.\nThe user record itself remains in the database and can still be associated with other businesses.\n\nThe business's last owner cannot be removed (400) — transfer ownership\nfirst so the business is never left without an owner.\n\nTo completely delete a user from the system, use DELETE /users/{user_id} instead.","operationId":"remove_user_from_business","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User 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"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"remove_user_from_business_api_v1_businesses_users__user_id__delete"}},"/api/v1/businesses/users/{user_id}/role":{"get":{"tags":["businesses"],"summary":"Get user role","description":"Check a user's access level in this business.","operationId":"get_user_role_in_business","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User 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_GetUserRoleInBusinessResponse_"}}}},"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_user_role_in_business_api_v1_businesses_users__user_id__role_get"}},"/api/v1/businesses/{business_id}/deletion":{"get":{"tags":["businesses"],"summary":"Get business deletion schedule","description":"Whether the business is scheduled for deletion, and when.","operationId":"get_business_deletion_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_BusinessDeletionStatusResponse_"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"get_business_deletion_schedule_api_v1_businesses__business_id__deletion_get"}},"/api/v1/businesses/{business_id}/deletion/cancel":{"post":{"tags":["businesses"],"summary":"Cancel scheduled business deletion","description":"Cancel a scheduled deletion before the grace period ends.","operationId":"cancel_business_deletion","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_BusinessDeletionStatusResponse_"}}}},"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"}}}},"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"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"cancel_business_deletion_api_v1_businesses__business_id__deletion_cancel_post"}},"/api/v1/businesses/{business_id}/data-exports":{"post":{"tags":["businesses"],"summary":"Request full business data export","description":"Start an export of all business data as a zip of CSV files.","operationId":"request_business_data_export","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":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_BusinessDataExportResponse_"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"request_business_data_export_api_v1_businesses__business_id__data_exports_post"}},"/api/v1/businesses/{business_id}/data-exports/latest":{"get":{"tags":["businesses"],"summary":"Get latest business data export","description":"The most recent full export of the business (no link).","operationId":"get_latest_business_data_export","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_BusinessDataExportResponse_"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"get_latest_business_data_export_api_v1_businesses__business_id__data_exports_latest_get"}},"/api/v1/businesses/{business_id}/data-exports/{export_id}":{"get":{"tags":["businesses"],"summary":"Get business data export","description":"One export; includes a short-lived download link when ready.","operationId":"get_business_data_export","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"export_id","in":"path","required":true,"schema":{"type":"string","title":"Export 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_BusinessDataExportResponse_"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"get_business_data_export_api_v1_businesses__business_id__data_exports__export_id__get"}},"/api/v1/businesses/{business_id}/trial-balance/diff":{"get":{"tags":["businesses"],"summary":"Trial balance movement between two dates","description":"Per ledger: balance at the end of the day before `from_date`, balance at `to_date`, and the movement. Debit-positive cents.","operationId":"get_trial_balance_diff","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"name":"from_date","in":"query","required":true,"schema":{"type":"string","description":"First day of the window","title":"From Date"},"description":"First day of the window"},{"name":"to_date","in":"query","required":true,"schema":{"type":"string","description":"Last day of the window","title":"To Date"},"description":"Last day of the window"},{"name":"basis","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"`accrual` or `cash`; defaults to the business's basis.","title":"Basis"},"description":"`accrual` or `cash`; defaults to the business's basis."},{"name":"hide_zero_rows","in":"query","required":false,"schema":{"type":"boolean","description":"Omit ledgers with no opening or closing balance","default":true,"title":"Hide Zero Rows"},"description":"Omit ledgers with no opening or closing balance"},{"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_GetTrialBalanceDiffResponse_"}}}},"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":"get_trial_balance_diff_api_v1_businesses__business_id__trial_balance_diff_get"}},"/api/v1/businesses/{business_id}/trial-balance/bridge":{"post":{"tags":["businesses"],"summary":"Compare another system's trial balance with ours","description":"Read-only. Matches each external account to a ledger and gives every ledger a verdict: tied, intentional, offsetting_swing or unexplained.","operationId":"compare_trial_balance_bridge","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/TrialBalanceBridgeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_TrialBalanceBridgeResponse_"}}}},"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":"compare_trial_balance_bridge_api_v1_businesses__business_id__trial_balance_bridge_post"}}},"components":{"schemas":{"AccountSchema":{"properties":{"plaid_account_id":{"type":"string","title":"Plaid Account Id","description":"Plaid's unique account ID."},"ledger_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ledger Id","description":"Linked ledger UUID in chart of accounts."},"external_source_account_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Source Account Id","description":"Accounting-system source account ID."},"balance":{"$ref":"#/components/schemas/BalanceSchema","description":"Current account balances."},"mask":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mask","description":"Last 4 digits of account number (e.g., '1234')."},"name":{"type":"string","title":"Name","description":"Account name from the bank."},"official_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Official Name","description":"Official account name from the bank."},"subtype":{"type":"string","title":"Subtype","description":"Account subtype (e.g., 'checking', 'savings', 'credit card')."},"type":{"type":"string","title":"Type","description":"Account type: depository, credit, loan, investment."},"last_synced":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Synced","description":"When transactions were last synced."},"business_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Id","description":"Business UUID."},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At","description":"When account was linked."},"error_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Code","description":"Plaid error code if sync failed."},"error":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Error","description":"Error details if sync failed."},"is_linked":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Linked","description":"Whether account is saved in our database."},"superseded_by_item_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Superseded By Item Id","description":"Set when this account sits on a Plaid connection that is no longer active and the same real account (institution, mask and subtype) is linked on another live connection of the business; the value is that connection's id. Shown as Replaced rather than Unlinked."},"linked_via_item_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Linked Via Item Id","description":"Set when this connection reports an account that is linked to a ledger through another live connection of the business; the value is that connection's id. The account is not stored under this connection. POST /plaid/account/move moves the link here."},"linked_via_institution_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Linked Via Institution Name","description":"Institution name of the connection in linked_via_item_id."}},"additionalProperties":true,"type":"object","required":["plaid_account_id","balance","name","subtype","type"],"title":"AccountSchema","description":"Schema for a bank account connected via Plaid.\n\nRepresents a single bank account (checking, savings, credit card, etc.)\nthat is linked to the business through a Plaid connection.\n\n**Account Types:**\n- `depository`: Checking, savings accounts\n- `credit`: Credit cards\n- `loan`: Loans, mortgages\n- `investment`: Brokerage, retirement accounts","example":{"balance":{"available":1523450,"current":1548200,"iso_currency_code":"USD"},"business_id":"019ab37c-b051-7000-8000-000000000001","external_source_account_id":"local_src_xyz789","is_linked":true,"last_synced":"2024-01-15T14:00:00Z","ledger_id":"019ab37c-1ed1-7000-8000-000000000001","mask":"1234","name":"Chase Business Checking","official_name":"CHASE BUSINESS COMPLETE CHECKING","plaid_account_id":"plaid_acc_abc123","subtype":"checking","type":"depository"},"examples":[{"balance":{"available":1523450,"current":1548200,"iso_currency_code":"USD"},"business_id":"019ab37c-b051-7000-8000-000000000001","external_source_account_id":"local_src_xyz789","is_linked":true,"last_synced":"2024-01-15T14:00:00Z","ledger_id":"019ab37c-1ed1-7000-8000-000000000001","mask":"1234","name":"Chase Business Checking","official_name":"CHASE BUSINESS COMPLETE CHECKING","plaid_account_id":"plaid_acc_abc123","subtype":"checking","type":"depository"}]},"AddUserToBusinessResponse":{"properties":{"business_id":{"type":"string","title":"Business Id"},"user_id":{"type":"string","title":"User Id"},"role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Role"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"hidden":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Hidden","description":"True when the membership is hidden from the business's own users."}},"additionalProperties":true,"type":"object","required":["business_id","user_id"],"title":"AddUserToBusinessResponse","description":"Envelope data for ``add_user_to_business``."},"AnalyzeBalanceSheetRequest":{"properties":{"basis":{"anyOf":[{"type":"string","enum":["accrual","cash"]},{"type":"null"}],"title":"Basis","description":"Accounting basis: accrual (default) or cash."},"as_of_date":{"type":"string","title":"As Of Date","description":"As-of date (YYYY-MM-DD)"}},"type":"object","required":["as_of_date"],"title":"AnalyzeBalanceSheetRequest","description":"Request body for ``analyze_balance_sheet``."},"AnalyzeBalanceSheetResponse":{"properties":{"summary":{"type":"string","title":"Summary"},"insights":{"items":{"$ref":"#/components/schemas/FinancialInsight"},"type":"array","title":"Insights"},"generated_at":{"type":"string","title":"Generated At"}},"additionalProperties":true,"type":"object","required":["summary","insights","generated_at"],"title":"AnalyzeBalanceSheetResponse","description":"Response for ``analyze_balance_sheet``."},"AnalyzeCashFlowRequest":{"properties":{"start_date":{"type":"string","title":"Start Date","description":"Start date (YYYY-MM-DD)"},"end_date":{"type":"string","title":"End Date","description":"End date (YYYY-MM-DD)"},"basis":{"anyOf":[{"type":"string","enum":["accrual","cash"]},{"type":"null"}],"title":"Basis","description":"Accounting basis: accrual (default) or cash."}},"type":"object","required":["start_date","end_date"],"title":"AnalyzeCashFlowRequest","description":"Request body for ``analyze_cash_flow``."},"AnalyzeCashFlowResponse":{"properties":{"summary":{"type":"string","title":"Summary"},"insights":{"items":{"$ref":"#/components/schemas/FinancialInsight"},"type":"array","title":"Insights"},"generated_at":{"type":"string","title":"Generated At"}},"additionalProperties":true,"type":"object","required":["summary","insights","generated_at"],"title":"AnalyzeCashFlowResponse","description":"Response for ``analyze_cash_flow``."},"AnalyzeIncomeStatementRequest":{"properties":{"basis":{"anyOf":[{"type":"string","enum":["accrual","cash"]},{"type":"null"}],"title":"Basis","description":"Accounting basis: accrual (default) or cash."},"start_date":{"type":"string","title":"Start Date","description":"Start date (YYYY-MM-DD)"},"end_date":{"type":"string","title":"End Date","description":"End date (YYYY-MM-DD)"}},"type":"object","required":["start_date","end_date"],"title":"AnalyzeIncomeStatementRequest","description":"Request body for ``analyze_income_statement``."},"AnalyzeIncomeStatementResponse":{"properties":{"summary":{"type":"string","title":"Summary"},"insights":{"items":{"$ref":"#/components/schemas/FinancialInsight"},"type":"array","title":"Insights"},"generated_at":{"type":"string","title":"Generated At"}},"additionalProperties":true,"type":"object","required":["summary","insights","generated_at"],"title":"AnalyzeIncomeStatementResponse","description":"Response for ``analyze_income_statement``."},"AssociatedUserCursorListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AssociatedUserResponse"},"type":"array","title":"Items","description":"List of items"},"total":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total","description":"Total number of items (null when not calculated for performance)"},"limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit","description":"Pagination limit"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor","description":"Cursor for next page"},"prev_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prev Cursor","description":"Cursor for previous page"},"has_next":{"type":"boolean","title":"Has Next","description":"Whether there are more items"},"has_prev":{"type":"boolean","title":"Has Prev","description":"Whether there are previous items"}},"type":"object","required":["items","has_next","has_prev"],"title":"AssociatedUserCursorListResponse","description":"Paginated list of associated users with cursor-based navigation."},"AssociatedUserResponse":{"properties":{"email":{"type":"string","title":"Email","description":"User email address (unique identifier)."},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Name","description":"User's first name."},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Name","description":"User's last name."},"photo_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Photo Url","description":"URL to user's profile photo."},"onboarded":{"type":"boolean","title":"Onboarded","description":"Whether user has completed onboarding.","default":false},"props":{"additionalProperties":true,"type":"object","title":"Props","description":"Additional user properties/settings."},"id":{"type":"string","title":"Id","description":"User UUID."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Account creation timestamp."},"updated_at":{"type":"string","format":"date-time","title":"Updated At","description":"Last profile update timestamp."},"firm_ids":{"items":{"type":"string"},"type":"array","title":"Firm Ids","description":"Advisory firm UUIDs the user belongs to."},"role":{"$ref":"#/components/schemas/Role","description":"Role: owner, admin, member, or viewer"},"source":{"$ref":"#/components/schemas/UserSource","description":"Source of association: business_user (direct) or advisor_user (via advisory firm)."},"visible_sections":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Visible Sections","description":"Sidebar section keys visible to this user for this business. null = all sections visible (default). Empty list = none visible. Opaque strings owned by the frontend; UI-level visibility only (not a data authorization control)."}},"type":"object","required":["email","id","created_at","updated_at","role","source"],"title":"AssociatedUserResponse","description":"Response schema for a user associated with a business.\n\nIncludes the user's role and source indicating whether they are a direct\nbusiness user or an advisor firm user.","example":{"created_at":"2024-01-10T10:30:00Z","email":"john.doe@example.com","firm_ids":[],"first_name":"John","id":"019ab37c-05e7-7000-8000-000000000001","last_name":"Doe","onboarded":true,"photo_url":"https://example.com/photos/john.jpg","props":{"timezone":"America/Los_Angeles"},"updated_at":"2024-01-15T14:00:00Z"},"examples":[{"created_at":"2024-01-10T10:30:00Z","email":"john.doe@example.com","firm_ids":[],"first_name":"John","id":"019ab37c-05e7-7000-8000-000000000001","last_name":"Doe","onboarded":true,"photo_url":"https://example.com/photos/john.jpg","props":{"timezone":"America/Los_Angeles"},"updated_at":"2024-01-15T14:00:00Z"}]},"AutoNumberingPreviewResponse":{"properties":{"next_bill_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Bill Number","description":"Preview of next bill number (e.g., 'BILL-0001'). None if auto-numbering disabled."},"next_invoice_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Invoice Number","description":"Preview of next invoice number (e.g., 'INV-0001'). None if auto-numbering disabled."},"next_journal_entry_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Journal Entry Number","description":"Preview of next journal entry number (e.g., 'JE-0001')."}},"type":"object","title":"AutoNumberingPreviewResponse","description":"Response schema for previewing next auto-generated numbers."},"AutoNumberingSettingsResponse":{"properties":{"auto_number_bills":{"type":"boolean","title":"Auto Number Bills","description":"Whether automatic bill numbering is enabled"},"auto_number_invoices":{"type":"boolean","title":"Auto Number Invoices","description":"Whether automatic invoice numbering is enabled"},"bill_number_prefix":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Bill Number Prefix","description":"Prefix for auto-generated bill numbers (e.g., 'BILL-')"},"invoice_number_prefix":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Number Prefix","description":"Prefix for auto-generated invoice numbers (e.g., 'INV-')"},"next_bill_number":{"type":"integer","title":"Next Bill Number","description":"Next sequential number for bill auto-numbering"},"next_invoice_number":{"type":"integer","title":"Next Invoice Number","description":"Next sequential number for invoice auto-numbering"},"journal_entry_number_prefix":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Journal Entry Number Prefix","description":"Prefix for auto-generated journal entry numbers (e.g., 'JE-')"},"next_journal_entry_number":{"type":"integer","title":"Next Journal Entry Number","description":"Next sequential number for journal entry auto-numbering"}},"type":"object","required":["auto_number_bills","auto_number_invoices","next_bill_number","next_invoice_number","next_journal_entry_number"],"title":"AutoNumberingSettingsResponse","description":"Response schema for auto-numbering configuration."},"AutoNumberingSettingsUpdateRequest":{"properties":{"auto_number_bills":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Auto Number Bills","description":"Enable/disable automatic bill numbering"},"auto_number_invoices":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Auto Number Invoices","description":"Enable/disable automatic invoice numbering"},"bill_number_prefix":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Bill Number Prefix","description":"Prefix for auto-generated bill numbers (e.g., 'BILL-', '2024-'). Max 20 chars."},"invoice_number_prefix":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Invoice Number Prefix","description":"Prefix for auto-generated invoice numbers (e.g., 'INV-', '2024-'). Max 20 chars."},"next_bill_number":{"anyOf":[{"type":"integer","minimum":1.0},{"type":"null"}],"title":"Next Bill Number","description":"Set next bill number (minimum 1). Useful when migrating from another system."},"next_invoice_number":{"anyOf":[{"type":"integer","minimum":1.0},{"type":"null"}],"title":"Next Invoice Number","description":"Set next invoice number (minimum 1). Useful when migrating from another system."},"journal_entry_number_prefix":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Journal Entry Number Prefix","description":"Prefix for auto-generated journal entry numbers (e.g., 'JE-'). Max 20 chars."},"next_journal_entry_number":{"anyOf":[{"type":"integer","minimum":1.0},{"type":"null"}],"title":"Next Journal Entry Number","description":"Set next journal entry number (minimum 1). Useful when migrating."}},"type":"object","title":"AutoNumberingSettingsUpdateRequest","description":"Request schema for updating auto-numbering settings.\n\nAll fields are optional - only fields provided will be updated."},"BalanceSchema":{"properties":{"available":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Available","description":"Available balance in cents (what can be spent now)."},"current":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Current","description":"Current balance in cents (includes pending transactions)."},"iso_currency_code":{"type":"string","title":"Iso Currency Code","description":"ISO 4217 currency code (e.g., 'USD')."},"limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit","description":"Credit limit in cents (for credit cards)."},"unofficial_currency_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unofficial Currency Code","description":"Unofficial currency code if ISO code unavailable."},"is_available":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Is Available","description":"Whether available balance is reported (0 or 1)."}},"additionalProperties":true,"type":"object","required":["iso_currency_code"],"title":"BalanceSchema","description":"Schema for a bank account balance from Plaid.\n\nAmounts are in cents (e.g., 150000 = $1,500.00).","example":{"available":1523450,"current":1548200,"is_available":1,"iso_currency_code":"USD"},"examples":[{"available":1523450,"current":1548200,"is_available":1,"iso_currency_code":"USD"}]},"BalanceSheetRow":{"properties":{"ledger_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ledger Id"},"ledger_name":{"type":"string","title":"Ledger Name"},"sort_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sort Code"},"sub_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sub Type"},"parent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Id"},"total_amount":{"type":"integer","title":"Total Amount"}},"additionalProperties":true,"type":"object","required":["ledger_name","total_amount"],"title":"BalanceSheetRow","description":"Ledger row within a balance-sheet section."},"BalanceSheetSectionBlock":{"properties":{"section":{"type":"string","title":"Section"},"total_amount":{"type":"integer","title":"Total Amount"},"rows":{"items":{"$ref":"#/components/schemas/BalanceSheetRow"},"type":"array","title":"Rows"}},"additionalProperties":true,"type":"object","required":["section","total_amount","rows"],"title":"BalanceSheetSectionBlock","description":"Assets / Liabilities / Equity section."},"BridgeLedgerRow":{"properties":{"ledger_id":{"type":"string","title":"Ledger Id"},"account_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Number"},"name":{"type":"string","title":"Name"},"type":{"type":"string","title":"Type"},"sort_code":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sort Code"},"external_accounts":{"items":{"type":"string"},"type":"array","title":"External Accounts"},"matched_by":{"type":"string","enum":["mapping","account_number","name","normalised_name"],"title":"Matched By"},"ours_cents":{"type":"integer","title":"Ours Cents"},"theirs_cents":{"type":"integer","title":"Theirs Cents"},"delta_cents":{"type":"integer","title":"Delta Cents","description":"ours - theirs."},"verdict":{"type":"string","enum":["tied","intentional","offsetting_swing","unexplained"],"title":"Verdict"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"intentional_amount_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Intentional Amount Cents"},"remaining_delta_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Remaining Delta Cents"},"prior_delta_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Prior Delta Cents"},"swing_net_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Swing Net Cents"}},"type":"object","required":["ledger_id","name","type","external_accounts","matched_by","ours_cents","theirs_cents","delta_cents","verdict"],"title":"BridgeLedgerRow"},"BridgeLedgerWithoutExternal":{"properties":{"ledger_id":{"type":"string","title":"Ledger Id"},"account_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Number"},"name":{"type":"string","title":"Name"},"type":{"type":"string","title":"Type"},"ours_cents":{"type":"integer","title":"Ours Cents"}},"type":"object","required":["ledger_id","name","type","ours_cents"],"title":"BridgeLedgerWithoutExternal"},"BridgeUnmappedRow":{"properties":{"account":{"type":"string","title":"Account"},"balance_cents":{"type":"integer","title":"Balance Cents"},"reason":{"type":"string","enum":["no_match","ambiguous"],"title":"Reason"},"candidates":{"items":{"additionalProperties":{"type":"string"},"type":"object"},"type":"array","title":"Candidates"}},"type":"object","required":["account","balance_cents","reason"],"title":"BridgeUnmappedRow"},"BridgeVerdictTotals":{"properties":{"count":{"type":"integer","title":"Count"},"ours_cents":{"type":"integer","title":"Ours Cents"},"theirs_cents":{"type":"integer","title":"Theirs Cents"},"delta_cents":{"type":"integer","title":"Delta Cents"}},"type":"object","required":["count","ours_cents","theirs_cents","delta_cents"],"title":"BridgeVerdictTotals"},"BusinessCreateRequest":{"properties":{"accounting_basis":{"anyOf":[{"type":"string","enum":["cash","accrual"]},{"type":"null"}],"title":"Accounting Basis","description":"Default accounting basis financial reports open on: 'accrual' or 'cash'. Omit for accrual."},"name":{"type":"string","title":"Name","description":"Business display name."},"default_currency":{"type":"string","title":"Default Currency","description":"Default currency for the business (USD, CAD, AUD, EUR, or GBP).","default":"USD"},"tax_year_end_month":{"type":"integer","maximum":12.0,"minimum":1.0,"title":"Tax Year End Month","description":"Month when the tax/fiscal year ends (1-12). Default 12 = calendar year.","default":12},"mailbox":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mailbox","description":"Unique email prefix for bill forwarding. Auto-generated from the business name when omitted."},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id","description":"UUID of the user who will own this business. Optional for admin-created businesses."},"coa_template_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Coa Template Id","description":"Pre-built chart of accounts template ID. Mutually exclusive with custom_coa_template."},"custom_coa_template":{"anyOf":[{"$ref":"#/components/schemas/CustomCoaTemplate"},{"type":"null"}],"description":"Custom chart of accounts definition. Mutually exclusive with coa_template_id."},"entries_start":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entries Start","description":"Date from which to start importing transactions (YYYY-MM-DD)."},"firm_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Firm Id","description":"Advisory firm UUID to link this business to."},"stripe_account_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Account Id","description":"Stripe Connect account ID."},"stripe_subscription_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Subscription Id","description":"Stripe subscription ID for billing."},"stripe_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Customer Id","description":"Stripe customer ID (e.g., cus_xxx)."},"subscription_items":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Subscription Items","description":"Stripe subscription items/products linked to this business."},"accounting_engine_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Accounting Engine Type","description":"Accounting engine: 'local' (DayZero, default), or null (inherit from firm)."},"trial_ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Trial Ends At","description":"UTC expiry of the free trial. Omit for the standard 30-day trial."},"billing_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Status","description":"Initial billing state (trialing, active, ...). Omit for trialing."},"plan_tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plan Tier","description":"Plan tier (free, self_directed, managed, firm_client, grandfathered)."},"active_addons":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Active Addons","description":"Paid add-on slugs to enable from day one."}},"additionalProperties":false,"type":"object","required":["name"],"title":"BusinessCreateRequest","description":"Request schema for creating a new business.\n\nCreates a business entity and associates it with a user as the owner.\n\n**Chart of Accounts Options:**\n- Use `coa_template_id` for pre-built templates\n- Use `custom_coa_template` for custom chart of accounts\n- These options are mutually exclusive","example":{"coa_template_id":"standard_accrual","entries_start":"2024-01-01","mailbox":"acme","name":"Acme Corporation","user_id":"019ab37c-05e7-7000-8000-000000000001"},"examples":[{"coa_template_id":"standard_accrual","entries_start":"2024-01-01","mailbox":"acme","name":"Acme Corporation","user_id":"019ab37c-05e7-7000-8000-000000000001"}]},"BusinessCursorListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/BusinessResponse"},"type":"array","title":"Items","description":"List of items"},"total":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total","description":"Total number of items (null when not calculated for performance)"},"limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit","description":"Pagination limit"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor","description":"Cursor for next page"},"prev_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prev Cursor","description":"Cursor for previous page"},"has_next":{"type":"boolean","title":"Has Next","description":"Whether there are more items"},"has_prev":{"type":"boolean","title":"Has Prev","description":"Whether there are previous items"}},"type":"object","required":["items","has_next","has_prev"],"title":"BusinessCursorListResponse","description":"Schema for list of businesses response (cursor-based pagination)."},"BusinessDataExportResponse":{"properties":{"export_id":{"type":"string","title":"Export Id"},"business_id":{"type":"string","title":"Business Id"},"status":{"type":"string","title":"Status","description":"`pending`, `ready`, `failed` or `expired`."},"requested_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Requested At"},"completed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Completed At"},"download_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Download Url","description":"Presigned download link, only on the single-export endpoint when `status` is `ready`. Short-lived; request the export again for a fresh link."},"download_url_expires_in":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Download Url Expires In","description":"Seconds until `download_url` stops working."},"file_expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Expires At","description":"When the export file itself is deleted (UTC)."},"row_counts":{"anyOf":[{"additionalProperties":{"type":"integer"},"type":"object"},{"type":"null"}],"title":"Row Counts","description":"Rows written per CSV file."},"size_bytes":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Size Bytes"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["export_id","business_id","status"],"title":"BusinessDataExportResponse","description":"One full-business export (zip of CSVs) and, when ready, a download link."},"BusinessDeleteRequest":{"properties":{"confirm_password":{"anyOf":[{"type":"string","format":"password","writeOnly":true},{"type":"null"}],"title":"Confirm Password","description":"Deprecated and ignored. Retained so clients sending the old body keep working during rollout. Step-up is now proven by Clerk re-verification (an emailed code, or the account's own factor), which works for SSO accounts that have no password.","deprecated":true},"business_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Id"},"confirm_name":{"type":"string","minLength":1,"title":"Confirm Name","description":"Exact business name as a typed confirmation. Must match the persisted business name (case-insensitive, trimmed). Required."},"preserve_dz_users":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Preserve Dz Users"}},"type":"object","required":["confirm_name"],"title":"BusinessDeleteRequest","description":"Request body for irreversible business deletion.\n\nTwo gates, both required:\n\n- ``confirm_name`` MUST echo the business's name (case-insensitive,\n  trimmed). The backend rejects any delete whose ``confirm_name`` doesn't\n  match, which prevents single-click muscle-memory mistakes from wiping a\n  business and ~80 tables of dependent data.\n- ``confirm_password`` MUST be the caller's own account password,\n  re-verified against Clerk so an unattended session can't do this."},"BusinessDeletionStatusResponse":{"properties":{"business_id":{"type":"string","title":"Business Id"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"scheduled":{"type":"boolean","title":"Scheduled","description":"True while a deletion is scheduled (the grace period runs)."},"deletion_requested_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Deletion Requested At","description":"When the deletion was requested (UTC, ISO 8601)."},"deletion_scheduled_for":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Deletion Scheduled For","description":"When the business is permanently deleted (UTC)."},"deletion_requested_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Deletion Requested By","description":"User who requested the deletion."},"grace_days":{"type":"integer","title":"Grace Days","description":"Configured grace period in days."},"days_remaining":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Days Remaining","description":"Whole days left before the hard delete."},"can_cancel":{"type":"boolean","title":"Can Cancel","description":"Whether the deletion can still be cancelled."},"already_scheduled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Already Scheduled","description":"On schedule requests: true when a deletion was already scheduled (the existing date is kept)."}},"type":"object","required":["business_id","scheduled","grace_days","can_cancel"],"title":"BusinessDeletionStatusResponse","description":"Whether (and when) a business is scheduled for deletion."},"BusinessMailboxProvisionResponse":{"properties":{"mailbox":{"type":"string","title":"Mailbox","description":"Inbound mailbox slug (local part)."},"inbox_email":{"type":"string","title":"Inbox Email","description":"Full forwarding address for the AP inbox, composed from the slug and the environment's inbound email domain."},"created":{"type":"boolean","title":"Created","description":"True when this call minted the slug; False when it already existed."}},"type":"object","required":["mailbox","inbox_email","created"],"title":"BusinessMailboxProvisionResponse","description":"Response for ``provision_business_mailbox``.\n\nReturned whether the call minted a new slug or the business already had\none — the endpoint is idempotent and never overwrites an existing mailbox."},"BusinessResponse":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id","description":"Business UUID."},"firm_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Firm Id","description":"Advisory firm UUID this business belongs to."},"mailbox":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mailbox","description":"Email prefix for bill forwarding."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Business name."},"name_aliases":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Name Aliases","description":"Other names the business goes by."},"logo_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Logo Url","description":"URL to business logo/avatar image."},"default_currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Currency","description":"Default currency for the business (USD, CAD, AUD, EUR, or GBP)."},"tax_year_end_month":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tax Year End Month","description":"Month when the tax/fiscal year ends (1-12). 12 = calendar year."},"accounting_basis":{"anyOf":[{"type":"string","enum":["cash","accrual"]},{"type":"null"}],"title":"Accounting Basis","description":"Default accounting basis financial reports open on: 'accrual' or 'cash'. Null means accrual."},"start_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start Date","description":"Date the business started operating (founding date). Distinct from entries_start, which anchors bookkeeping imports."},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone","description":"IANA time zone the business keeps its days in; null = not set."},"tax_year_display":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Year Display","description":"Human-readable tax year description (e.g., 'Calendar Year (Jan-Dec)')."},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At","description":"Creation timestamp."},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At","description":"Last update timestamp."},"entries_start":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Entries Start","description":"Start date for transaction imports."},"stripe_account_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Account Id","description":"Connected Stripe account ID."},"stripe_subscription_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Subscription Id","description":"Stripe subscription ID."},"stripe_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Customer Id","description":"Stripe customer ID."},"subscription_items":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Subscription Items","description":"Stripe subscription items/products linked to this business."},"shopify_shop_domain":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Shopify Shop Domain","description":"Connected Shopify domain."},"shopify_access_token_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Shopify Access Token Id","description":"Shopify token UUID."},"ramp_connection_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ramp Connection Id","description":"Ramp connection UUID."},"square_connection_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Square Connection Id","description":"Square connection UUID."},"finch_connection_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Finch Connection Id","description":"Finch payroll connection UUID."},"hubspot_connection_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hubspot Connection Id","description":"HubSpot connection UUID."},"plaid_connections":{"anyOf":[{"items":{"$ref":"#/components/schemas/PlaidConnectionSchema"},"type":"array"},{"type":"null"}],"title":"Plaid Connections","description":"Connected bank accounts via Plaid."},"slack_connected":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Slack Connected","description":"Whether a Slack webhook URL is configured."},"sync":{"anyOf":[{"$ref":"#/components/schemas/SyncStatus"},{"type":"null"}],"description":"Account sync status."},"inventory_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Inventory Mode","description":"Inventory module flavor: 'cpg' or 'finished_goods'."},"ap_approval_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Ap Approval Enabled","description":"Whether the AP bill approval workflow is enabled for this business. When off (default), bills post directly to 'received'."},"ap_due_date_basis":{"anyOf":[{"type":"string","enum":["invoice_date","received_date"]},{"type":"null"}],"title":"Ap Due Date Basis","description":"Which date vendor-bill payment terms count from on ingest: 'invoice_date' (default, trust the invoice) or 'received_date' (terms run from the day the business received the bill)."},"ar_subledger_mode":{"anyOf":[{"type":"string","enum":["off","per_customer"]},{"type":"null"}],"title":"Ar Subledger Mode","description":"Where invoice and payment journal entries post the receivable: 'off' (one Accounts Receivable) or 'per_customer' (an 'AR - <Customer Name>' child ledger of Accounts Receivable)."},"auto_link_new_counterparties":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Auto Link New Counterparties","description":"Whether NEW customers and vendors are linked to the counterparty registry automatically. On by default."},"auto_rename_counterparties":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Auto Rename Counterparties","description":"Whether automated counterparty re-resolution is enabled for transactions that already have a counterparty assigned. On by default. Manually-set counterparties are always protected regardless of this setting."},"stripe_payout_sibling_matching":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Stripe Payout Sibling Matching","description":"Whether an unmatched Stripe payout may be matched to a deposit in a sibling business with no Stripe account. null = only when the firm has exactly one such sibling."},"agent_close_business_day":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Agent Close Business Day","description":"Business day of the month (1-23, -1 = last) the Agent window starts closing the month that just ended; null = off."}},"additionalProperties":true,"type":"object","title":"BusinessResponse","description":"Response schema for a business.\n\nContains all business details including connected integrations\nand sync status with the accounting system.","example":{"created_at":"2024-01-10T10:30:00Z","entries_start":"2024-01-01T00:00:00Z","firm_id":"019ab37c-f123-7000-8000-000000000001","id":"019ab37c-b051-7000-8000-000000000001","mailbox":"acme","name":"Acme Corporation","plaid_connections":[],"shopify_shop_domain":"acme-store.myshopify.com","stripe_account_id":"acct_abc123","sync":{"last_synced":"2024-01-15T14:00:00Z","status":"completed"},"updated_at":"2024-01-15T14:00:00Z"},"examples":[{"created_at":"2024-01-10T10:30:00Z","entries_start":"2024-01-01T00:00:00Z","firm_id":"019ab37c-f123-7000-8000-000000000001","id":"019ab37c-b051-7000-8000-000000000001","mailbox":"acme","name":"Acme Corporation","plaid_connections":[],"shopify_shop_domain":"acme-store.myshopify.com","stripe_account_id":"acct_abc123","sync":{"last_synced":"2024-01-15T14:00:00Z","status":"completed"},"updated_at":"2024-01-15T14:00:00Z"}]},"BusinessUpdateRequest":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Business display name."},"name_aliases":{"anyOf":[{"items":{"type":"string"},"type":"array","maxItems":20},{"type":"null"}],"title":"Name Aliases","description":"Other names the business goes by (up to 20). find_business matches them as well as the name. Replaces the list; send [] to clear it."},"logo_url":{"anyOf":[{"type":"string","maxLength":1024},{"type":"null"}],"title":"Logo Url","description":"URL to business logo/avatar image (https only)."},"default_currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Currency","description":"Default currency for the business (USD, CAD, AUD, EUR, or GBP)."},"tax_year_end_month":{"anyOf":[{"type":"integer","maximum":12.0,"minimum":1.0},{"type":"null"}],"title":"Tax Year End Month","description":"Month when the tax/fiscal year ends (1-12)."},"start_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start Date","description":"Date the business started operating (founding date). Distinct from entries_start, which anchors bookkeeping imports."},"timezone":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Timezone","description":"IANA time zone the business keeps its days in, e.g. 'America/New_York'. null clears it."},"accounting_basis":{"anyOf":[{"type":"string","enum":["cash","accrual"]},{"type":"null"}],"title":"Accounting Basis","description":"Default accounting basis for financial reports: 'cash' or 'accrual'. Persisted on the business."},"mailbox":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mailbox","description":"Email prefix for bill forwarding."},"inventory_mode":{"anyOf":[{"type":"string","enum":["cpg","finished_goods"]},{"type":"null"}],"title":"Inventory Mode","description":"Inventory module flavor: 'cpg' exposes the Supply Chain map, production recipes, and landed COGS; 'finished_goods' hides the CPG-only surfaces."},"ap_approval_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Ap Approval Enabled","description":"Toggle the AP bill approval workflow for this business. When off (default), bills post directly to 'received'. When on, bills route through 'pending_approval' and only post to the GL once approved."},"ap_due_date_basis":{"anyOf":[{"type":"string","enum":["invoice_date","received_date"]},{"type":"null"}],"title":"Ap Due Date Basis","description":"Which date vendor-bill payment terms count from for bills that arrive via the AP inbox or upload. 'invoice_date' (default) keeps the due date printed on the invoice. 'received_date' runs the terms (vendor default, else business default, else the span the invoice itself implies) from the day the bill was received, so an invoice dated weeks before it reached you isn't created overdue. Applies to bills ingested after the change; existing bills are not rewritten."},"ar_subledger_mode":{"anyOf":[{"type":"string","enum":["off","per_customer"]},{"type":"null"}],"title":"Ar Subledger Mode","description":"Where invoice and payment journal entries post the receivable. 'off' (default) uses the one Accounts Receivable ledger. 'per_customer' posts each customer's receivable to its own 'AR - <Customer Name>' child ledger of Accounts Receivable (created on first use, or an existing 'AR - X' ledger is adopted). Applies to entries posted after the change; run POST /ar/subledgers/backfill to move historical entries."},"auto_link_new_counterparties":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Auto Link New Counterparties","description":"Toggle automatic registry linking for NEW customers and vendors (creation hooks, identity layer, nightly sweep). On by default. Turn off to keep new masters unlinked until a person links them; existing links are untouched."},"auto_rename_counterparties":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Auto Rename Counterparties","description":"Toggle automated counterparty re-resolution for transactions that already have a counterparty assigned. On by default. Turn off to stop description edits and the tenant-wide regen from re-deriving counterparty names on existing rows. Manually-set counterparties are always protected regardless of this setting."},"stripe_payout_sibling_matching":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Stripe Payout Sibling Matching","description":"Match a Stripe payout with no deposit in this business to a Stripe-looking deposit in a sibling business of the same firm that has no Stripe account. null (default) = on only when the firm has exactly one such sibling; true/false force it."},"agent_close_business_day":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Agent Close Business Day","description":"Business day of the month (1-23, -1 = the last one) on which the Agent window starts closing the month that just ended: DayZero sends close.window_opened that day (Fed bank-holiday calendar, New York date). null or 0 turns it off."}},"additionalProperties":false,"type":"object","title":"BusinessUpdateRequest","description":"Public API schema for updating a business.\n\nOnly fields that a business admin should be able to change via the API\nare listed here.  Integration and billing fields (stripe_*, billing_status,\nplan_tier, active_addons, etc.) are managed by webhooks / internal services\nand are intentionally excluded.","example":{"accounting_basis":"accrual","default_currency":"USD","name":"Acme Coffee Roasters","tax_year_end_month":12},"examples":[{"accounting_basis":"accrual","default_currency":"USD","name":"Acme Coffee Roasters","tax_year_end_month":12}]},"BusinessUserAddRequest":{"properties":{"id":{"type":"string","title":"Id","description":"UUID of the user to add."},"role":{"anyOf":[{"$ref":"#/components/schemas/Role"},{"type":"null"}],"description":"Role: owner, admin, member, or viewer","default":"member"}},"type":"object","required":["id"],"title":"BusinessUserAddRequest","description":"Request schema for adding a user to a business.\n\nThe user must already exist in the system.\nSee ROLE_ABILITIES_DOC in app.models.user_businesses for detailed role descriptions.\nValid roles: owner, admin, member, viewer.","example":{"id":"019ab37c-05e7-7000-8000-000000000001","role":"member"},"examples":[{"id":"019ab37c-05e7-7000-8000-000000000001","role":"member"}]},"BusinessUserRoleUpdateRequest":{"properties":{"role":{"$ref":"#/components/schemas/Role","description":"Role: owner, admin, member, or viewer"},"visible_sections":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Visible Sections","description":"Sidebar section keys visible to this user for this business. null = all sections visible (default). Empty list = none visible. Opaque strings owned by the frontend; UI-level visibility only (not a data authorization control). Omit this field entirely to leave visibility unchanged."}},"type":"object","required":["role"],"title":"BusinessUserRoleUpdateRequest","description":"Request schema for updating a user's role in a business.\n\n``visible_sections`` is optional and only updated when explicitly\nincluded in the request body (omit it to leave visibility unchanged;\npass ``null`` to reset to \"all sections visible\").","example":{"role":"accountant","visible_sections":["accounts_payable","banking"]},"examples":[{"role":"accountant","visible_sections":["accounts_payable","banking"]}]},"CashBasisBridgeRow":{"properties":{"key":{"type":"string","enum":["unpaid_invoices_removed","invoice_collections_recognised","unpaid_bills_removed","bill_payments_recognised","unapplied_receipts","unapplied_payments","rounding","period_close","unexplained"],"title":"Key","description":"Stable row identifier"},"label":{"type":"string","title":"Label","description":"Human-readable row label"},"amount_cents":{"type":"integer","title":"Amount Cents","description":"Effect on net income in cents (positive increases net income)"},"description":{"type":"string","title":"Description","description":"What the row represents"}},"additionalProperties":true,"type":"object","required":["key","label","amount_cents","description"],"title":"CashBasisBridgeRow","description":"One line of the accrual → cash net income reconciliation."},"CashBasisUnappliedItem":{"properties":{"journal_entry_id":{"type":"string","title":"Journal Entry Id","description":"Settlement journal entry"},"date":{"type":"string","title":"Date","description":"Settlement date (YYYY-MM-DD)"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Journal entry description"},"control":{"type":"string","enum":["ar","ap"],"title":"Control","description":"Control account the settlement was booked against"},"amount_cents":{"type":"integer","title":"Amount Cents","description":"Unapplied residue in cents. Positive for a settlement in the normal direction (received against AR / paid against AP), negative for a reversal such as a refund."},"settled_cents":{"type":"integer","title":"Settled Cents","description":"Full AR/AP leg amount the residue came from (cents)"},"reason":{"type":"string","enum":["no_allocation","missing_template","overpayment","no_unapplied_ledger"],"title":"Reason","description":"Why it is unapplied: no_allocation (no invoice/bill payment row or link, or allocations cover less than the leg), missing_template (the document has no usable booking entry), overpayment (allocated more than the document total), no_unapplied_ledger (no Uncategorized Income/Expense ledger — residue stayed on AR/AP)."},"counterparty_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Counterparty Name","description":"Merchant / customer behind the bank transaction"},"transaction_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transaction Id","description":"Bank transaction behind the journal entry, if any"},"fallback_ledger_id":{"type":"string","title":"Fallback Ledger Id","description":"Ledger the residue is recognised on in the cash view"},"fallback_ledger_name":{"type":"string","title":"Fallback Ledger Name","description":"Display name of that ledger"},"document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Id","description":"Invoice / bill the settlement was allocated to, if any"},"document_type":{"anyOf":[{"type":"string","enum":["invoice","bill"]},{"type":"null"}],"title":"Document Type"}},"additionalProperties":true,"type":"object","required":["journal_entry_id","date","control","amount_cents","settled_cents","reason","fallback_ledger_id","fallback_ledger_name"],"title":"CashBasisUnappliedItem","description":"One settlement (journal entry × control account) with unapplied residue."},"CashFlowLedgerDetail":{"properties":{"ledger_id":{"type":"string","title":"Ledger Id","description":"Ledger UUID"},"ledger_name":{"type":"string","title":"Ledger Name","description":"Chart-of-accounts name"},"change":{"type":"integer","title":"Change","description":"This ledger's signed contribution to the row (cents)"}},"type":"object","required":["ledger_id","ledger_name","change"],"title":"CashFlowLedgerDetail","description":"One chart-of-accounts row contributing to a statement line item.\n\nThe ``change`` values of a line item's breakdown always sum to the\nline item's own ``change``, so exports can render the ledgers as\nindented children of the total without the two disagreeing."},"CashFlowLineItem":{"properties":{"ledger_id":{"type":"string","title":"Ledger Id","description":"Stable identifier for this row"},"ledger_name":{"type":"string","title":"Ledger Name","description":"Human label shown to the reader"},"external_ledger_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Ledger Id","description":"External ledger ID if this row corresponds to a single externally linked account; null for synthetic indirect-method rows."},"change":{"type":"integer","title":"Change","description":"Signed amount for this row in cents"},"cfs_class":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cfs Class","description":"Source ``cfs_class`` aggregation key for this row (e.g. 'ar', 'ppe'); null for opener / subtotal rows."},"ledger_breakdown":{"items":{"$ref":"#/components/schemas/CashFlowLedgerDetail"},"type":"array","title":"Ledger Breakdown","description":"Chart-of-accounts rows that make up this line. Their ``change`` values sum to this row's ``change``. Empty when the row has no ledger-level detail."}},"type":"object","required":["ledger_id","ledger_name","change"],"title":"CashFlowLineItem","description":"A single line on the Statement of Cash Flows.\n\nEach line has a stable string identifier (``ledger_id``) so the\nfrontend can key React components and treat synthetic rows\nconsistently with real-ledger rows. For indirect-method rows the\nid has the shape ``\"indirect:<key>\"`` (e.g. ``\"indirect:net_income\"``,\n``\"indirect:ar\"``, ``\"indirect:da\"``); for ledger-level rows it's\nthe ledger UUID. ``ledger_name`` is the human-readable label."},"CashFlowPeriodicPeriod":{"properties":{"start_date":{"type":"string","title":"Start Date"},"end_date":{"type":"string","title":"End Date"}},"additionalProperties":true,"type":"object","required":["start_date","end_date"],"title":"CashFlowPeriodicPeriod","description":"Date range for one periodic cash-flow statement."},"CashFlowSection":{"properties":{"name":{"type":"string","title":"Name","description":"Section name"},"line_items":{"items":{"$ref":"#/components/schemas/CashFlowLineItem"},"type":"array","title":"Line Items","description":"Line items in this section"},"total":{"type":"integer","title":"Total","description":"Net cash flow for this section (cents)","default":0}},"type":"object","required":["name"],"title":"CashFlowSection","description":"Operating / Investing / Financing section of the statement."},"CashFlowStatement":{"properties":{"business_id":{"type":"string","title":"Business Id","description":"Business ID"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name","description":"Business name"},"start_date":{"type":"string","format":"date","title":"Start Date","description":"Report start date"},"end_date":{"type":"string","format":"date","title":"End Date","description":"Report end date"},"generated_at":{"type":"string","format":"date-time","title":"Generated At","description":"When the report was generated"},"method":{"type":"string","const":"indirect","title":"Method","description":"Construction method. The indirect method is canonical.","default":"indirect"},"basis":{"type":"string","enum":["accrual","cash"],"title":"Basis","description":"Accounting basis the statement is built on. On the cash basis Net Income is cash-basis net income and AR/AP carry no balance.","default":"accrual"},"net_income":{"type":"integer","title":"Net Income","description":"Net Income (accrual) for the period in cents. Also appears as the first line item of ``operating_activities``."},"operating_activities":{"$ref":"#/components/schemas/CashFlowSection","description":"Section A — operating activities"},"investing_activities":{"$ref":"#/components/schemas/CashFlowSection","description":"Section B — investing activities"},"financing_activities":{"$ref":"#/components/schemas/CashFlowSection","description":"Section C — financing activities"},"net_cash_from_operating":{"type":"integer","title":"Net Cash From Operating","description":"Subtotal of Section A (cents)"},"net_cash_from_investing":{"type":"integer","title":"Net Cash From Investing","description":"Subtotal of Section B (cents)"},"net_cash_from_financing":{"type":"integer","title":"Net Cash From Financing","description":"Subtotal of Section C (cents)"},"net_change_in_cash":{"type":"integer","title":"Net Change In Cash","description":"Sum of Sections A+B+C (cents)"},"beginning_cash":{"type":"integer","title":"Beginning Cash","description":"Σ beginning natural balance for cfs_class='cash' (cents)"},"ending_cash":{"type":"integer","title":"Ending Cash","description":"Beginning cash + Net change in cash (cents)"},"supplemental_disclosures":{"$ref":"#/components/schemas/SupplementalDisclosures","description":"ASC 230 supplemental disclosures"},"validation_results":{"items":{"$ref":"#/components/schemas/CashFlowValidationResult"},"type":"array","title":"Validation Results","description":"Outcome of §5 validation rules"},"validation_passed":{"type":"boolean","title":"Validation Passed","description":"True iff every §5 validation rule passed","default":true},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings","description":"Non-fatal accuracy warnings. Validation failures are duplicated here so legacy callers that ignore ``validation_results`` still see the diagnostic."}},"type":"object","required":["business_id","start_date","end_date","net_income","operating_activities","investing_activities","financing_activities","net_cash_from_operating","net_cash_from_investing","net_cash_from_financing","net_change_in_cash","beginning_cash","ending_cash"],"title":"CashFlowStatement","description":"Indirect-method Statement of Cash Flows for one period.\n\nSection A (Operating) walks Net Income through non-cash add-backs\nand working-capital changes to Net Cash from Operating Activities.\nSections B (Investing) and C (Financing) carry the corresponding\nbalance deltas on long-term assets, debt, and equity. Section D\n(Reconciliation) is exposed as ``net_change_in_cash`` /\n``beginning_cash`` / ``ending_cash``.\n\nThe §5 validation results are attached so callers can render a\nPASS/FAIL banner without re-deriving the checks."},"CashFlowValidationResult":{"properties":{"rule":{"type":"string","title":"Rule","description":"Stable rule identifier"},"passed":{"type":"boolean","title":"Passed","description":"Whether the rule was satisfied"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Human-readable detail when the rule failed"}},"type":"object","required":["rule","passed"],"title":"CashFlowValidationResult","description":"Outcome of one §5 validation rule applied to a generated statement.\n\nA rule passes when its condition holds within the spec's tolerance\n(typically $1 / 100 cents). Failed rules carry a human-readable\nmessage that explains the gap and any remediation. The full list of\nrules is reported on every statement -- a \"PASS\" report shows them\nall green, a \"FAIL\" shows the failing ones with detail."},"CashOutflowCategory":{"properties":{"ledger_id":{"type":"string","title":"Ledger Id"},"ledger_name":{"type":"string","title":"Ledger Name"},"sub_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sub Type"},"ledger_type":{"type":"string","title":"Ledger Type"},"amount_cents":{"type":"integer","title":"Amount Cents"},"entry_count":{"type":"integer","title":"Entry Count"}},"additionalProperties":true,"type":"object","required":["ledger_id","ledger_name","ledger_type","amount_cents","entry_count"],"title":"CashOutflowCategory","description":"Ledger category ranked by cash outflow."},"CashOutflowVendor":{"properties":{"counterparty_name":{"type":"string","title":"Counterparty Name"},"vendor_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vendor Id"},"customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Id"},"amount_cents":{"type":"integer","title":"Amount Cents"},"entry_count":{"type":"integer","title":"Entry Count"}},"additionalProperties":true,"type":"object","required":["counterparty_name","amount_cents","entry_count"],"title":"CashOutflowVendor","description":"Counterparty ranked by cash outflow."},"CoaGenerateRequest":{"properties":{"business_description":{"type":"string","maxLength":2000,"minLength":10,"title":"Business Description","description":"Description of the business including industry, size, and accounting needs. E.g. 'Small e-commerce business selling handmade jewelry, accrual basis, US-based'"},"accounting_basis":{"anyOf":[{"type":"string","enum":["cash","accrual"]},{"type":"null"}],"title":"Accounting Basis","description":"Preferred accounting basis. If omitted, the AI will choose based on business description."},"currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Currency","description":"Primary currency (USD, CAD, AUD, EUR, or GBP).","default":"USD"},"include_inventory":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Include Inventory","description":"Whether to include inventory-related accounts (COGS, inventory assets, etc.).","default":false}},"type":"object","required":["business_description"],"title":"CoaGenerateRequest","description":"Request schema for AI-powered COA template generation.\n\nProvide a business description and the AI will generate a complete\nchart of accounts template that follows the platform's ledger constraints."},"CoaGenerateResponse":{"properties":{"template":{"$ref":"#/components/schemas/CustomCoaTemplate","description":"Generated COA template ready for use in business creation"},"accounting_basis":{"type":"string","title":"Accounting Basis","description":"The accounting basis used for this template (cash or accrual)"},"summary":{"type":"string","title":"Summary","description":"Brief AI explanation of the generated template and why accounts were chosen"},"ledger_count":{"type":"integer","title":"Ledger Count","description":"Number of ledgers in the generated template","default":0}},"type":"object","required":["template","accounting_basis","summary"],"title":"CoaGenerateResponse","description":"Response from the AI-powered COA template generation endpoint."},"CoaValidationError":{"properties":{"ledger_index":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Ledger Index","description":"0-based index of the ledger with the error (null for template-level errors)"},"ledger_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ledger Name","description":"Name of the ledger (if available)"},"field":{"type":"string","title":"Field","description":"Field that failed validation"},"message":{"type":"string","title":"Message","description":"Human-readable error description"}},"type":"object","required":["field","message"],"title":"CoaValidationError","description":"A single validation error within a COA template."},"CustomCoaLedger":{"properties":{"name":{"type":"string","minLength":1,"title":"Name","description":"Ledger name"},"type":{"type":"string","title":"Type","description":"Ledger type: asset, liability, equity, revenue, expense"},"sub_type":{"type":"string","title":"Sub Type","description":"Ledger sub-type: current_assets, non-current_assets, transfers_between_accounts, uncategorized_assets, current_liabilities, non-current_liabilities, equity, operating_revenues, other_income, cost_of_goods_sold, operating_expenses, other_expenses"},"sort_code":{"type":"string","maxLength":20,"title":"Sort Code","description":"Numeric sort code for ordering (digits only, max 20 chars)"},"debit_credit":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Debit Credit","description":"Debit/credit behavior: debit, credit. Optional - determined from the ledger type."},"report_cash_flow":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Report Cash Flow","description":"Include in cash flow reports. Optional."},"editable":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Editable","description":"Whether line entries can be manually added or removed","default":true},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Ledger description"},"financial_account_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Financial Account Type","description":"Financial account type for Templated Mode. Options: bank_account, credit_card, payments, payroll, loan, prepaid_card, accounts_receivable, accounts_payable"}},"type":"object","required":["name","type","sub_type","sort_code"],"title":"CustomCoaLedger","description":"Schema for a ledger definition in a custom COA template.\n\nOnly name, type, sub_type, and sort_code are required. debit_credit is\ndetermined from the ledger type."},"CustomCoaTemplate":{"properties":{"ledgers":{"items":{"$ref":"#/components/schemas/CustomCoaLedger"},"type":"array","minItems":1,"title":"Ledgers","description":"List of ledger definitions for the custom COA"}},"type":"object","required":["ledgers"],"title":"CustomCoaTemplate","description":"Schema for a custom COA template that defines all ledgers."},"ExternalTrialBalanceRow":{"properties":{"account":{"type":"string","title":"Account","description":"Account name or number in the other system."},"account_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Number"},"balance_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Balance Cents","description":"Debit minus credit. Send this or debit/credit."},"debit_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Debit Cents"},"credit_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Credit Cents"}},"additionalProperties":false,"type":"object","required":["account"],"title":"ExternalTrialBalanceRow","description":"One account of the other system's trial balance, debit-positive cents."},"FinancialInsight":{"properties":{"type":{"type":"string","enum":["variance","trend","ratio","alert","recommendation","anomaly"],"title":"Type"},"title":{"type":"string","title":"Title"},"description":{"type":"string","title":"Description"},"severity":{"type":"string","enum":["info","warning","critical"],"title":"Severity"},"section":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Section"}},"additionalProperties":true,"type":"object","required":["type","title","description","severity"],"title":"FinancialInsight","description":"Single AI insight from financial statement analysis."},"GenericListResponse":{"properties":{"data":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Data","description":"List of items"},"count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Count","description":"Total count of items"}},"type":"object","required":["data"],"title":"GenericListResponse","description":"Generic response for list operations."},"GetBalanceSheetResponse":{"items":{"$ref":"#/components/schemas/BalanceSheetSectionBlock"},"type":"array","title":"GetBalanceSheetResponse","description":"Sectioned balance sheet (list of section blocks)."},"GetCashBasisBridgeResponse":{"properties":{"start_date":{"type":"string","title":"Start Date"},"end_date":{"type":"string","title":"End Date"},"accrual_net_income_cents":{"type":"integer","title":"Accrual Net Income Cents"},"cash_net_income_cents":{"type":"integer","title":"Cash Net Income Cents"},"rows":{"items":{"$ref":"#/components/schemas/CashBasisBridgeRow"},"type":"array","title":"Rows"},"difference_cents":{"type":"integer","title":"Difference Cents","description":"cash_net_income_cents - accrual_net_income_cents"},"unexplained_cents":{"type":"integer","title":"Unexplained Cents","description":"difference_cents - sum(rows); 0 when ties is true","default":0},"ties":{"type":"boolean","title":"Ties","description":"True when the rows exactly explain the difference"}},"additionalProperties":true,"type":"object","required":["start_date","end_date","accrual_net_income_cents","cash_net_income_cents","difference_cents","ties"],"title":"GetCashBasisBridgeResponse","description":"Response for ``get_cash_basis_bridge`` (cents)."},"GetCashBasisUnappliedResponse":{"properties":{"basis":{"type":"string","const":"cash","title":"Basis","default":"cash"},"start_date":{"type":"string","title":"Start Date"},"end_date":{"type":"string","title":"End Date"},"total_unapplied_receipts_cents":{"type":"integer","title":"Total Unapplied Receipts Cents","description":"Sum of AR-side residue in the window (cents)"},"total_unapplied_payments_cents":{"type":"integer","title":"Total Unapplied Payments Cents","description":"Sum of AP-side residue in the window (cents)"},"count":{"type":"integer","title":"Count"},"items":{"items":{"$ref":"#/components/schemas/CashBasisUnappliedItem"},"type":"array","title":"Items","description":"Sorted by date desc, then amount desc"}},"additionalProperties":true,"type":"object","required":["start_date","end_date","total_unapplied_receipts_cents","total_unapplied_payments_cents","count"],"title":"GetCashBasisUnappliedResponse","description":"Response for ``get_cash_basis_unapplied`` (cents)."},"GetCashFlowOutflowBreakdownResponse":{"properties":{"categories":{"items":{"$ref":"#/components/schemas/CashOutflowCategory"},"type":"array","title":"Categories"},"vendors":{"items":{"$ref":"#/components/schemas/CashOutflowVendor"},"type":"array","title":"Vendors"},"total_outflow_cents":{"type":"integer","title":"Total Outflow Cents"},"start_date":{"type":"string","title":"Start Date"},"end_date":{"type":"string","title":"End Date"}},"additionalProperties":true,"type":"object","required":["categories","vendors","total_outflow_cents","start_date","end_date"],"title":"GetCashFlowOutflowBreakdownResponse","description":"Response for ``get_cash_flow_outflow_breakdown``."},"GetCashFlowStatementResponse":{"properties":{"business_id":{"type":"string","title":"Business Id","description":"Business ID"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name","description":"Business name"},"start_date":{"type":"string","format":"date","title":"Start Date","description":"Report start date"},"end_date":{"type":"string","format":"date","title":"End Date","description":"Report end date"},"generated_at":{"type":"string","format":"date-time","title":"Generated At","description":"When the report was generated"},"method":{"type":"string","const":"indirect","title":"Method","description":"Construction method. The indirect method is canonical.","default":"indirect"},"basis":{"type":"string","enum":["accrual","cash"],"title":"Basis","description":"Accounting basis the statement is built on. On the cash basis Net Income is cash-basis net income and AR/AP carry no balance.","default":"accrual"},"net_income":{"type":"integer","title":"Net Income","description":"Net Income (accrual) for the period in cents. Also appears as the first line item of ``operating_activities``."},"operating_activities":{"$ref":"#/components/schemas/CashFlowSection","description":"Section A — operating activities"},"investing_activities":{"$ref":"#/components/schemas/CashFlowSection","description":"Section B — investing activities"},"financing_activities":{"$ref":"#/components/schemas/CashFlowSection","description":"Section C — financing activities"},"net_cash_from_operating":{"type":"integer","title":"Net Cash From Operating","description":"Subtotal of Section A (cents)"},"net_cash_from_investing":{"type":"integer","title":"Net Cash From Investing","description":"Subtotal of Section B (cents)"},"net_cash_from_financing":{"type":"integer","title":"Net Cash From Financing","description":"Subtotal of Section C (cents)"},"net_change_in_cash":{"type":"integer","title":"Net Change In Cash","description":"Sum of Sections A+B+C (cents)"},"beginning_cash":{"type":"integer","title":"Beginning Cash","description":"Σ beginning natural balance for cfs_class='cash' (cents)"},"ending_cash":{"type":"integer","title":"Ending Cash","description":"Beginning cash + Net change in cash (cents)"},"supplemental_disclosures":{"$ref":"#/components/schemas/SupplementalDisclosures","description":"ASC 230 supplemental disclosures"},"validation_results":{"items":{"$ref":"#/components/schemas/CashFlowValidationResult"},"type":"array","title":"Validation Results","description":"Outcome of §5 validation rules"},"validation_passed":{"type":"boolean","title":"Validation Passed","description":"True iff every §5 validation rule passed","default":true},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings","description":"Non-fatal accuracy warnings. Validation failures are duplicated here so legacy callers that ignore ``validation_results`` still see the diagnostic."}},"additionalProperties":true,"type":"object","required":["business_id","start_date","end_date","net_income","operating_activities","investing_activities","financing_activities","net_cash_from_operating","net_cash_from_investing","net_cash_from_financing","net_change_in_cash","beginning_cash","ending_cash"],"title":"GetCashFlowStatementResponse","description":"Response for ``get_cash_flow_statement`` (indirect method, cents)."},"GetCashFlowStatementsPeriodicResponse":{"properties":{"grouping":{"type":"string","enum":["monthly","quarterly","yearly"],"title":"Grouping"},"periods":{"items":{"$ref":"#/components/schemas/CashFlowPeriodicPeriod"},"type":"array","title":"Periods"},"statements":{"items":{"$ref":"#/components/schemas/CashFlowStatement"},"type":"array","title":"Statements"}},"additionalProperties":true,"type":"object","required":["grouping","periods","statements"],"title":"GetCashFlowStatementsPeriodicResponse","description":"Response for ``get_cash_flow_statements_periodic``."},"GetIncomeStatementFlatResponse":{"properties":{},"additionalProperties":true,"type":"object","title":"GetIncomeStatementFlatResponse","description":"Response for ``get_income_statement_flat``."},"GetIncomeStatementResponse":{"items":{"$ref":"#/components/schemas/IncomeStatementSectionBlock"},"type":"array","title":"GetIncomeStatementResponse","description":"Sectioned income statement (list of section blocks)."},"GetLedgerStatementResponse":{"properties":{"ledger_id":{"type":"string","title":"Ledger Id"},"ledger_name":{"type":"string","title":"Ledger Name"},"ledger_type":{"anyOf":[{"type":"string","enum":["asset","liability","equity","revenue","expense"]},{"type":"null"}],"title":"Ledger Type"},"is_debit_normal":{"type":"boolean","title":"Is Debit Normal"},"basis":{"anyOf":[{"type":"string","enum":["accrual","cash"]},{"type":"null"}],"title":"Basis","description":"Accounting basis the statement is rendered on."},"beginning_balance":{"type":"integer","title":"Beginning Balance"},"ending_balance":{"type":"integer","title":"Ending Balance"},"total_debits":{"type":"integer","title":"Total Debits"},"total_credits":{"type":"integer","title":"Total Credits"},"net_activity":{"type":"integer","title":"Net Activity"},"transactions":{"items":{"$ref":"#/components/schemas/LedgerStatementTransaction"},"type":"array","title":"Transactions"}},"additionalProperties":true,"type":"object","required":["ledger_id","ledger_name","is_debit_normal","beginning_balance","ending_balance","total_debits","total_credits","net_activity","transactions"],"title":"GetLedgerStatementResponse","description":"Response for ``get_ledger_statement``."},"GetLedgerVendorBreakdownResponse":{"properties":{"vendors":{"items":{"$ref":"#/components/schemas/LedgerVendorBreakdownEntry"},"type":"array","title":"Vendors"},"total_amount":{"type":"integer","title":"Total Amount"},"basis":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Basis"}},"additionalProperties":true,"type":"object","required":["vendors","total_amount"],"title":"GetLedgerVendorBreakdownResponse","description":"Response for ``get_ledger_vendor_breakdown``."},"GetLedgerVendorPeriodMatrixResponse":{"properties":{"vendors":{"items":{"$ref":"#/components/schemas/LedgerVendorPeriodRow"},"type":"array","title":"Vendors"},"periods":{"items":{"type":"string"},"type":"array","title":"Periods"},"basis":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Basis"}},"additionalProperties":true,"type":"object","required":["vendors","periods"],"title":"GetLedgerVendorPeriodMatrixResponse","description":"Response for ``get_ledger_vendor_period_matrix``."},"GetLedgerVendorTransactionsResponse":{"properties":{"transactions":{"items":{"$ref":"#/components/schemas/LedgerVendorTransactionEntry"},"type":"array","title":"Transactions"},"total_amount":{"type":"integer","title":"Total Amount"},"basis":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Basis"}},"additionalProperties":true,"type":"object","required":["transactions","total_amount"],"title":"GetLedgerVendorTransactionsResponse","description":"Response for ``get_ledger_vendor_transactions``."},"GetTrialBalanceDiffResponse":{"properties":{"from_date":{"type":"string","title":"From Date"},"to_date":{"type":"string","title":"To Date"},"opening_as_of":{"type":"string","title":"Opening As Of"},"basis":{"anyOf":[{"type":"string","enum":["accrual","cash"]},{"type":"null"}],"title":"Basis"},"accounts":{"items":{"$ref":"#/components/schemas/TrialBalanceDiffAccount"},"type":"array","title":"Accounts"},"total_movement_cents":{"type":"integer","title":"Total Movement Cents","description":"Sum of every movement; zero when the books balance."}},"type":"object","required":["from_date","to_date","opening_as_of","accounts","total_movement_cents"],"title":"GetTrialBalanceDiffResponse"},"GetTrialBalanceResponse":{"properties":{"as_of_date":{"type":"string","title":"As Of Date"},"basis":{"anyOf":[{"type":"string","enum":["accrual","cash"]},{"type":"null"}],"title":"Basis","description":"Accounting basis the balances are rendered on."},"accounts":{"items":{"$ref":"#/components/schemas/TrialBalanceAccountRow"},"type":"array","title":"Accounts"},"total_debits_cents":{"type":"integer","title":"Total Debits Cents"},"total_credits_cents":{"type":"integer","title":"Total Credits Cents"},"is_balanced":{"type":"boolean","title":"Is Balanced"}},"additionalProperties":true,"type":"object","required":["as_of_date","accounts","total_debits_cents","total_credits_cents","is_balanced"],"title":"GetTrialBalanceResponse","description":"Response for ``get_trial_balance``."},"GetUserRoleInBusinessResponse":{"properties":{"user_id":{"type":"string","title":"User Id"},"business_id":{"type":"string","title":"Business Id"},"role":{"type":"string","title":"Role"},"visible_sections":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Visible Sections","description":"Sidebar section keys visible to this user for this business. null means all sections are visible."},"menu_enforced":{"type":"boolean","title":"Menu Enforced","description":"Whether visible_sections actually restricts this user. Firm staff resolve to the business role 'admin', and admins are otherwise exempt from menus, so the caller cannot infer this from 'role'.","default":false}},"additionalProperties":true,"type":"object","required":["user_id","business_id","role"],"title":"GetUserRoleInBusinessResponse","description":"Envelope data for ``get_user_role_in_business``.\n\nAlso used as the frontend's bootstrap/context source for sidebar section\nvisibility - ``visible_sections`` is included so the SPA can filter the\nsidebar without a separate request."},"IncomeStatementRow":{"properties":{"ledger_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ledger Id"},"ledger_name":{"type":"string","title":"Ledger Name"},"parent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Id","description":"Chart-of-accounts parent ledger UUID, or null for a top-level account. Rows are returned flat; clients that group sub-ledgers under their parent nest on this and derive the subtotal, so section totals stay a plain sum of the rows."},"total":{"type":"integer","title":"Total"}},"additionalProperties":true,"type":"object","required":["ledger_name","total"],"title":"IncomeStatementRow","description":"Ledger row within an income-statement section; period keys are dynamic."},"IncomeStatementSectionBlock":{"properties":{"section":{"type":"string","title":"Section"},"rows":{"items":{"$ref":"#/components/schemas/IncomeStatementRow"},"type":"array","title":"Rows"},"total_amount":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total Amount"}},"additionalProperties":true,"type":"object","required":["section","rows"],"title":"IncomeStatementSectionBlock","description":"Revenue / expense section with period-valued rows."},"IndirectReconciliationItem":{"properties":{"label":{"type":"string","title":"Label","description":"Description of the adjustment"},"amount":{"type":"integer","title":"Amount","description":"Adjustment amount (cents)"}},"type":"object","required":["label","amount"],"title":"IndirectReconciliationItem","description":"Legacy memo line preserved for backwards-compat with callers that\nconsumed the ASC 230 indirect reconciliation as a separate list.\n\nUnder the indirect method this content lives on\n``operating_activities.line_items`` directly; the supplemental memo\nre-emits the same data so existing UI/AI consumers keep working."},"IntentionalDifference":{"properties":{"ledger_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ledger Id"},"account_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Number"},"reason":{"type":"string","title":"Reason","description":"Why the two systems differ here by design."},"amount_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Amount Cents","description":"Part of the difference (ours - theirs, signed) the decision explains; omit when it explains all of it."}},"additionalProperties":false,"type":"object","required":["reason"],"title":"IntentionalDifference"},"InvoicePaymentDetails":{"properties":{"bank_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Bank Name","description":"Bank name."},"account_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Name","description":"Name on the account."},"account_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Number","description":"Account number."},"routing_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Routing Number","description":"Routing/ABA number."}},"type":"object","title":"InvoicePaymentDetails","description":"Banking/remittance details rendered on DayZero-generated invoice PDFs.\n\nShown as the bottom-left block of the PDF, mirroring where Stripe\ndisplays payment instructions. All fields optional free-form strings."},"InvoiceSettingsResponse":{"properties":{"invoice_footer":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Footer","description":"Default footer text for invoices (payment instructions, bank details)."},"payment_details":{"anyOf":[{"$ref":"#/components/schemas/InvoicePaymentDetails"},{"type":"null"}],"description":"Banking details shown on DayZero-generated invoice PDFs."},"logo_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Logo Url","description":"Business logo URL used for invoice branding."},"stripe_branding_synced_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Stripe Branding Synced At","description":"When the logo was last synced to Stripe account branding."}},"type":"object","title":"InvoiceSettingsResponse","description":"Response schema for invoice branding settings."},"InvoiceSettingsUpdateRequest":{"properties":{"invoice_footer":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Footer","description":"Default footer text for invoices (payment instructions, bank details)."},"payment_details":{"anyOf":[{"$ref":"#/components/schemas/InvoicePaymentDetails"},{"type":"null"}],"description":"Banking details for DayZero-generated invoice PDFs. Send an object with all fields blank to clear the block."}},"type":"object","title":"InvoiceSettingsUpdateRequest","description":"Request schema for updating invoice branding settings.\n\nUpdate the default footer text shown on invoice PDFs.\nThis appears at the bottom of Stripe-generated invoices.","example":{"invoice_footer":"Thank you for your business. Payment is due within 30 days.","payment_details":{"account_name":"Acme Coffee Roasters LLC","account_number":"000123456789","bank_name":"First Example Bank","routing_number":"021000021"}},"examples":[{"invoice_footer":"Thank you for your business. Payment is due within 30 days.","payment_details":{"account_name":"Acme Coffee Roasters LLC","account_number":"000123456789","bank_name":"First Example Bank","routing_number":"021000021"}}]},"LedgerStatementTransaction":{"properties":{"date":{"type":"string","title":"Date"},"description":{"type":"string","title":"Description"},"counterparty_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Counterparty Name","description":"Who the line is for: the split leg's own counterparty, else the counterparty of the entry's transaction, bill or invoice."},"debit":{"type":"integer","title":"Debit"},"credit":{"type":"integer","title":"Credit"},"amount":{"type":"integer","title":"Amount"},"debit_credit":{"type":"string","title":"Debit Credit"},"line_entry_id":{"type":"string","title":"Line Entry Id"},"journal_entry_id":{"type":"string","title":"Journal Entry Id"},"reference":{"type":"string","title":"Reference"},"transaction_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transaction Id"},"transaction_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transaction Source"},"journal_entry_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Journal Entry Source"},"can_be_deleted":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Can Be Deleted"},"deletes_as_soft_hide":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Deletes As Soft Hide"},"delete_via":{"anyOf":[{"type":"string","enum":["transaction","journal_entry"]},{"type":"null"}],"title":"Delete Via"}},"additionalProperties":true,"type":"object","required":["date","description","debit","credit","amount","debit_credit","line_entry_id","journal_entry_id","reference"],"title":"LedgerStatementTransaction","description":"Transaction line on a ledger statement."},"LedgerVendorBreakdownEntry":{"properties":{"counterparty_name":{"type":"string","title":"Counterparty Name"},"vendor_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vendor Id"},"customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Id"},"total_amount":{"type":"integer","title":"Total Amount"},"entry_count":{"type":"integer","title":"Entry Count"},"percentage":{"type":"number","title":"Percentage"}},"additionalProperties":true,"type":"object","required":["counterparty_name","total_amount","entry_count","percentage"],"title":"LedgerVendorBreakdownEntry","description":"Vendor/counterparty slice of a ledger total."},"LedgerVendorPeriodRow":{"properties":{"counterparty_name":{"type":"string","title":"Counterparty Name"},"vendor_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vendor Id"},"customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Id"},"total":{"type":"integer","title":"Total"},"entry_count":{"type":"integer","title":"Entry Count"},"pct_of_total":{"type":"number","title":"Pct Of Total"}},"additionalProperties":true,"type":"object","required":["counterparty_name","total","entry_count","pct_of_total"],"title":"LedgerVendorPeriodRow","description":"Vendor row with per-period amounts; period keys are dynamic."},"LedgerVendorTransactionEntry":{"properties":{"id":{"type":"string","title":"Id"},"transaction_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transaction Id"},"date":{"type":"string","title":"Date"},"description":{"type":"string","title":"Description"},"journal_entry_id":{"type":"string","title":"Journal Entry Id"},"amount":{"type":"integer","title":"Amount"},"debit_credit":{"type":"string","title":"Debit Credit"},"invoice_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Number"},"is_cash_basis_recognition":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Cash Basis Recognition"}},"additionalProperties":true,"type":"object","required":["id","date","description","journal_entry_id","amount","debit_credit"],"title":"LedgerVendorTransactionEntry","description":"Single line entry for a vendor drill-down."},"MailboxUniquenessResponse":{"properties":{"unique":{"type":"boolean","title":"Unique","description":"Whether the mailbox is unique"}},"type":"object","required":["unique"],"title":"MailboxUniquenessResponse","description":"Response schema for mailbox uniqueness check."},"NavCatalogItem":{"properties":{"id":{"type":"string","title":"Id","description":"Stable hideable id, e.g. 'workspace:inventory'"},"label":{"type":"string","title":"Label","description":"Human label","default":""},"description":{"type":"string","title":"Description","description":"What lives here","default":""},"feature_tags":{"items":{"type":"string"},"type":"array","title":"Feature Tags","description":"Capability tags that help the model match"}},"type":"object","required":["id"],"title":"NavCatalogItem","description":"A hideable nav item the client offers the model to reason about."},"NavPreferencesProfile":{"properties":{"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary","description":"Short business profile, e.g. 'Service business, no inventory'"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source","description":"How the config was set: 'manual' or 'ai'"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At","description":"ISO 8601 timestamp of the last change"}},"type":"object","title":"NavPreferencesProfile","description":"Optional context describing how the hidden set was chosen."},"NavPreferencesResponse":{"properties":{"hidden":{"items":{"type":"string"},"type":"array","title":"Hidden","description":"Hidden nav item ids (e.g. 'workspace:inventory', 'books-section:Planning')"},"profile":{"anyOf":[{"$ref":"#/components/schemas/NavPreferencesProfile"},{"type":"null"}],"description":"Optional profile describing the chosen config"},"version":{"type":"integer","title":"Version","description":"Schema version of the stored blob","default":1}},"type":"object","title":"NavPreferencesResponse","description":"Per-business sidebar customization."},"NavPreferencesUpdateRequest":{"properties":{"hidden":{"items":{"type":"string"},"type":"array","title":"Hidden","description":"Full list of hidden nav item ids. Send [] to show everything."},"profile":{"anyOf":[{"$ref":"#/components/schemas/NavPreferencesProfile"},{"type":"null"}],"description":"Optional profile describing the chosen config"}},"type":"object","title":"NavPreferencesUpdateRequest","description":"Replace the business's hidden nav set (full replace, not merge)."},"NavSuggestHidden":{"properties":{"id":{"type":"string","title":"Id"},"reason":{"type":"string","title":"Reason","default":""}},"type":"object","required":["id"],"title":"NavSuggestHidden","description":"One suggested item to hide, with a short rationale."},"NavSuggestRequest":{"properties":{"description":{"type":"string","maxLength":2000,"minLength":1,"title":"Description","description":"Free-text business description"},"items":{"items":{"$ref":"#/components/schemas/NavCatalogItem"},"type":"array","title":"Items","description":"The hideable nav catalog (frontend-sourced)"},"signals":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Signals","description":"Optional account-derived hints, e.g. {'has_inventory': 'true'}"}},"type":"object","required":["description"],"title":"NavSuggestRequest","description":"Describe the business and the items the model may choose to hide."},"NavSuggestResponse":{"properties":{"hide":{"items":{"$ref":"#/components/schemas/NavSuggestHidden"},"type":"array","title":"Hide"},"profile_summary":{"type":"string","title":"Profile Summary","default":""}},"type":"object","title":"NavSuggestResponse","description":"AI proposal — the client renders this as a reviewable, editable diff."},"NonCashActivity":{"properties":{"description":{"type":"string","title":"Description","description":"Description of the activity"},"amount":{"type":"integer","title":"Amount","description":"Amount of the activity (cents)"},"category":{"type":"string","pattern":"^(investing|financing)$","title":"Category","description":"'investing' or 'financing'"}},"type":"object","required":["description","amount","category"],"title":"NonCashActivity","description":"A non-cash investing or financing activity (ASC 230 disclosure)."},"PlaidConnectionSchema":{"properties":{"id":{"type":"string","title":"Id","description":"Plaid Item UUID."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When connection was established."},"updated_at":{"type":"string","format":"date-time","title":"Updated At","description":"Last update timestamp."},"item_id":{"type":"string","title":"Item Id","description":"Plaid Item ID."},"institution_id":{"type":"string","title":"Institution Id","description":"Plaid institution ID (e.g., 'ins_3')."},"institution_name":{"type":"string","title":"Institution Name","description":"Bank/institution name."},"accounts":{"anyOf":[{"items":{"$ref":"#/components/schemas/AccountSchema"},"type":"array"},{"type":"null"}],"title":"Accounts","description":"Bank accounts associated with this connection.","default":[]},"business_id":{"type":"string","title":"Business Id","description":"Business UUID."},"sync_status":{"type":"string","title":"Sync Status","description":"Current sync status."},"error_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Code","description":"Plaid error code if sync failed."}},"additionalProperties":true,"type":"object","required":["id","created_at","updated_at","item_id","institution_id","institution_name","business_id","sync_status"],"title":"PlaidConnectionSchema","description":"Response schema for a Plaid bank connection.\n\nRepresents a linked bank institution with its associated accounts.\nCreated when a user connects a bank via the Plaid Link flow.\n\n**Sync Status Values:**\n- `syncing`: Initial sync in progress\n- `synced`: Fully synced and up to date\n- `error`: Sync failed (check error_code)\n- `disconnected`: Connection needs re-authentication","example":{"accounts":[{"id":"019ab37c-acc1-7000-8000-000000000001","mask":"1234","name":"Chase Business Checking","subtype":"checking","type":"depository"}],"business_id":"019ab37c-b051-7000-8000-000000000001","created_at":"2024-01-10T10:30:00Z","id":"019ab37c-plaid-7000-8000-000000000001","institution_id":"ins_3","institution_name":"Chase","item_id":"plaid_item_abc123","sync_status":"synced","updated_at":"2024-01-15T14:00:00Z"},"examples":[{"accounts":[{"id":"019ab37c-acc1-7000-8000-000000000001","mask":"1234","name":"Chase Business Checking","subtype":"checking","type":"depository"}],"business_id":"019ab37c-b051-7000-8000-000000000001","created_at":"2024-01-10T10:30:00Z","id":"019ab37c-plaid-7000-8000-000000000001","institution_id":"ins_3","institution_name":"Chase","item_id":"plaid_item_abc123","sync_status":"synced","updated_at":"2024-01-15T14:00:00Z"}]},"PlaidTransactionSettingsResponse":{"properties":{"show_pending_transactions":{"type":"boolean","title":"Show Pending Transactions","description":"When true, Plaid pending (unsettled) transactions are ingested and shown as a read-only, financially-inert awareness layer. Local accounting engine only."}},"type":"object","required":["show_pending_transactions"],"title":"PlaidTransactionSettingsResponse","description":"Response schema for Plaid pending-transaction display settings."},"PlaidTransactionSettingsUpdateRequest":{"properties":{"show_pending_transactions":{"type":"boolean","title":"Show Pending Transactions","description":"Enable/disable ingesting & displaying Plaid pending transactions."}},"type":"object","required":["show_pending_transactions"],"title":"PlaidTransactionSettingsUpdateRequest","description":"Request schema for updating Plaid pending-transaction display settings."},"RecategorizeLineEntriesRequest":{"properties":{"line_entry_ids":{"items":{"type":"string"},"type":"array","minItems":1,"title":"Line Entry Ids","description":"IDs of the line entries to recategorize."},"ledger_id":{"type":"string","title":"Ledger Id","description":"Target ledger to move the line entries into."}},"type":"object","required":["line_entry_ids","ledger_id"],"title":"RecategorizeLineEntriesRequest","description":"Request to move line entries to a different ledger (recategorize)."},"RecategorizeLineEntriesResponse":{"properties":{"updated":{"type":"integer","title":"Updated"}},"additionalProperties":true,"type":"object","required":["updated"],"title":"RecategorizeLineEntriesResponse","description":"Response for ``recategorize_line_entries``."},"Role":{"type":"string","enum":["owner","admin","member","viewer","accountant"],"title":"Role","description":"User roles in a business.\n\nSee ROLE_ABILITIES_DOC in app.models.user_businesses for detailed role descriptions.\nValid roles: owner, admin, member, viewer, accountant (legacy)."},"SlackCategoryItem":{"properties":{"key":{"type":"string","title":"Key","description":"Stable category key"},"label":{"type":"string","title":"Label","description":"User-facing label"},"description":{"type":"string","title":"Description","description":"One-line explanation"},"group":{"type":"string","title":"Group","description":"Group key used to render the UI in sections"},"enabled":{"type":"boolean","title":"Enabled","description":"Whether the user has this category enabled"}},"type":"object","required":["key","label","description","group","enabled"],"title":"SlackCategoryItem","description":"One toggleable notification category in a Slack integration status."},"SlackDisconnectResult":{"properties":{"status":{"type":"string","title":"Status","description":"\"ok\" on success"},"message":{"type":"string","title":"Message","description":"Human-readable status message"}},"type":"object","required":["status","message"],"title":"SlackDisconnectResult","description":"Result of removing a configured Slack webhook."},"SlackGroupInfo":{"properties":{"key":{"type":"string","title":"Key","description":"Group key (matches SlackCategoryItem.group)"},"label":{"type":"string","title":"Label","description":"User-facing section label"}},"type":"object","required":["key","label"],"title":"SlackGroupInfo","description":"Render metadata for a category group."},"SlackIntegrationStatus":{"properties":{"connected":{"type":"boolean","title":"Connected","description":"Whether at least one webhook URL is configured"},"webhooks":{"items":{"$ref":"#/components/schemas/SlackWebhookItem"},"type":"array","title":"Webhooks","description":"List of configured webhooks"},"groups":{"items":{"$ref":"#/components/schemas/SlackGroupInfo"},"type":"array","title":"Groups","description":"Group definitions for UI section rendering"}},"type":"object","required":["connected"],"title":"SlackIntegrationStatus","description":"Status of a business- or firm-level Slack incoming-webhook integration."},"SlackPreferencesUpdateRequest":{"properties":{"preferences":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Preferences","description":"Map of category key to enabled flag, e.g. {'workflow_completions': false}. Unknown keys are silently ignored."}},"type":"object","required":["preferences"],"title":"SlackPreferencesUpdateRequest","description":"Toggle which notification categories deliver to Slack."},"SlackTestSendResult":{"properties":{"status":{"type":"string","title":"Status","description":"\"ok\" on success"},"message":{"type":"string","title":"Message","description":"Human-readable status message"}},"type":"object","required":["status","message"],"title":"SlackTestSendResult","description":"Result of sending a test notification to Slack."},"SlackWebhookItem":{"properties":{"id":{"type":"string","title":"Id","description":"Webhook ID"},"channel_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel Name","description":"User-defined channel or webhook name"},"webhook_url_masked":{"type":"string","title":"Webhook Url Masked","description":"Masked URL for display"},"notification_preferences":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Notification Preferences","description":"Per-category enabled flags"},"notification_categories":{"items":{"$ref":"#/components/schemas/SlackCategoryItem"},"type":"array","title":"Notification Categories","description":"Categories with metadata for UI rendering"}},"type":"object","required":["id","webhook_url_masked","notification_preferences","notification_categories"],"title":"SlackWebhookItem","description":"A configured Slack webhook."},"SlackWebhookSaveRequest":{"properties":{"slack_webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slack Webhook Url","description":"Slack Incoming Webhook URL, or empty/null to disconnect"},"channel_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel Name","description":"Optional name for the channel or webhook"},"preferences":{"anyOf":[{"additionalProperties":{"type":"boolean"},"type":"object"},{"type":"null"}],"title":"Preferences","description":"Optional per-category enabled flags for the new webhook. Omitted categories default to enabled."}},"type":"object","title":"SlackWebhookSaveRequest","description":"Save (or clear) a Slack Incoming Webhook URL.\n\nSend ``slack_webhook_url`` as an empty string or ``null`` to disconnect."},"SuccessEnvelope_AddUserToBusinessResponse_":{"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/AddUserToBusinessResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AddUserToBusinessResponse]"},"SuccessEnvelope_AnalyzeBalanceSheetResponse_":{"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/AnalyzeBalanceSheetResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AnalyzeBalanceSheetResponse]"},"SuccessEnvelope_AnalyzeCashFlowResponse_":{"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/AnalyzeCashFlowResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AnalyzeCashFlowResponse]"},"SuccessEnvelope_AnalyzeIncomeStatementResponse_":{"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/AnalyzeIncomeStatementResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AnalyzeIncomeStatementResponse]"},"SuccessEnvelope_AssociatedUserCursorListResponse_":{"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/AssociatedUserCursorListResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AssociatedUserCursorListResponse]"},"SuccessEnvelope_AutoNumberingPreviewResponse_":{"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/AutoNumberingPreviewResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AutoNumberingPreviewResponse]"},"SuccessEnvelope_AutoNumberingSettingsResponse_":{"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/AutoNumberingSettingsResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AutoNumberingSettingsResponse]"},"SuccessEnvelope_BusinessCursorListResponse_":{"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/BusinessCursorListResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[BusinessCursorListResponse]"},"SuccessEnvelope_BusinessDataExportResponse_":{"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/BusinessDataExportResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[BusinessDataExportResponse]"},"SuccessEnvelope_BusinessDeletionStatusResponse_":{"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/BusinessDeletionStatusResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[BusinessDeletionStatusResponse]"},"SuccessEnvelope_BusinessMailboxProvisionResponse_":{"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/BusinessMailboxProvisionResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[BusinessMailboxProvisionResponse]"},"SuccessEnvelope_BusinessResponse_":{"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/BusinessResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[BusinessResponse]"},"SuccessEnvelope_CoaGenerateResponse_":{"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/CoaGenerateResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CoaGenerateResponse]"},"SuccessEnvelope_GenericListResponse_":{"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/GenericListResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GenericListResponse]"},"SuccessEnvelope_GetBalanceSheetResponse_":{"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/GetBalanceSheetResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GetBalanceSheetResponse]"},"SuccessEnvelope_GetCashBasisBridgeResponse_":{"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/GetCashBasisBridgeResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GetCashBasisBridgeResponse]"},"SuccessEnvelope_GetCashBasisUnappliedResponse_":{"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/GetCashBasisUnappliedResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GetCashBasisUnappliedResponse]"},"SuccessEnvelope_GetCashFlowOutflowBreakdownResponse_":{"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/GetCashFlowOutflowBreakdownResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GetCashFlowOutflowBreakdownResponse]"},"SuccessEnvelope_GetCashFlowStatementResponse_":{"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/GetCashFlowStatementResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GetCashFlowStatementResponse]"},"SuccessEnvelope_GetCashFlowStatementsPeriodicResponse_":{"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/GetCashFlowStatementsPeriodicResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GetCashFlowStatementsPeriodicResponse]"},"SuccessEnvelope_GetIncomeStatementFlatResponse_":{"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/GetIncomeStatementFlatResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GetIncomeStatementFlatResponse]"},"SuccessEnvelope_GetIncomeStatementResponse_":{"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/GetIncomeStatementResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GetIncomeStatementResponse]"},"SuccessEnvelope_GetLedgerStatementResponse_":{"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/GetLedgerStatementResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GetLedgerStatementResponse]"},"SuccessEnvelope_GetLedgerVendorBreakdownResponse_":{"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/GetLedgerVendorBreakdownResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GetLedgerVendorBreakdownResponse]"},"SuccessEnvelope_GetLedgerVendorPeriodMatrixResponse_":{"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/GetLedgerVendorPeriodMatrixResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GetLedgerVendorPeriodMatrixResponse]"},"SuccessEnvelope_GetLedgerVendorTransactionsResponse_":{"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/GetLedgerVendorTransactionsResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GetLedgerVendorTransactionsResponse]"},"SuccessEnvelope_GetTrialBalanceDiffResponse_":{"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/GetTrialBalanceDiffResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GetTrialBalanceDiffResponse]"},"SuccessEnvelope_GetTrialBalanceResponse_":{"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/GetTrialBalanceResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GetTrialBalanceResponse]"},"SuccessEnvelope_GetUserRoleInBusinessResponse_":{"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/GetUserRoleInBusinessResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[GetUserRoleInBusinessResponse]"},"SuccessEnvelope_InvoiceSettingsResponse_":{"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/InvoiceSettingsResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[InvoiceSettingsResponse]"},"SuccessEnvelope_MailboxUniquenessResponse_":{"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/MailboxUniquenessResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[MailboxUniquenessResponse]"},"SuccessEnvelope_NavPreferencesResponse_":{"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/NavPreferencesResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[NavPreferencesResponse]"},"SuccessEnvelope_NavSuggestResponse_":{"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/NavSuggestResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[NavSuggestResponse]"},"SuccessEnvelope_PlaidTransactionSettingsResponse_":{"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/PlaidTransactionSettingsResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[PlaidTransactionSettingsResponse]"},"SuccessEnvelope_RecategorizeLineEntriesResponse_":{"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/RecategorizeLineEntriesResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[RecategorizeLineEntriesResponse]"},"SuccessEnvelope_SlackDisconnectResult_":{"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/SlackDisconnectResult"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[SlackDisconnectResult]"},"SuccessEnvelope_SlackIntegrationStatus_":{"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/SlackIntegrationStatus"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[SlackIntegrationStatus]"},"SuccessEnvelope_SlackTestSendResult_":{"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/SlackTestSendResult"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[SlackTestSendResult]"},"SuccessEnvelope_SyncLogoBrandingResponse_":{"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/SyncLogoBrandingResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[SyncLogoBrandingResponse]"},"SuccessEnvelope_SyncStatus_":{"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/SyncStatus"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[SyncStatus]"},"SuccessEnvelope_TableSavedViewsDataSchema_":{"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/TableSavedViewsDataSchema"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[TableSavedViewsDataSchema]"},"SuccessEnvelope_TableViewsMapResponse_":{"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/TableViewsMapResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[TableViewsMapResponse]"},"SuccessEnvelope_TrialBalanceBridgeResponse_":{"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/TrialBalanceBridgeResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[TrialBalanceBridgeResponse]"},"SuccessEnvelope_UpdateEntriesStartResponse_":{"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/UpdateEntriesStartResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[UpdateEntriesStartResponse]"},"SuccessEnvelope_UpdateStripeSubscriptionResponse_":{"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/UpdateStripeSubscriptionResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[UpdateStripeSubscriptionResponse]"},"SuccessEnvelope_UpdateUserRoleInBusinessResponse_":{"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/UpdateUserRoleInBusinessResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[UpdateUserRoleInBusinessResponse]"},"SuccessEnvelope_ValidateCoaTemplateResponse_":{"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/ValidateCoaTemplateResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[ValidateCoaTemplateResponse]"},"SupplementalDisclosures":{"properties":{"cash_paid_for_interest":{"type":"integer","title":"Cash Paid For Interest","description":"Cash paid for interest during the period (cents)","default":0},"cash_paid_for_income_taxes":{"type":"integer","title":"Cash Paid For Income Taxes","description":"Cash paid for income taxes during the period (cents)","default":0},"indirect_reconciliation":{"items":{"$ref":"#/components/schemas/IndirectReconciliationItem"},"type":"array","title":"Indirect Reconciliation","description":"Mirror of the operating-section line items as a flat label/amount list; preserved for backwards compatibility with consumers built against the prior schema."},"non_cash_activities":{"items":{"$ref":"#/components/schemas/NonCashActivity"},"type":"array","title":"Non Cash Activities","description":"Significant non-cash investing and financing activities"}},"type":"object","title":"SupplementalDisclosures","description":"ASC 230 supplemental disclosures.\n\nEven under the indirect method, businesses must disclose cash paid\nfor interest and income taxes, plus significant non-cash investing\nand financing activities. We surface those here."},"SyncLogoBrandingResponse":{"properties":{"status":{"type":"string","title":"Status","description":"Sync status: 'synced', 'no_logo', or 'no_stripe_account'."},"stripe_file_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe File Id","description":"Stripe file ID for the uploaded logo (if synced)."},"synced_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Synced At","description":"Timestamp when the sync completed."}},"type":"object","required":["status"],"title":"SyncLogoBrandingResponse","description":"Response schema for logo sync to Stripe operation."},"SyncStatus":{"properties":{"status":{"type":"string","enum":["syncing","completed","nothing_to_sync"],"title":"Status","description":"Sync status: 'syncing', 'completed', or 'nothing_to_sync'"},"last_synced":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Synced","description":"ISO timestamp of last successful sync"},"sync_in_progress":{"type":"boolean","title":"Sync In Progress","description":"Whether an account-sync task is currently running (from tasks table)","default":false}},"type":"object","required":["status"],"title":"SyncStatus","description":"Sync status for a business."},"TableSavedViewSchema":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"createdAt":{"type":"string","title":"Createdat","default":""},"updatedAt":{"type":"string","title":"Updatedat","default":""},"state":{"$ref":"#/components/schemas/TableSavedViewStateSchema"}},"type":"object","required":["id","name"],"title":"TableSavedViewSchema"},"TableSavedViewStateSchema":{"properties":{"filters":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Filters"},"sort":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Sort"},"columns":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Columns"}},"type":"object","title":"TableSavedViewStateSchema","description":"Filter/sort/column snapshot for one saved view."},"TableSavedViewsDataSchema":{"properties":{"v":{"type":"integer","title":"V","description":"Schema version","default":1},"views":{"items":{"$ref":"#/components/schemas/TableSavedViewSchema"},"type":"array","title":"Views"},"defaultViewId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Defaultviewid","description":"Auto-applied view id on load"},"defaultUpdatedAt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Defaultupdatedat","description":"When defaultViewId last changed (ISO 8601); the newer choice wins a merge"},"deletedViews":{"additionalProperties":{"type":"string"},"type":"object","title":"Deletedviews","description":"Tombstones: deleted view id -> deletedAt (ISO 8601), so a merge with an older copy doesn't bring the view back"}},"type":"object","title":"TableSavedViewsDataSchema","description":"Saved views blob for a single DataTable ``persistKey``."},"TableViewsMapResponse":{"properties":{"tables":{"additionalProperties":{"$ref":"#/components/schemas/TableSavedViewsDataSchema"},"type":"object","title":"Tables","description":"Keyed by DataTable persistKey / tableKey"},"version":{"type":"integer","title":"Version","description":"Optimistic-concurrency version for this user+business prefs blob","default":0}},"type":"object","title":"TableViewsMapResponse","description":"All saved table views for the current user+business."},"TableViewsPatchRequest":{"properties":{"tables":{"additionalProperties":{"$ref":"#/components/schemas/TableSavedViewsDataSchema"},"type":"object","title":"Tables","description":"Table keys to upsert. Empty views removes the key."},"version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Version","description":"Expected prefs version (If-Match alternative in PATCH body)"}},"type":"object","title":"TableViewsPatchRequest","description":"Merge one or more table view blobs (upsert per key)."},"TrialBalanceAccountRow":{"properties":{"name":{"type":"string","title":"Name"},"type":{"type":"string","title":"Type"},"debit_cents":{"type":"integer","title":"Debit Cents"},"credit_cents":{"type":"integer","title":"Credit Cents"}},"additionalProperties":true,"type":"object","required":["name","type","debit_cents","credit_cents"],"title":"TrialBalanceAccountRow","description":"Single account row on the trial balance."},"TrialBalanceBridgeRequest":{"properties":{"as_of_date":{"type":"string","title":"As Of Date","description":"Date of the external trial balance."},"rows":{"anyOf":[{"items":{"$ref":"#/components/schemas/ExternalTrialBalanceRow"},"type":"array"},{"type":"null"}],"title":"Rows","description":"Up to 1,000 rows. Send rows or csv_text."},"csv_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Csv Text","description":"CSV with a header: account, optional account_number, then balance_cents or debit_cents and credit_cents."},"mapping":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Mapping","description":"External account -> our ledger_id or account_number."},"intentional":{"anyOf":[{"items":{"$ref":"#/components/schemas/IntentionalDifference"},"type":"array"},{"type":"null"}],"title":"Intentional"},"tolerance_cents":{"type":"integer","maximum":1000000.0,"minimum":0.0,"title":"Tolerance Cents","default":100},"prior_rows":{"anyOf":[{"items":{"$ref":"#/components/schemas/ExternalTrialBalanceRow"},"type":"array"},{"type":"null"}],"title":"Prior Rows","description":"The same trial balance at prior_as_of, for cut-off swings."},"prior_as_of":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prior As Of"},"basis":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Basis","description":"`accrual` or `cash`."}},"additionalProperties":false,"type":"object","required":["as_of_date"],"title":"TrialBalanceBridgeRequest"},"TrialBalanceBridgeResponse":{"properties":{"as_of_date":{"type":"string","title":"As Of Date"},"prior_as_of":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prior As Of"},"basis":{"anyOf":[{"type":"string","enum":["accrual","cash"]},{"type":"null"}],"title":"Basis"},"tolerance_cents":{"type":"integer","title":"Tolerance Cents"},"row_count":{"type":"integer","title":"Row Count"},"ledgers":{"items":{"$ref":"#/components/schemas/BridgeLedgerRow"},"type":"array","title":"Ledgers"},"totals":{"additionalProperties":{"$ref":"#/components/schemas/BridgeVerdictTotals"},"type":"object","title":"Totals"},"unmapped":{"items":{"$ref":"#/components/schemas/BridgeUnmappedRow"},"type":"array","title":"Unmapped"},"ledgers_without_external":{"items":{"$ref":"#/components/schemas/BridgeLedgerWithoutExternal"},"type":"array","title":"Ledgers Without External"}},"type":"object","required":["as_of_date","tolerance_cents","row_count","ledgers","totals","unmapped","ledgers_without_external"],"title":"TrialBalanceBridgeResponse"},"TrialBalanceDiffAccount":{"properties":{"ledger_id":{"type":"string","title":"Ledger Id"},"account_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Number"},"name":{"type":"string","title":"Name"},"type":{"type":"string","title":"Type"},"sort_code":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sort Code"},"opening_cents":{"type":"integer","title":"Opening Cents","description":"Debit-positive balance at the end of the day before from_date."},"closing_cents":{"type":"integer","title":"Closing Cents","description":"Debit-positive balance at to_date."},"movement_cents":{"type":"integer","title":"Movement Cents","description":"closing - opening."}},"type":"object","required":["ledger_id","name","type","opening_cents","closing_cents","movement_cents"],"title":"TrialBalanceDiffAccount"},"UpdateEntriesStartRequest":{"properties":{"business_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Id","description":"Business ID"},"entries_start":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entries Start","description":"Entries start date in YYYY-MM-DD format"}},"type":"object","title":"UpdateEntriesStartRequest","description":"Request schema for updating entries start date."},"UpdateEntriesStartResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether the update was successful"},"entries_start":{"type":"string","format":"date-time","title":"Entries Start","description":"Updated entries start date"}},"type":"object","required":["success","entries_start"],"title":"UpdateEntriesStartResponse","description":"Response schema for updating entries start date."},"UpdateStripeSubscriptionRequest":{"properties":{"stripe_subscription_id":{"type":"string","pattern":"^sub_[A-Za-z0-9]+$","title":"Stripe Subscription Id","description":"Stripe subscription ID (e.g., sub_xxx)"}},"additionalProperties":false,"type":"object","required":["stripe_subscription_id"],"title":"UpdateStripeSubscriptionRequest","description":"Request schema for updating a business's Stripe subscription ID."},"UpdateStripeSubscriptionResponse":{"properties":{"business_id":{"type":"string","title":"Business Id","description":"Business ID"},"stripe_subscription_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Subscription Id","description":"Updated Stripe subscription ID"}},"type":"object","required":["business_id"],"title":"UpdateStripeSubscriptionResponse","description":"Response schema for updating a business's Stripe subscription ID."},"UpdateUserRoleInBusinessResponse":{"properties":{"business_id":{"type":"string","title":"Business Id"},"user_id":{"type":"string","title":"User Id"},"new_role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"New Role"},"visible_sections":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Visible Sections"}},"additionalProperties":true,"type":"object","required":["business_id","user_id"],"title":"UpdateUserRoleInBusinessResponse","description":"Envelope data for ``update_user_role_in_business``.\n\nShared by the business-facing member-management endpoint\n(``PUT /businesses/{business_id}/users/{user_id}``) and the admin\ninternal-tools endpoint. ``visible_sections`` reflects the value after\nthe update (unchanged if the request did not include it)."},"UserSource":{"type":"string","enum":["business_user","advisor_user"],"title":"UserSource","description":"Source of user association with a business."},"ValidateCoaTemplateResponse":{"properties":{"valid":{"type":"boolean","title":"Valid","description":"Whether the COA template is valid"},"errors":{"items":{"$ref":"#/components/schemas/CoaValidationError"},"type":"array","title":"Errors","description":"List of validation errors (empty when valid)"},"ledger_count":{"type":"integer","title":"Ledger Count","description":"Number of ledgers in the template","default":0}},"additionalProperties":true,"type":"object","required":["valid"],"title":"ValidateCoaTemplateResponse","description":"Envelope data for ``validate_coa_template``."},"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":[]}]}