{"openapi":"3.1.0","info":{"title":"SaaSFlow API","version":"1.0.0"},"components":{"schemas":{},"parameters":{}},"paths":{"/companies":{"get":{"responses":{"200":{"description":"List of companies the user has access to","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"firestoreId":{"type":"string","nullable":true},"name":{"type":"string","description":"The name of the company."},"baseCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The base currency for the company."},"lastOverallUpdatedTime":{"type":"string","format":"date-time","description":"When any data within the company was last updated."},"plShowPlanningPercentageForPastMonths":{"type":"boolean","description":"Whether to show planning percentages for past months in P&L."},"plShowAllCategories":{"type":"boolean","description":"Whether to show all categories in P&L, including empty ones."},"systemStatus":{"type":"string","enum":["sandbox","trial","free","paid","cancelled","expired","beta"],"description":"The status of the company."},"systemTrialUntil":{"type":"string","nullable":true,"format":"date-time"},"systemExpiredAt":{"type":"string","nullable":true,"format":"date-time"},"systemDeletionWarning":{"type":"integer","nullable":true,"minimum":-2147483648,"maximum":2147483647},"systemSandboxExpireTime":{"type":"string","nullable":true,"format":"date-time"},"systemDeletionScheduledTime":{"type":"string","nullable":true,"format":"date-time"},"systemStripe":{"type":"object","nullable":true,"properties":{"customerId":{"type":"string"},"subscription":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["active","incomplete","incomplete_expired","past_due","unpaid","canceled"]},"productName":{"type":"string","enum":["starter","pro"]},"interval":{"type":"string","enum":["monthly","yearly"]},"currentPeriodStart":{"type":"string"},"currentPeriodEnd":{"type":"string"},"price":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"]},"cancelAt":{"type":"string","nullable":true},"limits":{"type":"object","nullable":true,"properties":{"minARR":{"type":"number"},"maxARR":{"type":"number"}},"required":["minARR","maxARR"]}},"required":["id","status","productName","interval","currentPeriodStart","currentPeriodEnd","price","cancelAt","limits"]}},"required":["customerId"]},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","editor","viewer"]},"permissions":{"type":"array","nullable":true,"items":{"type":"string","enum":["subscriptions:read","subscriptions:write","customers:read","customers:write","vendors:read","vendors:write","accounts:read","accounts:write","transactions:read","transactions:write","balances:read","balances:write","financials:read","financials:write","users:manage","api_keys:manage","integrations:manage","company:manage"],"description":"A granular permission in the form `<resource>:<action>`. Stored on companiesUsers and companiesApiKeys. When a grant has `permissions: null` it means unrestricted (legacy behavior derived from role)."}}},"required":["id","firestoreId","name","baseCurrency","lastOverallUpdatedTime","plShowPlanningPercentageForPastMonths","plShowAllCategories","systemStatus","systemTrialUntil","systemExpiredAt","systemDeletionWarning","systemSandboxExpireTime","systemDeletionScheduledTime","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","role","permissions"]}}}}}}}},"/companies/{companyId}":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"responses":{"200":{"description":"Company details with users","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"firestoreId":{"type":"string","nullable":true},"name":{"type":"string","description":"The name of the company."},"baseCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The base currency for the company."},"lastOverallUpdatedTime":{"type":"string","format":"date-time","description":"When any data within the company was last updated."},"plShowPlanningPercentageForPastMonths":{"type":"boolean","description":"Whether to show planning percentages for past months in P&L."},"plShowAllCategories":{"type":"boolean","description":"Whether to show all categories in P&L, including empty ones."},"systemStatus":{"type":"string","enum":["sandbox","trial","free","paid","cancelled","expired","beta"],"description":"The status of the company."},"systemTrialUntil":{"type":"string","nullable":true,"format":"date-time"},"systemExpiredAt":{"type":"string","nullable":true,"format":"date-time"},"systemDeletionWarning":{"type":"integer","nullable":true,"minimum":-2147483648,"maximum":2147483647},"systemSandboxExpireTime":{"type":"string","nullable":true,"format":"date-time"},"systemDeletionScheduledTime":{"type":"string","nullable":true,"format":"date-time"},"systemStripe":{"type":"object","nullable":true,"properties":{"customerId":{"type":"string"},"subscription":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["active","incomplete","incomplete_expired","past_due","unpaid","canceled"]},"productName":{"type":"string","enum":["starter","pro"]},"interval":{"type":"string","enum":["monthly","yearly"]},"currentPeriodStart":{"type":"string"},"currentPeriodEnd":{"type":"string"},"price":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"]},"cancelAt":{"type":"string","nullable":true},"limits":{"type":"object","nullable":true,"properties":{"minARR":{"type":"number"},"maxARR":{"type":"number"}},"required":["minARR","maxARR"]}},"required":["id","status","productName","interval","currentPeriodStart","currentPeriodEnd","price","cancelAt","limits"]}},"required":["customerId"]},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"users":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"firebaseUserId":{"type":"string","nullable":true},"email":{"type":"string"},"name":{"type":"string","nullable":true},"photoURL":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","editor","viewer"]},"permissions":{"type":"array","nullable":true,"items":{"type":"string","enum":["subscriptions:read","subscriptions:write","customers:read","customers:write","vendors:read","vendors:write","accounts:read","accounts:write","transactions:read","transactions:write","balances:read","balances:write","financials:read","financials:write","users:manage","api_keys:manage","integrations:manage","company:manage"],"description":"A granular permission in the form `<resource>:<action>`. Stored on companiesUsers and companiesApiKeys. When a grant has `permissions: null` it means unrestricted (legacy behavior derived from role)."}},"lastSeenTime":{"type":"string","nullable":true,"format":"date-time"}},"required":["id","userId","firebaseUserId","email","name","photoURL","role","permissions","lastSeenTime"]}},"integrationTypes":{"type":"array","items":{"type":"string","enum":["stripe","slack","hubspot","datevPayroll","finway","pleo","salesforce"],"description":"The type of integration."},"description":"Distinct integration types currently active for this company. Used by the UI to gate features that depend on a specific integration being installed (e.g. show DATEV personnel-number input only when a datevPayroll integration exists). Avoids loading the full /integrations list — that endpoint is owner-only."}},"required":["id","firestoreId","name","baseCurrency","lastOverallUpdatedTime","plShowPlanningPercentageForPastMonths","plShowAllCategories","systemStatus","systemTrialUntil","systemExpiredAt","systemDeletionWarning","systemSandboxExpireTime","systemDeletionScheduledTime","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","users","integrationTypes"]}}}},"404":{"description":"Company not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"baseCurrency":{"type":"string"},"plShowPlanningPercentageForPastMonths":{"type":"boolean"},"plShowAllCategories":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Updated company","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"firestoreId":{"type":"string","nullable":true},"name":{"type":"string","description":"The name of the company."},"baseCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The base currency for the company."},"lastOverallUpdatedTime":{"type":"string","format":"date-time","description":"When any data within the company was last updated."},"plShowPlanningPercentageForPastMonths":{"type":"boolean","description":"Whether to show planning percentages for past months in P&L."},"plShowAllCategories":{"type":"boolean","description":"Whether to show all categories in P&L, including empty ones."},"systemStatus":{"type":"string","enum":["sandbox","trial","free","paid","cancelled","expired","beta"],"description":"The status of the company."},"systemTrialUntil":{"type":"string","nullable":true,"format":"date-time"},"systemExpiredAt":{"type":"string","nullable":true,"format":"date-time"},"systemDeletionWarning":{"type":"integer","nullable":true,"minimum":-2147483648,"maximum":2147483647},"systemSandboxExpireTime":{"type":"string","nullable":true,"format":"date-time"},"systemDeletionScheduledTime":{"type":"string","nullable":true,"format":"date-time"},"systemStripe":{"type":"object","nullable":true,"properties":{"customerId":{"type":"string"},"subscription":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["active","incomplete","incomplete_expired","past_due","unpaid","canceled"]},"productName":{"type":"string","enum":["starter","pro"]},"interval":{"type":"string","enum":["monthly","yearly"]},"currentPeriodStart":{"type":"string"},"currentPeriodEnd":{"type":"string"},"price":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"]},"cancelAt":{"type":"string","nullable":true},"limits":{"type":"object","nullable":true,"properties":{"minARR":{"type":"number"},"maxARR":{"type":"number"}},"required":["minARR","maxARR"]}},"required":["id","status","productName","interval","currentPeriodStart","currentPeriodEnd","price","cancelAt","limits"]}},"required":["customerId"]},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","firestoreId","name","baseCurrency","lastOverallUpdatedTime","plShowPlanningPercentageForPastMonths","plShowAllCategories","systemStatus","systemTrialUntil","systemExpiredAt","systemDeletionWarning","systemSandboxExpireTime","systemDeletionScheduledTime","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Company not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/users":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"responses":{"200":{"description":"List of users in the company","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"firebaseUserId":{"type":"string","nullable":true},"email":{"type":"string"},"name":{"type":"string","nullable":true},"photoURL":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","editor","viewer"]},"lastSeenTime":{"type":"string","nullable":true,"format":"date-time"}},"required":["id","userId","firebaseUserId","email","name","photoURL","role","lastSeenTime"]}}}}}}}},"/companies/{companyId}/users/{userId}/role":{"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"userId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["owner","editor","viewer"],"description":"The role assigned to a user within the system. Owner = full access incl. company settings, billing, and user management; editor = read/write on data; viewer = read-only. The role is also used as the default permission preset and as a non-permission marker (e.g. notifications are sent to all owners). For granular API access control, see PermissionSchema."},"permissions":{"type":"array","nullable":true,"items":{"type":"string","enum":["subscriptions:read","subscriptions:write","customers:read","customers:write","vendors:read","vendors:write","accounts:read","accounts:write","transactions:read","transactions:write","balances:read","balances:write","financials:read","financials:write","users:manage","api_keys:manage","integrations:manage","company:manage"],"description":"A granular permission in the form `<resource>:<action>`. Stored on companiesUsers and companiesApiKeys. When a grant has `permissions: null` it means unrestricted (legacy behavior derived from role)."}}},"required":["role"]}}}},"responses":{"200":{"description":"User role updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"403":{"description":"Cannot edit own membership","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"User not found in company","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/users/{userId}":{"delete":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"userId","in":"path"}],"responses":{"200":{"description":"User removed from company","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"403":{"description":"Cannot remove self","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/account_groups":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"responses":{"200":{"description":"List of account groups","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the account group."},"archived":{"type":"boolean","description":"Flag indicating if the account group is archived."},"order":{"type":"number","minimum":-8388608,"maximum":8388607,"description":"A number used for ordering account groups in the UI."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","name","archived","order","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}}}}},"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"archived":{"type":"boolean","default":false},"order":{"type":"number"}},"required":["name","order"]}}}},"responses":{"201":{"description":"Created account group","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the account group."},"archived":{"type":"boolean","description":"Flag indicating if the account group is archived."},"order":{"type":"number","minimum":-8388608,"maximum":8388607,"description":"A number used for ordering account groups in the UI."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","name","archived","order","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}}}}},"/companies/{companyId}/account_groups/{accountGroupId}":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"accountGroupId","in":"path"}],"responses":{"200":{"description":"Account group details","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the account group."},"archived":{"type":"boolean","description":"Flag indicating if the account group is archived."},"order":{"type":"number","minimum":-8388608,"maximum":8388607,"description":"A number used for ordering account groups in the UI."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","name","archived","order","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Account group not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"accountGroupId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"archived":{"type":"boolean"},"order":{"type":"number"}}}}}},"responses":{"200":{"description":"Updated account group","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the account group."},"archived":{"type":"boolean","description":"Flag indicating if the account group is archived."},"order":{"type":"number","minimum":-8388608,"maximum":8388607,"description":"A number used for ordering account groups in the UI."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","name","archived","order","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Account group not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"delete":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"accountGroupId","in":"path"}],"responses":{"200":{"description":"Account group deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}}},"/companies/{companyId}/account_groups/reorder":{"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"accountGroupIds":{"type":"array","items":{"type":"string","minLength":1}}},"required":["accountGroupIds"]}}}},"responses":{"200":{"description":"Order updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}}},"/companies/{companyId}/accounts":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"responses":{"200":{"description":"List of accounts","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["bank","cash","creditCard","loan","other","transit"],"description":"The type of account: bank, cash, creditCard, loan, or other."},"name":{"type":"string","description":"The name of the account."},"accountNumber":{"type":"string","nullable":true,"description":"The bank account number. Null if not provided."},"includeInCashBalance":{"type":"boolean","description":"Whether this account should be included in cash balance calculations and cash flow reports."},"accountGroupId":{"type":"string","nullable":true,"format":"uuid","description":"The ID of the account group this account belongs to. Null if not part of any group."},"archived":{"type":"boolean","description":"Flag indicating if the account is archived and should be hidden from most views."},"expectedAnnualReturn":{"type":"number","nullable":true,"minimum":-8388608,"maximum":8388607,"description":"The expected annual return percentage for this account, if applicable."},"order":{"type":"number","minimum":-8388608,"maximum":8388607,"description":"A number used for ordering accounts in the UI."},"defaultCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The default currency for transactions recorded under this account."},"defaultCategoryId":{"type":"string","nullable":true,"description":"The default category ID to assign to new transactions for this account."},"importType":{"type":"string","enum":["manual","automated"],"description":"Whether transactions are imported manually or via bank connection."},"transitCurrency":{"type":"string","nullable":true,"enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR",null]},"importSettings":{"type":"object","properties":{"csv":{"nullable":true}}},"bankConnection":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["finApi"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"finApiAccount":{"type":"object","properties":{"id":{"type":"number","description":"The FinAPI internal ID for the connected bank account."},"iban":{"type":"string","nullable":true,"description":"The IBAN of the connected bank account. Null if not available."},"institution":{"type":"object","properties":{"id":{"type":"number","description":"The FinAPI internal ID for the banking institution."},"name":{"type":"string","description":"The name of the banking institution."},"bic":{"type":"string","nullable":true,"description":"The BIC (Bank Identifier Code) of the institution. Null if not available."},"logoStored":{"type":"boolean","description":"Flag indicating if a logo is available for this bank."}},"required":["id","name","bic","logoStored"],"description":"Details of the banking institution connected via FinAPI."},"createdUserId":{"type":"string","description":"The SaaSFlow user ID of the user who set up this bank connection."}},"required":["id","iban","institution","createdUserId"],"additionalProperties":false,"description":"Details of the FinAPI connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","finApiAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["plaid"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"plaidAccount":{"type":"object","properties":{"id":{"type":"string","description":"The Plaid account ID for the connected bank account."},"mask":{"type":"string","nullable":true,"description":"The last 2-4 characters of the account number. Null if not available."},"type":{"type":"string","enum":["investment","credit","depository","loan","brokerage","other"],"description":"The type of the account."},"subtype":{"type":"string","nullable":true,"description":"The subtype of the account. Null if not available."},"institution":{"type":"object","properties":{"id":{"type":"string","description":"The Plaid institution ID for the banking institution."},"name":{"type":"string","description":"The name of the banking institution."},"url":{"type":"string","nullable":true,"description":"The URL of the banking institution. Null if not available."},"logoStored":{"type":"boolean","description":"Flag indicating if a logo is available for this bank."},"routingNumbers":{"type":"array","nullable":true,"items":{"type":"string"},"description":"The routing numbers of the banking institution. Null if not available."},"primaryColor":{"type":"string","nullable":true,"description":"The primary color of the banking institution. Null if not available."}},"required":["id","name","url","logoStored","routingNumbers","primaryColor"],"additionalProperties":false,"description":"Details of the banking institution connected via Plaid."},"createdUserId":{"type":"string","description":"The ID of the user who set up this bank connection."},"itemId":{"type":"string","description":"The Plaid item ID for the connected bank account representing a user to bank relationship."}},"required":["id","mask","type","subtype","institution","createdUserId","itemId"],"additionalProperties":false,"description":"Details of the Plaid connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","plaidAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["stripe"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"stripeAccount":{"type":"object","properties":{"id":{"type":"string","description":"The Stripe account ID."}},"required":["id"],"additionalProperties":false,"description":"Details of the Stripe connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","stripeAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["stripeLoan"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"stripeLoanAccount":{"type":"object","properties":{"stripeAccountId":{"type":"string","description":"The Stripe account ID this loan belongs to."},"flexLoanId":{"type":"string","description":"The Stripe Capital Flex Loan ID."}},"required":["stripeAccountId","flexLoanId"],"additionalProperties":false,"description":"Details of the Stripe Capital Flex Loan account."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","stripeLoanAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["datevPayroll"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["finway"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["pleo"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false}]},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"transactionCount":{"type":"number","description":"The number of transactions associated with this account."},"openTransactionCount":{"type":"number","description":"The number of open transactions associated with this account."},"lastTransactionDate":{"type":"string","nullable":true,"format":"date-time","description":"The date of the last transaction associated with this account."},"integration":{"oneOf":[{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["stripe"],"description":"The type of integration."},"stripeMode":{"type":"string","enum":["test","live"],"description":"The mode of the Stripe integration (test or live)."},"lastAccountSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful account synchronization. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSubscriptionSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful subscription synchronization. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","lastAccountSyncTime","lastSubscriptionSyncTime","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["slack"],"description":"The type of integration."},"slackChannel":{"type":"string","description":"The Slack channel name."},"slackChannelId":{"type":"string","description":"The Slack channel ID."},"slackTeamId":{"type":"string","description":"The Slack team ID."},"slackTeamName":{"type":"string","description":"The Slack team name."},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","slackChannel","slackChannelId","slackTeamId","slackTeamName","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["hubspot"],"description":"The type of integration."},"hubspotPortalId":{"type":"string","description":"The HubSpot portal (account) ID."},"lastSubscriptionSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful subscription synchronization. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","hubspotPortalId","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["datevPayroll"],"description":"The type of integration."},"lastUploadTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful CSV upload. Null if never uploaded. Format: YYYY-MM-DDTHH:MM:SSZ"},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","lastUploadTime","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["finway"],"description":"The type of integration."},"lastWalletUploadTime":{"type":"string","nullable":true,"format":"date-time","description":"ISO datetime of the last successful wallet statement upload. Null if never."},"lastAntragUploadTime":{"type":"string","nullable":true,"format":"date-time","description":"ISO datetime of the last successful Antrag ('Alle Formate' zip) upload. Null if never."},"costCategoryMap":{"type":"object","additionalProperties":{"type":"object","properties":{"template":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string","description":"The default category to assign to transactions from this counterparty."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"The default date rule to apply to transactions from this counterparty."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The share of the transaction amount that is considered revenue in percent."},"cogs":{"type":"number","description":"The share of the transaction amount that is considered cost of goods sold in percent."},"cac":{"type":"number","description":"The share of the transaction amount that is considered customer acquisition cost in percent."},"pd":{"type":"number","description":"The share of the transaction amount that is considered product development in percent."},"ga":{"type":"number","description":"The share of the transaction amount that is considered general and administrative in percent."},"no":{"type":"number","description":"The share of the transaction amount that is considered non-operating expenses in percent."},"neutral":{"type":"number","description":"The share of the transaction amount that is considered neutral in percent."}},"additionalProperties":false,"description":"The default split of the transaction amount into different Profit & Loss (P&L) types. The sum of the percentages needs to be 100%."},"passThroughTax":{"type":"number","description":"The pass-through tax (e.g. VAT) that comes on top of the amount covered by the P&L split."}},"required":["categoryId","usingDateRule","plSplit","passThroughTax"],"additionalProperties":false,"description":"Categorization template applied to every wallet payment line under this cost center. Null means skipped. `passThroughTax` and `usingDateRule` are placeholders for Finway — real tax / dates come from the Antrag line."},"label":{"type":"string","description":"Human-readable Kostenstelle label as last seen in Finway (e.g. 'Materialkosten/ Produktion'). Refreshed on every Antrag upload."},"mappedTime":{"type":"string","format":"date-time","description":"ISO datetime the mapping was created."},"mappedByUserId":{"type":"string","description":"Firebase UID that created the mapping."}},"required":["template","label","mappedTime","mappedByUserId"]},"default":{},"description":"Map keyed by Finway CostCenter1ID (e.g. '30') to the chosen SaaSFlow category. Always present in Antrag exports, stable across Finway tenants — preferred over Sachkonto string keying."},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","lastWalletUploadTime","lastAntragUploadTime","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["pleo"],"description":"The type of integration."},"lastExportUploadTime":{"type":"string","nullable":true,"format":"date-time","description":"ISO datetime of the last successful Pleo export upload. Null if never."},"lastReimbursementsUploadTime":{"type":"string","nullable":true,"format":"date-time","default":null,"description":"ISO datetime of the last successful Pleo reimbursements (Rückerstattungen) upload. Null if never."},"plMappingField":{"type":"object","nullable":true,"properties":{"keyColumn":{"type":"string","description":"CSV column header whose value uniquely identifies the categorization bucket (e.g. 'Chart of Accounts - Code')."},"labelColumn":{"type":"string","nullable":true,"description":"Optional CSV column header used as the human-readable label for picker rows. Null falls back to using the keyColumn value as both key and label."}},"required":["keyColumn","labelColumn"],"description":"CSV column pair used to derive the categorization key + label. Null until the first upload completes the column-picker step."},"mappingValueMap":{"type":"object","additionalProperties":{"type":"object","properties":{"template":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string","description":"The default category to assign to transactions from this counterparty."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"The default date rule to apply to transactions from this counterparty."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The share of the transaction amount that is considered revenue in percent."},"cogs":{"type":"number","description":"The share of the transaction amount that is considered cost of goods sold in percent."},"cac":{"type":"number","description":"The share of the transaction amount that is considered customer acquisition cost in percent."},"pd":{"type":"number","description":"The share of the transaction amount that is considered product development in percent."},"ga":{"type":"number","description":"The share of the transaction amount that is considered general and administrative in percent."},"no":{"type":"number","description":"The share of the transaction amount that is considered non-operating expenses in percent."},"neutral":{"type":"number","description":"The share of the transaction amount that is considered neutral in percent."}},"additionalProperties":false,"description":"The default split of the transaction amount into different Profit & Loss (P&L) types. The sum of the percentages needs to be 100%."},"passThroughTax":{"type":"number","description":"The pass-through tax (e.g. VAT) that comes on top of the amount covered by the P&L split."}},"required":["categoryId","usingDateRule","plSplit","passThroughTax"],"additionalProperties":false,"description":"Categorization template applied to every Pleo wallet row whose mapping field equals this entry key. Null means skipped. `passThroughTax` and `usingDateRule` are placeholders — real values come from the CSV row at apply time."},"label":{"type":"string","description":"Human-readable label for the mapping value (typically the matching \"Name\" column, e.g. \"266 Marketing Magazine FR\" when the key is \"266\"). Refreshed on every Pleo upload."},"mappedTime":{"type":"string","format":"date-time","description":"ISO datetime the mapping was created."},"mappedByUserId":{"type":"string","description":"Firebase UID that created the mapping."}},"required":["template","label","mappedTime","mappedByUserId"]},"default":{},"description":"Map keyed by the chosen CSV column's value (e.g. '266') to the user-picked SaaSFlow category template. Re-used on every subsequent upload — only new mapping values are surfaced to the picker."},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","lastExportUploadTime","plMappingField","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["salesforce"],"description":"The type of integration."},"salesforceOrgId":{"type":"string","description":"The Salesforce org ID (15- or 18-char, starts with 00D)."},"salesforceInstanceUrl":{"type":"string","description":"The per-org Salesforce REST API host returned by OAuth (e.g. https://acme.my.salesforce.com). Required for every API call to this org."},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","salesforceOrgId","salesforceInstanceUrl","id"],"additionalProperties":false},{"nullable":true}],"description":"The integration managing this account (null for manual accounts or when the bank connection has no integrationId)."}},"required":["id","companyId","type","name","accountNumber","includeInCashBalance","accountGroupId","archived","expectedAnnualReturn","order","defaultCurrency","defaultCategoryId","importType","transitCurrency","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","transactionCount","openTransactionCount","lastTransactionDate","integration"]}}}}}}},"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["bank","cash","creditCard","loan","other"]},"name":{"type":"string","minLength":1},"includeInCashBalance":{"type":"boolean"},"defaultCurrency":{"type":"string","minLength":1},"importType":{"type":"string","enum":["manual","automated"]},"order":{"type":"number"},"accountGroupId":{"type":"string","nullable":true},"archived":{"type":"boolean","default":false},"accountNumber":{"type":"string","nullable":true},"expectedAnnualReturn":{"type":"number","nullable":true},"defaultCategoryId":{"type":"string","nullable":true},"initialBalance":{"type":"object","properties":{"value":{"type":"string"},"currency":{"type":"string"},"date":{"type":"string"}},"required":["value","currency","date"]}},"required":["type","name","includeInCashBalance","defaultCurrency","importType","order"]}}}},"responses":{"201":{"description":"Created account","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["bank","cash","creditCard","loan","other","transit"],"description":"The type of account: bank, cash, creditCard, loan, or other."},"name":{"type":"string","description":"The name of the account."},"accountNumber":{"type":"string","nullable":true,"description":"The bank account number. Null if not provided."},"includeInCashBalance":{"type":"boolean","description":"Whether this account should be included in cash balance calculations and cash flow reports."},"accountGroupId":{"type":"string","nullable":true,"format":"uuid","description":"The ID of the account group this account belongs to. Null if not part of any group."},"archived":{"type":"boolean","description":"Flag indicating if the account is archived and should be hidden from most views."},"expectedAnnualReturn":{"type":"number","nullable":true,"minimum":-8388608,"maximum":8388607,"description":"The expected annual return percentage for this account, if applicable."},"order":{"type":"number","minimum":-8388608,"maximum":8388607,"description":"A number used for ordering accounts in the UI."},"defaultCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The default currency for transactions recorded under this account."},"defaultCategoryId":{"type":"string","nullable":true,"description":"The default category ID to assign to new transactions for this account."},"importType":{"type":"string","enum":["manual","automated"],"description":"Whether transactions are imported manually or via bank connection."},"transitCurrency":{"type":"string","nullable":true,"enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR",null]},"importSettings":{"type":"object","properties":{"csv":{"nullable":true}}},"bankConnection":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["finApi"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"finApiAccount":{"type":"object","properties":{"id":{"type":"number","description":"The FinAPI internal ID for the connected bank account."},"iban":{"type":"string","nullable":true,"description":"The IBAN of the connected bank account. Null if not available."},"institution":{"type":"object","properties":{"id":{"type":"number","description":"The FinAPI internal ID for the banking institution."},"name":{"type":"string","description":"The name of the banking institution."},"bic":{"type":"string","nullable":true,"description":"The BIC (Bank Identifier Code) of the institution. Null if not available."},"logoStored":{"type":"boolean","description":"Flag indicating if a logo is available for this bank."}},"required":["id","name","bic","logoStored"],"description":"Details of the banking institution connected via FinAPI."},"createdUserId":{"type":"string","description":"The SaaSFlow user ID of the user who set up this bank connection."}},"required":["id","iban","institution","createdUserId"],"additionalProperties":false,"description":"Details of the FinAPI connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","finApiAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["plaid"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"plaidAccount":{"type":"object","properties":{"id":{"type":"string","description":"The Plaid account ID for the connected bank account."},"mask":{"type":"string","nullable":true,"description":"The last 2-4 characters of the account number. Null if not available."},"type":{"type":"string","enum":["investment","credit","depository","loan","brokerage","other"],"description":"The type of the account."},"subtype":{"type":"string","nullable":true,"description":"The subtype of the account. Null if not available."},"institution":{"type":"object","properties":{"id":{"type":"string","description":"The Plaid institution ID for the banking institution."},"name":{"type":"string","description":"The name of the banking institution."},"url":{"type":"string","nullable":true,"description":"The URL of the banking institution. Null if not available."},"logoStored":{"type":"boolean","description":"Flag indicating if a logo is available for this bank."},"routingNumbers":{"type":"array","nullable":true,"items":{"type":"string"},"description":"The routing numbers of the banking institution. Null if not available."},"primaryColor":{"type":"string","nullable":true,"description":"The primary color of the banking institution. Null if not available."}},"required":["id","name","url","logoStored","routingNumbers","primaryColor"],"additionalProperties":false,"description":"Details of the banking institution connected via Plaid."},"createdUserId":{"type":"string","description":"The ID of the user who set up this bank connection."},"itemId":{"type":"string","description":"The Plaid item ID for the connected bank account representing a user to bank relationship."}},"required":["id","mask","type","subtype","institution","createdUserId","itemId"],"additionalProperties":false,"description":"Details of the Plaid connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","plaidAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["stripe"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"stripeAccount":{"type":"object","properties":{"id":{"type":"string","description":"The Stripe account ID."}},"required":["id"],"additionalProperties":false,"description":"Details of the Stripe connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","stripeAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["stripeLoan"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"stripeLoanAccount":{"type":"object","properties":{"stripeAccountId":{"type":"string","description":"The Stripe account ID this loan belongs to."},"flexLoanId":{"type":"string","description":"The Stripe Capital Flex Loan ID."}},"required":["stripeAccountId","flexLoanId"],"additionalProperties":false,"description":"Details of the Stripe Capital Flex Loan account."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","stripeLoanAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["datevPayroll"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["finway"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["pleo"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false}]},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","type","name","accountNumber","includeInCashBalance","accountGroupId","archived","expectedAnnualReturn","order","defaultCurrency","defaultCategoryId","importType","transitCurrency","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}}}}},"/companies/{companyId}/accounts/balances":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Start date (YYYY-MM-DD). Balance at this date is the \"previous period\" value."},"required":true,"description":"Start date (YYYY-MM-DD). Balance at this date is the \"previous period\" value.","name":"startDate","in":"query"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"End date (YYYY-MM-DD). Balance at this date is the current value."},"required":true,"description":"End date (YYYY-MM-DD). Balance at this date is the current value.","name":"endDate","in":"query"},{"schema":{"type":"string","description":"Comma-separated account IDs to filter by."},"required":false,"description":"Comma-separated account IDs to filter by.","name":"accountIds","in":"query"}],"responses":{"200":{"description":"Balance per account at the given dates.","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"object","properties":{"value":{"type":"number","description":"Balance at the end of the period."},"valuePreviousPeriod":{"type":"number","description":"Balance at the start of the period."},"valueChange":{"type":"number","description":"Change in balance over the period."},"valuePreviousPeriodWithTransfersAndBalancesAdded":{"type":"number","description":"Balance at the start of the period (same as valuePreviousPeriod for this endpoint)."},"defaultCurrency":{"type":"string","description":"The default currency of the account."}},"required":["value","valuePreviousPeriod","valueChange","valuePreviousPeriodWithTransfersAndBalancesAdded","defaultCurrency"]}}}}}}}},"/companies/{companyId}/accounts/daily_balance":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Start date (YYYY-MM-DD)."},"required":true,"description":"Start date (YYYY-MM-DD).","name":"startDate","in":"query"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"End date (YYYY-MM-DD)."},"required":true,"description":"End date (YYYY-MM-DD).","name":"endDate","in":"query"},{"schema":{"type":"string","description":"Comma-separated account IDs to filter by."},"required":false,"description":"Comma-separated account IDs to filter by.","name":"accountIds","in":"query"}],"responses":{"200":{"description":"Daily cumulative balance in base currency.","content":{"application/json":{"schema":{"type":"array","items":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"}]},"minItems":2,"maxItems":2},"description":"Array of [date, cumulativeBalance] tuples in base currency."}}}}}}},"/companies/{companyId}/accounts/{accountId}":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"accountId","in":"path"}],"responses":{"200":{"description":"Account details","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["bank","cash","creditCard","loan","other","transit"],"description":"The type of account: bank, cash, creditCard, loan, or other."},"name":{"type":"string","description":"The name of the account."},"accountNumber":{"type":"string","nullable":true,"description":"The bank account number. Null if not provided."},"includeInCashBalance":{"type":"boolean","description":"Whether this account should be included in cash balance calculations and cash flow reports."},"accountGroupId":{"type":"string","nullable":true,"format":"uuid","description":"The ID of the account group this account belongs to. Null if not part of any group."},"archived":{"type":"boolean","description":"Flag indicating if the account is archived and should be hidden from most views."},"expectedAnnualReturn":{"type":"number","nullable":true,"minimum":-8388608,"maximum":8388607,"description":"The expected annual return percentage for this account, if applicable."},"order":{"type":"number","minimum":-8388608,"maximum":8388607,"description":"A number used for ordering accounts in the UI."},"defaultCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The default currency for transactions recorded under this account."},"defaultCategoryId":{"type":"string","nullable":true,"description":"The default category ID to assign to new transactions for this account."},"importType":{"type":"string","enum":["manual","automated"],"description":"Whether transactions are imported manually or via bank connection."},"transitCurrency":{"type":"string","nullable":true,"enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR",null]},"importSettings":{"type":"object","properties":{"csv":{"nullable":true}}},"bankConnection":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["finApi"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"finApiAccount":{"type":"object","properties":{"id":{"type":"number","description":"The FinAPI internal ID for the connected bank account."},"iban":{"type":"string","nullable":true,"description":"The IBAN of the connected bank account. Null if not available."},"institution":{"type":"object","properties":{"id":{"type":"number","description":"The FinAPI internal ID for the banking institution."},"name":{"type":"string","description":"The name of the banking institution."},"bic":{"type":"string","nullable":true,"description":"The BIC (Bank Identifier Code) of the institution. Null if not available."},"logoStored":{"type":"boolean","description":"Flag indicating if a logo is available for this bank."}},"required":["id","name","bic","logoStored"],"description":"Details of the banking institution connected via FinAPI."},"createdUserId":{"type":"string","description":"The SaaSFlow user ID of the user who set up this bank connection."}},"required":["id","iban","institution","createdUserId"],"additionalProperties":false,"description":"Details of the FinAPI connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","finApiAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["plaid"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"plaidAccount":{"type":"object","properties":{"id":{"type":"string","description":"The Plaid account ID for the connected bank account."},"mask":{"type":"string","nullable":true,"description":"The last 2-4 characters of the account number. Null if not available."},"type":{"type":"string","enum":["investment","credit","depository","loan","brokerage","other"],"description":"The type of the account."},"subtype":{"type":"string","nullable":true,"description":"The subtype of the account. Null if not available."},"institution":{"type":"object","properties":{"id":{"type":"string","description":"The Plaid institution ID for the banking institution."},"name":{"type":"string","description":"The name of the banking institution."},"url":{"type":"string","nullable":true,"description":"The URL of the banking institution. Null if not available."},"logoStored":{"type":"boolean","description":"Flag indicating if a logo is available for this bank."},"routingNumbers":{"type":"array","nullable":true,"items":{"type":"string"},"description":"The routing numbers of the banking institution. Null if not available."},"primaryColor":{"type":"string","nullable":true,"description":"The primary color of the banking institution. Null if not available."}},"required":["id","name","url","logoStored","routingNumbers","primaryColor"],"additionalProperties":false,"description":"Details of the banking institution connected via Plaid."},"createdUserId":{"type":"string","description":"The ID of the user who set up this bank connection."},"itemId":{"type":"string","description":"The Plaid item ID for the connected bank account representing a user to bank relationship."}},"required":["id","mask","type","subtype","institution","createdUserId","itemId"],"additionalProperties":false,"description":"Details of the Plaid connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","plaidAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["stripe"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"stripeAccount":{"type":"object","properties":{"id":{"type":"string","description":"The Stripe account ID."}},"required":["id"],"additionalProperties":false,"description":"Details of the Stripe connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","stripeAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["stripeLoan"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"stripeLoanAccount":{"type":"object","properties":{"stripeAccountId":{"type":"string","description":"The Stripe account ID this loan belongs to."},"flexLoanId":{"type":"string","description":"The Stripe Capital Flex Loan ID."}},"required":["stripeAccountId","flexLoanId"],"additionalProperties":false,"description":"Details of the Stripe Capital Flex Loan account."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","stripeLoanAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["datevPayroll"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["finway"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["pleo"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false}]},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"transactionCount":{"type":"number","description":"The number of transactions associated with this account."},"openTransactionCount":{"type":"number","description":"The number of open transactions associated with this account."},"lastTransactionDate":{"type":"string","nullable":true,"format":"date-time","description":"The date of the last transaction associated with this account."},"integration":{"oneOf":[{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["stripe"],"description":"The type of integration."},"stripeMode":{"type":"string","enum":["test","live"],"description":"The mode of the Stripe integration (test or live)."},"lastAccountSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful account synchronization. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSubscriptionSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful subscription synchronization. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","lastAccountSyncTime","lastSubscriptionSyncTime","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["slack"],"description":"The type of integration."},"slackChannel":{"type":"string","description":"The Slack channel name."},"slackChannelId":{"type":"string","description":"The Slack channel ID."},"slackTeamId":{"type":"string","description":"The Slack team ID."},"slackTeamName":{"type":"string","description":"The Slack team name."},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","slackChannel","slackChannelId","slackTeamId","slackTeamName","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["hubspot"],"description":"The type of integration."},"hubspotPortalId":{"type":"string","description":"The HubSpot portal (account) ID."},"lastSubscriptionSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful subscription synchronization. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","hubspotPortalId","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["datevPayroll"],"description":"The type of integration."},"lastUploadTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful CSV upload. Null if never uploaded. Format: YYYY-MM-DDTHH:MM:SSZ"},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","lastUploadTime","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["finway"],"description":"The type of integration."},"lastWalletUploadTime":{"type":"string","nullable":true,"format":"date-time","description":"ISO datetime of the last successful wallet statement upload. Null if never."},"lastAntragUploadTime":{"type":"string","nullable":true,"format":"date-time","description":"ISO datetime of the last successful Antrag ('Alle Formate' zip) upload. Null if never."},"costCategoryMap":{"type":"object","additionalProperties":{"type":"object","properties":{"template":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string","description":"The default category to assign to transactions from this counterparty."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"The default date rule to apply to transactions from this counterparty."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The share of the transaction amount that is considered revenue in percent."},"cogs":{"type":"number","description":"The share of the transaction amount that is considered cost of goods sold in percent."},"cac":{"type":"number","description":"The share of the transaction amount that is considered customer acquisition cost in percent."},"pd":{"type":"number","description":"The share of the transaction amount that is considered product development in percent."},"ga":{"type":"number","description":"The share of the transaction amount that is considered general and administrative in percent."},"no":{"type":"number","description":"The share of the transaction amount that is considered non-operating expenses in percent."},"neutral":{"type":"number","description":"The share of the transaction amount that is considered neutral in percent."}},"additionalProperties":false,"description":"The default split of the transaction amount into different Profit & Loss (P&L) types. The sum of the percentages needs to be 100%."},"passThroughTax":{"type":"number","description":"The pass-through tax (e.g. VAT) that comes on top of the amount covered by the P&L split."}},"required":["categoryId","usingDateRule","plSplit","passThroughTax"],"additionalProperties":false,"description":"Categorization template applied to every wallet payment line under this cost center. Null means skipped. `passThroughTax` and `usingDateRule` are placeholders for Finway — real tax / dates come from the Antrag line."},"label":{"type":"string","description":"Human-readable Kostenstelle label as last seen in Finway (e.g. 'Materialkosten/ Produktion'). Refreshed on every Antrag upload."},"mappedTime":{"type":"string","format":"date-time","description":"ISO datetime the mapping was created."},"mappedByUserId":{"type":"string","description":"Firebase UID that created the mapping."}},"required":["template","label","mappedTime","mappedByUserId"]},"default":{},"description":"Map keyed by Finway CostCenter1ID (e.g. '30') to the chosen SaaSFlow category. Always present in Antrag exports, stable across Finway tenants — preferred over Sachkonto string keying."},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","lastWalletUploadTime","lastAntragUploadTime","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["pleo"],"description":"The type of integration."},"lastExportUploadTime":{"type":"string","nullable":true,"format":"date-time","description":"ISO datetime of the last successful Pleo export upload. Null if never."},"lastReimbursementsUploadTime":{"type":"string","nullable":true,"format":"date-time","default":null,"description":"ISO datetime of the last successful Pleo reimbursements (Rückerstattungen) upload. Null if never."},"plMappingField":{"type":"object","nullable":true,"properties":{"keyColumn":{"type":"string","description":"CSV column header whose value uniquely identifies the categorization bucket (e.g. 'Chart of Accounts - Code')."},"labelColumn":{"type":"string","nullable":true,"description":"Optional CSV column header used as the human-readable label for picker rows. Null falls back to using the keyColumn value as both key and label."}},"required":["keyColumn","labelColumn"],"description":"CSV column pair used to derive the categorization key + label. Null until the first upload completes the column-picker step."},"mappingValueMap":{"type":"object","additionalProperties":{"type":"object","properties":{"template":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string","description":"The default category to assign to transactions from this counterparty."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"The default date rule to apply to transactions from this counterparty."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The share of the transaction amount that is considered revenue in percent."},"cogs":{"type":"number","description":"The share of the transaction amount that is considered cost of goods sold in percent."},"cac":{"type":"number","description":"The share of the transaction amount that is considered customer acquisition cost in percent."},"pd":{"type":"number","description":"The share of the transaction amount that is considered product development in percent."},"ga":{"type":"number","description":"The share of the transaction amount that is considered general and administrative in percent."},"no":{"type":"number","description":"The share of the transaction amount that is considered non-operating expenses in percent."},"neutral":{"type":"number","description":"The share of the transaction amount that is considered neutral in percent."}},"additionalProperties":false,"description":"The default split of the transaction amount into different Profit & Loss (P&L) types. The sum of the percentages needs to be 100%."},"passThroughTax":{"type":"number","description":"The pass-through tax (e.g. VAT) that comes on top of the amount covered by the P&L split."}},"required":["categoryId","usingDateRule","plSplit","passThroughTax"],"additionalProperties":false,"description":"Categorization template applied to every Pleo wallet row whose mapping field equals this entry key. Null means skipped. `passThroughTax` and `usingDateRule` are placeholders — real values come from the CSV row at apply time."},"label":{"type":"string","description":"Human-readable label for the mapping value (typically the matching \"Name\" column, e.g. \"266 Marketing Magazine FR\" when the key is \"266\"). Refreshed on every Pleo upload."},"mappedTime":{"type":"string","format":"date-time","description":"ISO datetime the mapping was created."},"mappedByUserId":{"type":"string","description":"Firebase UID that created the mapping."}},"required":["template","label","mappedTime","mappedByUserId"]},"default":{},"description":"Map keyed by the chosen CSV column's value (e.g. '266') to the user-picked SaaSFlow category template. Re-used on every subsequent upload — only new mapping values are surfaced to the picker."},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","lastExportUploadTime","plMappingField","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["salesforce"],"description":"The type of integration."},"salesforceOrgId":{"type":"string","description":"The Salesforce org ID (15- or 18-char, starts with 00D)."},"salesforceInstanceUrl":{"type":"string","description":"The per-org Salesforce REST API host returned by OAuth (e.g. https://acme.my.salesforce.com). Required for every API call to this org."},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","salesforceOrgId","salesforceInstanceUrl","id"],"additionalProperties":false},{"nullable":true}],"description":"The integration managing this account (null for manual accounts or when the bank connection has no integrationId)."}},"required":["id","companyId","type","name","accountNumber","includeInCashBalance","accountGroupId","archived","expectedAnnualReturn","order","defaultCurrency","defaultCategoryId","importType","transitCurrency","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","transactionCount","openTransactionCount","lastTransactionDate","integration"]}}}},"404":{"description":"Account not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"accountId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["bank","cash","creditCard","loan","other"]},"name":{"type":"string","minLength":1},"includeInCashBalance":{"type":"boolean"},"defaultCurrency":{"type":"string","minLength":1},"importType":{"type":"string","enum":["manual","automated"]},"order":{"type":"number"},"accountGroupId":{"type":"string","nullable":true},"archived":{"type":"boolean"},"accountNumber":{"type":"string","nullable":true},"expectedAnnualReturn":{"type":"number","nullable":true},"defaultCategoryId":{"type":"string","nullable":true},"importSettings":{"nullable":true}}}}}},"responses":{"200":{"description":"Updated account","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["bank","cash","creditCard","loan","other","transit"],"description":"The type of account: bank, cash, creditCard, loan, or other."},"name":{"type":"string","description":"The name of the account."},"accountNumber":{"type":"string","nullable":true,"description":"The bank account number. Null if not provided."},"includeInCashBalance":{"type":"boolean","description":"Whether this account should be included in cash balance calculations and cash flow reports."},"accountGroupId":{"type":"string","nullable":true,"format":"uuid","description":"The ID of the account group this account belongs to. Null if not part of any group."},"archived":{"type":"boolean","description":"Flag indicating if the account is archived and should be hidden from most views."},"expectedAnnualReturn":{"type":"number","nullable":true,"minimum":-8388608,"maximum":8388607,"description":"The expected annual return percentage for this account, if applicable."},"order":{"type":"number","minimum":-8388608,"maximum":8388607,"description":"A number used for ordering accounts in the UI."},"defaultCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The default currency for transactions recorded under this account."},"defaultCategoryId":{"type":"string","nullable":true,"description":"The default category ID to assign to new transactions for this account."},"importType":{"type":"string","enum":["manual","automated"],"description":"Whether transactions are imported manually or via bank connection."},"transitCurrency":{"type":"string","nullable":true,"enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR",null]},"importSettings":{"type":"object","properties":{"csv":{"nullable":true}}},"bankConnection":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["finApi"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"finApiAccount":{"type":"object","properties":{"id":{"type":"number","description":"The FinAPI internal ID for the connected bank account."},"iban":{"type":"string","nullable":true,"description":"The IBAN of the connected bank account. Null if not available."},"institution":{"type":"object","properties":{"id":{"type":"number","description":"The FinAPI internal ID for the banking institution."},"name":{"type":"string","description":"The name of the banking institution."},"bic":{"type":"string","nullable":true,"description":"The BIC (Bank Identifier Code) of the institution. Null if not available."},"logoStored":{"type":"boolean","description":"Flag indicating if a logo is available for this bank."}},"required":["id","name","bic","logoStored"],"description":"Details of the banking institution connected via FinAPI."},"createdUserId":{"type":"string","description":"The SaaSFlow user ID of the user who set up this bank connection."}},"required":["id","iban","institution","createdUserId"],"additionalProperties":false,"description":"Details of the FinAPI connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","finApiAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["plaid"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"plaidAccount":{"type":"object","properties":{"id":{"type":"string","description":"The Plaid account ID for the connected bank account."},"mask":{"type":"string","nullable":true,"description":"The last 2-4 characters of the account number. Null if not available."},"type":{"type":"string","enum":["investment","credit","depository","loan","brokerage","other"],"description":"The type of the account."},"subtype":{"type":"string","nullable":true,"description":"The subtype of the account. Null if not available."},"institution":{"type":"object","properties":{"id":{"type":"string","description":"The Plaid institution ID for the banking institution."},"name":{"type":"string","description":"The name of the banking institution."},"url":{"type":"string","nullable":true,"description":"The URL of the banking institution. Null if not available."},"logoStored":{"type":"boolean","description":"Flag indicating if a logo is available for this bank."},"routingNumbers":{"type":"array","nullable":true,"items":{"type":"string"},"description":"The routing numbers of the banking institution. Null if not available."},"primaryColor":{"type":"string","nullable":true,"description":"The primary color of the banking institution. Null if not available."}},"required":["id","name","url","logoStored","routingNumbers","primaryColor"],"additionalProperties":false,"description":"Details of the banking institution connected via Plaid."},"createdUserId":{"type":"string","description":"The ID of the user who set up this bank connection."},"itemId":{"type":"string","description":"The Plaid item ID for the connected bank account representing a user to bank relationship."}},"required":["id","mask","type","subtype","institution","createdUserId","itemId"],"additionalProperties":false,"description":"Details of the Plaid connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","plaidAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["stripe"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"stripeAccount":{"type":"object","properties":{"id":{"type":"string","description":"The Stripe account ID."}},"required":["id"],"additionalProperties":false,"description":"Details of the Stripe connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","stripeAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["stripeLoan"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"stripeLoanAccount":{"type":"object","properties":{"stripeAccountId":{"type":"string","description":"The Stripe account ID this loan belongs to."},"flexLoanId":{"type":"string","description":"The Stripe Capital Flex Loan ID."}},"required":["stripeAccountId","flexLoanId"],"additionalProperties":false,"description":"Details of the Stripe Capital Flex Loan account."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","stripeLoanAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["datevPayroll"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["finway"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["pleo"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false}]},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","type","name","accountNumber","includeInCashBalance","accountGroupId","archived","expectedAnnualReturn","order","defaultCurrency","defaultCategoryId","importType","transitCurrency","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Account not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"An active transit account for this currency already exists — archive it first","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"422":{"description":"Transit accounts cannot change their type or currency","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"delete":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"accountId","in":"path"}],"responses":{"200":{"description":"Account deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}}},"/companies/{companyId}/accounts/{accountId}/archive":{"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"accountId","in":"path"}],"responses":{"200":{"description":"Account archived","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["bank","cash","creditCard","loan","other","transit"],"description":"The type of account: bank, cash, creditCard, loan, or other."},"name":{"type":"string","description":"The name of the account."},"accountNumber":{"type":"string","nullable":true,"description":"The bank account number. Null if not provided."},"includeInCashBalance":{"type":"boolean","description":"Whether this account should be included in cash balance calculations and cash flow reports."},"accountGroupId":{"type":"string","nullable":true,"format":"uuid","description":"The ID of the account group this account belongs to. Null if not part of any group."},"archived":{"type":"boolean","description":"Flag indicating if the account is archived and should be hidden from most views."},"expectedAnnualReturn":{"type":"number","nullable":true,"minimum":-8388608,"maximum":8388607,"description":"The expected annual return percentage for this account, if applicable."},"order":{"type":"number","minimum":-8388608,"maximum":8388607,"description":"A number used for ordering accounts in the UI."},"defaultCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The default currency for transactions recorded under this account."},"defaultCategoryId":{"type":"string","nullable":true,"description":"The default category ID to assign to new transactions for this account."},"importType":{"type":"string","enum":["manual","automated"],"description":"Whether transactions are imported manually or via bank connection."},"transitCurrency":{"type":"string","nullable":true,"enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR",null]},"importSettings":{"type":"object","properties":{"csv":{"nullable":true}}},"bankConnection":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["finApi"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"finApiAccount":{"type":"object","properties":{"id":{"type":"number","description":"The FinAPI internal ID for the connected bank account."},"iban":{"type":"string","nullable":true,"description":"The IBAN of the connected bank account. Null if not available."},"institution":{"type":"object","properties":{"id":{"type":"number","description":"The FinAPI internal ID for the banking institution."},"name":{"type":"string","description":"The name of the banking institution."},"bic":{"type":"string","nullable":true,"description":"The BIC (Bank Identifier Code) of the institution. Null if not available."},"logoStored":{"type":"boolean","description":"Flag indicating if a logo is available for this bank."}},"required":["id","name","bic","logoStored"],"description":"Details of the banking institution connected via FinAPI."},"createdUserId":{"type":"string","description":"The SaaSFlow user ID of the user who set up this bank connection."}},"required":["id","iban","institution","createdUserId"],"additionalProperties":false,"description":"Details of the FinAPI connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","finApiAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["plaid"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"plaidAccount":{"type":"object","properties":{"id":{"type":"string","description":"The Plaid account ID for the connected bank account."},"mask":{"type":"string","nullable":true,"description":"The last 2-4 characters of the account number. Null if not available."},"type":{"type":"string","enum":["investment","credit","depository","loan","brokerage","other"],"description":"The type of the account."},"subtype":{"type":"string","nullable":true,"description":"The subtype of the account. Null if not available."},"institution":{"type":"object","properties":{"id":{"type":"string","description":"The Plaid institution ID for the banking institution."},"name":{"type":"string","description":"The name of the banking institution."},"url":{"type":"string","nullable":true,"description":"The URL of the banking institution. Null if not available."},"logoStored":{"type":"boolean","description":"Flag indicating if a logo is available for this bank."},"routingNumbers":{"type":"array","nullable":true,"items":{"type":"string"},"description":"The routing numbers of the banking institution. Null if not available."},"primaryColor":{"type":"string","nullable":true,"description":"The primary color of the banking institution. Null if not available."}},"required":["id","name","url","logoStored","routingNumbers","primaryColor"],"additionalProperties":false,"description":"Details of the banking institution connected via Plaid."},"createdUserId":{"type":"string","description":"The ID of the user who set up this bank connection."},"itemId":{"type":"string","description":"The Plaid item ID for the connected bank account representing a user to bank relationship."}},"required":["id","mask","type","subtype","institution","createdUserId","itemId"],"additionalProperties":false,"description":"Details of the Plaid connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","plaidAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["stripe"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"stripeAccount":{"type":"object","properties":{"id":{"type":"string","description":"The Stripe account ID."}},"required":["id"],"additionalProperties":false,"description":"Details of the Stripe connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","stripeAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["stripeLoan"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"stripeLoanAccount":{"type":"object","properties":{"stripeAccountId":{"type":"string","description":"The Stripe account ID this loan belongs to."},"flexLoanId":{"type":"string","description":"The Stripe Capital Flex Loan ID."}},"required":["stripeAccountId","flexLoanId"],"additionalProperties":false,"description":"Details of the Stripe Capital Flex Loan account."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","stripeLoanAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["datevPayroll"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["finway"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["pleo"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false}]},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","type","name","accountNumber","includeInCashBalance","accountGroupId","archived","expectedAnnualReturn","order","defaultCurrency","defaultCategoryId","importType","transitCurrency","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Account not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/accounts/{accountId}/unarchive":{"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"accountId","in":"path"}],"responses":{"200":{"description":"Account unarchived","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["bank","cash","creditCard","loan","other","transit"],"description":"The type of account: bank, cash, creditCard, loan, or other."},"name":{"type":"string","description":"The name of the account."},"accountNumber":{"type":"string","nullable":true,"description":"The bank account number. Null if not provided."},"includeInCashBalance":{"type":"boolean","description":"Whether this account should be included in cash balance calculations and cash flow reports."},"accountGroupId":{"type":"string","nullable":true,"format":"uuid","description":"The ID of the account group this account belongs to. Null if not part of any group."},"archived":{"type":"boolean","description":"Flag indicating if the account is archived and should be hidden from most views."},"expectedAnnualReturn":{"type":"number","nullable":true,"minimum":-8388608,"maximum":8388607,"description":"The expected annual return percentage for this account, if applicable."},"order":{"type":"number","minimum":-8388608,"maximum":8388607,"description":"A number used for ordering accounts in the UI."},"defaultCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The default currency for transactions recorded under this account."},"defaultCategoryId":{"type":"string","nullable":true,"description":"The default category ID to assign to new transactions for this account."},"importType":{"type":"string","enum":["manual","automated"],"description":"Whether transactions are imported manually or via bank connection."},"transitCurrency":{"type":"string","nullable":true,"enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR",null]},"importSettings":{"type":"object","properties":{"csv":{"nullable":true}}},"bankConnection":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["finApi"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"finApiAccount":{"type":"object","properties":{"id":{"type":"number","description":"The FinAPI internal ID for the connected bank account."},"iban":{"type":"string","nullable":true,"description":"The IBAN of the connected bank account. Null if not available."},"institution":{"type":"object","properties":{"id":{"type":"number","description":"The FinAPI internal ID for the banking institution."},"name":{"type":"string","description":"The name of the banking institution."},"bic":{"type":"string","nullable":true,"description":"The BIC (Bank Identifier Code) of the institution. Null if not available."},"logoStored":{"type":"boolean","description":"Flag indicating if a logo is available for this bank."}},"required":["id","name","bic","logoStored"],"description":"Details of the banking institution connected via FinAPI."},"createdUserId":{"type":"string","description":"The SaaSFlow user ID of the user who set up this bank connection."}},"required":["id","iban","institution","createdUserId"],"additionalProperties":false,"description":"Details of the FinAPI connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","finApiAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["plaid"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"plaidAccount":{"type":"object","properties":{"id":{"type":"string","description":"The Plaid account ID for the connected bank account."},"mask":{"type":"string","nullable":true,"description":"The last 2-4 characters of the account number. Null if not available."},"type":{"type":"string","enum":["investment","credit","depository","loan","brokerage","other"],"description":"The type of the account."},"subtype":{"type":"string","nullable":true,"description":"The subtype of the account. Null if not available."},"institution":{"type":"object","properties":{"id":{"type":"string","description":"The Plaid institution ID for the banking institution."},"name":{"type":"string","description":"The name of the banking institution."},"url":{"type":"string","nullable":true,"description":"The URL of the banking institution. Null if not available."},"logoStored":{"type":"boolean","description":"Flag indicating if a logo is available for this bank."},"routingNumbers":{"type":"array","nullable":true,"items":{"type":"string"},"description":"The routing numbers of the banking institution. Null if not available."},"primaryColor":{"type":"string","nullable":true,"description":"The primary color of the banking institution. Null if not available."}},"required":["id","name","url","logoStored","routingNumbers","primaryColor"],"additionalProperties":false,"description":"Details of the banking institution connected via Plaid."},"createdUserId":{"type":"string","description":"The ID of the user who set up this bank connection."},"itemId":{"type":"string","description":"The Plaid item ID for the connected bank account representing a user to bank relationship."}},"required":["id","mask","type","subtype","institution","createdUserId","itemId"],"additionalProperties":false,"description":"Details of the Plaid connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","plaidAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["stripe"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"stripeAccount":{"type":"object","properties":{"id":{"type":"string","description":"The Stripe account ID."}},"required":["id"],"additionalProperties":false,"description":"Details of the Stripe connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","stripeAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["stripeLoan"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"stripeLoanAccount":{"type":"object","properties":{"stripeAccountId":{"type":"string","description":"The Stripe account ID this loan belongs to."},"flexLoanId":{"type":"string","description":"The Stripe Capital Flex Loan ID."}},"required":["stripeAccountId","flexLoanId"],"additionalProperties":false,"description":"Details of the Stripe Capital Flex Loan account."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","stripeLoanAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["datevPayroll"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["finway"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["pleo"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false}]},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","type","name","accountNumber","includeInCashBalance","accountGroupId","archived","expectedAnnualReturn","order","defaultCurrency","defaultCategoryId","importType","transitCurrency","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Account not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/accounts/{accountId}/change_group":{"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"accountId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"accountGroupId":{"type":"string","nullable":true}},"required":["accountGroupId"]}}}},"responses":{"200":{"description":"Account group changed","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["bank","cash","creditCard","loan","other","transit"],"description":"The type of account: bank, cash, creditCard, loan, or other."},"name":{"type":"string","description":"The name of the account."},"accountNumber":{"type":"string","nullable":true,"description":"The bank account number. Null if not provided."},"includeInCashBalance":{"type":"boolean","description":"Whether this account should be included in cash balance calculations and cash flow reports."},"accountGroupId":{"type":"string","nullable":true,"format":"uuid","description":"The ID of the account group this account belongs to. Null if not part of any group."},"archived":{"type":"boolean","description":"Flag indicating if the account is archived and should be hidden from most views."},"expectedAnnualReturn":{"type":"number","nullable":true,"minimum":-8388608,"maximum":8388607,"description":"The expected annual return percentage for this account, if applicable."},"order":{"type":"number","minimum":-8388608,"maximum":8388607,"description":"A number used for ordering accounts in the UI."},"defaultCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The default currency for transactions recorded under this account."},"defaultCategoryId":{"type":"string","nullable":true,"description":"The default category ID to assign to new transactions for this account."},"importType":{"type":"string","enum":["manual","automated"],"description":"Whether transactions are imported manually or via bank connection."},"transitCurrency":{"type":"string","nullable":true,"enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR",null]},"importSettings":{"type":"object","properties":{"csv":{"nullable":true}}},"bankConnection":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["finApi"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"finApiAccount":{"type":"object","properties":{"id":{"type":"number","description":"The FinAPI internal ID for the connected bank account."},"iban":{"type":"string","nullable":true,"description":"The IBAN of the connected bank account. Null if not available."},"institution":{"type":"object","properties":{"id":{"type":"number","description":"The FinAPI internal ID for the banking institution."},"name":{"type":"string","description":"The name of the banking institution."},"bic":{"type":"string","nullable":true,"description":"The BIC (Bank Identifier Code) of the institution. Null if not available."},"logoStored":{"type":"boolean","description":"Flag indicating if a logo is available for this bank."}},"required":["id","name","bic","logoStored"],"description":"Details of the banking institution connected via FinAPI."},"createdUserId":{"type":"string","description":"The SaaSFlow user ID of the user who set up this bank connection."}},"required":["id","iban","institution","createdUserId"],"additionalProperties":false,"description":"Details of the FinAPI connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","finApiAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["plaid"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"plaidAccount":{"type":"object","properties":{"id":{"type":"string","description":"The Plaid account ID for the connected bank account."},"mask":{"type":"string","nullable":true,"description":"The last 2-4 characters of the account number. Null if not available."},"type":{"type":"string","enum":["investment","credit","depository","loan","brokerage","other"],"description":"The type of the account."},"subtype":{"type":"string","nullable":true,"description":"The subtype of the account. Null if not available."},"institution":{"type":"object","properties":{"id":{"type":"string","description":"The Plaid institution ID for the banking institution."},"name":{"type":"string","description":"The name of the banking institution."},"url":{"type":"string","nullable":true,"description":"The URL of the banking institution. Null if not available."},"logoStored":{"type":"boolean","description":"Flag indicating if a logo is available for this bank."},"routingNumbers":{"type":"array","nullable":true,"items":{"type":"string"},"description":"The routing numbers of the banking institution. Null if not available."},"primaryColor":{"type":"string","nullable":true,"description":"The primary color of the banking institution. Null if not available."}},"required":["id","name","url","logoStored","routingNumbers","primaryColor"],"additionalProperties":false,"description":"Details of the banking institution connected via Plaid."},"createdUserId":{"type":"string","description":"The ID of the user who set up this bank connection."},"itemId":{"type":"string","description":"The Plaid item ID for the connected bank account representing a user to bank relationship."}},"required":["id","mask","type","subtype","institution","createdUserId","itemId"],"additionalProperties":false,"description":"Details of the Plaid connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","plaidAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["stripe"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"stripeAccount":{"type":"object","properties":{"id":{"type":"string","description":"The Stripe account ID."}},"required":["id"],"additionalProperties":false,"description":"Details of the Stripe connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","stripeAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["stripeLoan"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"stripeLoanAccount":{"type":"object","properties":{"stripeAccountId":{"type":"string","description":"The Stripe account ID this loan belongs to."},"flexLoanId":{"type":"string","description":"The Stripe Capital Flex Loan ID."}},"required":["stripeAccountId","flexLoanId"],"additionalProperties":false,"description":"Details of the Stripe Capital Flex Loan account."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","stripeLoanAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["datevPayroll"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["finway"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["pleo"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false}]},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","type","name","accountNumber","includeInCashBalance","accountGroupId","archived","expectedAnnualReturn","order","defaultCurrency","defaultCategoryId","importType","transitCurrency","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Account not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/accounts/{accountId}/switch_to_manual":{"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"accountId","in":"path"}],"responses":{"200":{"description":"Account switched to manual","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["bank","cash","creditCard","loan","other","transit"],"description":"The type of account: bank, cash, creditCard, loan, or other."},"name":{"type":"string","description":"The name of the account."},"accountNumber":{"type":"string","nullable":true,"description":"The bank account number. Null if not provided."},"includeInCashBalance":{"type":"boolean","description":"Whether this account should be included in cash balance calculations and cash flow reports."},"accountGroupId":{"type":"string","nullable":true,"format":"uuid","description":"The ID of the account group this account belongs to. Null if not part of any group."},"archived":{"type":"boolean","description":"Flag indicating if the account is archived and should be hidden from most views."},"expectedAnnualReturn":{"type":"number","nullable":true,"minimum":-8388608,"maximum":8388607,"description":"The expected annual return percentage for this account, if applicable."},"order":{"type":"number","minimum":-8388608,"maximum":8388607,"description":"A number used for ordering accounts in the UI."},"defaultCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The default currency for transactions recorded under this account."},"defaultCategoryId":{"type":"string","nullable":true,"description":"The default category ID to assign to new transactions for this account."},"importType":{"type":"string","enum":["manual","automated"],"description":"Whether transactions are imported manually or via bank connection."},"transitCurrency":{"type":"string","nullable":true,"enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR",null]},"importSettings":{"type":"object","properties":{"csv":{"nullable":true}}},"bankConnection":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["finApi"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"finApiAccount":{"type":"object","properties":{"id":{"type":"number","description":"The FinAPI internal ID for the connected bank account."},"iban":{"type":"string","nullable":true,"description":"The IBAN of the connected bank account. Null if not available."},"institution":{"type":"object","properties":{"id":{"type":"number","description":"The FinAPI internal ID for the banking institution."},"name":{"type":"string","description":"The name of the banking institution."},"bic":{"type":"string","nullable":true,"description":"The BIC (Bank Identifier Code) of the institution. Null if not available."},"logoStored":{"type":"boolean","description":"Flag indicating if a logo is available for this bank."}},"required":["id","name","bic","logoStored"],"description":"Details of the banking institution connected via FinAPI."},"createdUserId":{"type":"string","description":"The SaaSFlow user ID of the user who set up this bank connection."}},"required":["id","iban","institution","createdUserId"],"additionalProperties":false,"description":"Details of the FinAPI connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","finApiAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["plaid"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"plaidAccount":{"type":"object","properties":{"id":{"type":"string","description":"The Plaid account ID for the connected bank account."},"mask":{"type":"string","nullable":true,"description":"The last 2-4 characters of the account number. Null if not available."},"type":{"type":"string","enum":["investment","credit","depository","loan","brokerage","other"],"description":"The type of the account."},"subtype":{"type":"string","nullable":true,"description":"The subtype of the account. Null if not available."},"institution":{"type":"object","properties":{"id":{"type":"string","description":"The Plaid institution ID for the banking institution."},"name":{"type":"string","description":"The name of the banking institution."},"url":{"type":"string","nullable":true,"description":"The URL of the banking institution. Null if not available."},"logoStored":{"type":"boolean","description":"Flag indicating if a logo is available for this bank."},"routingNumbers":{"type":"array","nullable":true,"items":{"type":"string"},"description":"The routing numbers of the banking institution. Null if not available."},"primaryColor":{"type":"string","nullable":true,"description":"The primary color of the banking institution. Null if not available."}},"required":["id","name","url","logoStored","routingNumbers","primaryColor"],"additionalProperties":false,"description":"Details of the banking institution connected via Plaid."},"createdUserId":{"type":"string","description":"The ID of the user who set up this bank connection."},"itemId":{"type":"string","description":"The Plaid item ID for the connected bank account representing a user to bank relationship."}},"required":["id","mask","type","subtype","institution","createdUserId","itemId"],"additionalProperties":false,"description":"Details of the Plaid connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","plaidAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["stripe"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"stripeAccount":{"type":"object","properties":{"id":{"type":"string","description":"The Stripe account ID."}},"required":["id"],"additionalProperties":false,"description":"Details of the Stripe connected account, if applicable. Null otherwise."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","stripeAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["stripeLoan"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."},"stripeLoanAccount":{"type":"object","properties":{"stripeAccountId":{"type":"string","description":"The Stripe account ID this loan belongs to."},"flexLoanId":{"type":"string","description":"The Stripe Capital Flex Loan ID."}},"required":["stripeAccountId","flexLoanId"],"additionalProperties":false,"description":"Details of the Stripe Capital Flex Loan account."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime","stripeLoanAccount"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["datevPayroll"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["finway"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["pleo"]},"countryCode":{"type":"string","nullable":true,"description":"The country of the bank this connection belongs to. Null if not available."},"status":{"type":"string","enum":["active","balanceMismatch","expired","error"],"description":"The current status of the bank connection."},"integrationId":{"type":"string","nullable":true,"description":"The ID of the integration that manages this bank account. Null if not managed by an integration."},"expireTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime when the bank connection is expected to expire. Null if not applicable or no expiry. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful synchronization with the bank. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"balanceMismatchReportedBalances":{"type":"array","items":{"type":"number"},"description":"The expected balances reported by the bank when a balance mismatch occurred. Can contain multiple values, e.g. balance with and without pending transactions. Only present when status is 'balanceMismatch'."},"balanceMismatchCalculatedBalance":{"type":"number","description":"The balance derived from summing all transactions when a balance mismatch occurred. Only present when status is 'balanceMismatch'."}},"required":["type","countryCode","status","integrationId","expireTime","lastSyncTime"],"additionalProperties":false}]},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","type","name","accountNumber","includeInCashBalance","accountGroupId","archived","expectedAnnualReturn","order","defaultCurrency","defaultCategoryId","importType","transitCurrency","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Account not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/accounts/{accountId}/remove_history":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"accountId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"beforeDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["beforeDate"]}}}},"responses":{"200":{"description":"History removed and balance transaction created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"404":{"description":"Account not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/categories":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"responses":{"200":{"description":"List of categories","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the category."},"emoji":{"type":"string","nullable":true,"description":"An emoji representing the category."},"plTypes":{"type":"array","items":{"type":"string","enum":["revenue","cogs","cac","pd","ga","no","neutral"]},"description":"The P&L types that the category can be used for."},"system":{"type":"boolean","description":"Flag indicating if this is a system-defined category."},"systemKey":{"type":"string","nullable":true,"description":"Semantic key for system categories (e.g., revRecurring, paymentFees)."},"order":{"type":"number","minimum":-8388608,"maximum":8388607,"description":"A number used for ordering categories in the UI."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","name","emoji","plTypes","system","systemKey","order","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}}}}},"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"emoji":{"type":"string","nullable":true},"plTypes":{"type":"array","items":{"type":"string","enum":["revenue","cogs","cac","pd","ga","no","neutral"]}},"system":{"type":"boolean","default":false},"order":{"type":"number"}},"required":["name","plTypes","order"]}}}},"responses":{"201":{"description":"Created category","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the category."},"emoji":{"type":"string","nullable":true,"description":"An emoji representing the category."},"plTypes":{"type":"array","items":{"type":"string","enum":["revenue","cogs","cac","pd","ga","no","neutral"]},"description":"The P&L types that the category can be used for."},"system":{"type":"boolean","description":"Flag indicating if this is a system-defined category."},"systemKey":{"type":"string","nullable":true,"description":"Semantic key for system categories (e.g., revRecurring, paymentFees)."},"order":{"type":"number","minimum":-8388608,"maximum":8388607,"description":"A number used for ordering categories in the UI."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","name","emoji","plTypes","system","systemKey","order","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}}}}},"/companies/{companyId}/categories/{categoryId}":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"categoryId","in":"path"}],"responses":{"200":{"description":"Category details","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the category."},"emoji":{"type":"string","nullable":true,"description":"An emoji representing the category."},"plTypes":{"type":"array","items":{"type":"string","enum":["revenue","cogs","cac","pd","ga","no","neutral"]},"description":"The P&L types that the category can be used for."},"system":{"type":"boolean","description":"Flag indicating if this is a system-defined category."},"systemKey":{"type":"string","nullable":true,"description":"Semantic key for system categories (e.g., revRecurring, paymentFees)."},"order":{"type":"number","minimum":-8388608,"maximum":8388607,"description":"A number used for ordering categories in the UI."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","name","emoji","plTypes","system","systemKey","order","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Category not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"categoryId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"emoji":{"type":"string","nullable":true},"plTypes":{"type":"array","items":{"type":"string","enum":["revenue","cogs","cac","pd","ga","no","neutral"]}},"order":{"type":"number"}}}}}},"responses":{"200":{"description":"Updated category","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the category."},"emoji":{"type":"string","nullable":true,"description":"An emoji representing the category."},"plTypes":{"type":"array","items":{"type":"string","enum":["revenue","cogs","cac","pd","ga","no","neutral"]},"description":"The P&L types that the category can be used for."},"system":{"type":"boolean","description":"Flag indicating if this is a system-defined category."},"systemKey":{"type":"string","nullable":true,"description":"Semantic key for system categories (e.g., revRecurring, paymentFees)."},"order":{"type":"number","minimum":-8388608,"maximum":8388607,"description":"A number used for ordering categories in the UI."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","name","emoji","plTypes","system","systemKey","order","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Category not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"delete":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"categoryId","in":"path"}],"responses":{"200":{"description":"Category deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"400":{"description":"Cannot delete system category","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Category is in use by transactions","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/categories/batch_delete":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"categoryIds":{"type":"array","items":{"type":"string","minLength":1}}},"required":["categoryIds"]}}}},"responses":{"200":{"description":"Categories deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"A selected category is in use by transactions","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/categories/merge":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"categoryIds":{"type":"array","items":{"type":"string","minLength":1}},"newCategory":{"type":"object","properties":{"name":{"type":"string","minLength":1},"emoji":{"type":"string","nullable":true},"plTypes":{"type":"array","items":{"type":"string","enum":["revenue","cogs","cac","pd","ga","no","neutral"]}},"order":{"type":"number"}},"required":["name","plTypes","order"]}},"required":["categoryIds","newCategory"]}}}},"responses":{"200":{"description":"The merged category","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the category."},"emoji":{"type":"string","nullable":true,"description":"An emoji representing the category."},"plTypes":{"type":"array","items":{"type":"string","enum":["revenue","cogs","cac","pd","ga","no","neutral"]},"description":"The P&L types that the category can be used for."},"system":{"type":"boolean","description":"Flag indicating if this is a system-defined category."},"systemKey":{"type":"string","nullable":true,"description":"Semantic key for system categories (e.g., revRecurring, paymentFees)."},"order":{"type":"number","minimum":-8388608,"maximum":8388607,"description":"A number used for ordering categories in the UI."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","name","emoji","plTypes","system","systemKey","order","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}}}}},"/companies/{companyId}/categories/reorder":{"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"categoryIds":{"type":"array","items":{"type":"string","minLength":1}}},"required":["categoryIds"]}}}},"responses":{"200":{"description":"Order updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}}},"/companies/{companyId}/customers":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"q","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":500},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"offset","in":"query"},{"schema":{"type":"string","enum":["0","1","true","false"]},"required":false,"name":"onlyActive","in":"query"}],"responses":{"200":{"description":"List of customers","content":{"application/json":{"schema":{"nullable":true}}}}}},"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"defaultCategorization":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string"},"usingDateRule":{"nullable":true},"plSplit":{"type":"object","additionalProperties":{"type":"number"}},"passThroughTax":{"type":"number"}},"required":["categoryId"]},"domains":{"type":"array","items":{"type":"string"}},"logo":{"type":"boolean"},"countryCode":{"type":"string","nullable":true}},"required":["name","logo"]}}}},"responses":{"201":{"description":"Created customer","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the customer."},"defaultCategorization":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string","description":"The default category to assign to transactions from this counterparty."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"The default date rule to apply to transactions from this counterparty."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The share of the transaction amount that is considered revenue in percent."},"cogs":{"type":"number","description":"The share of the transaction amount that is considered cost of goods sold in percent."},"cac":{"type":"number","description":"The share of the transaction amount that is considered customer acquisition cost in percent."},"pd":{"type":"number","description":"The share of the transaction amount that is considered product development in percent."},"ga":{"type":"number","description":"The share of the transaction amount that is considered general and administrative in percent."},"no":{"type":"number","description":"The share of the transaction amount that is considered non-operating expenses in percent."},"neutral":{"type":"number","description":"The share of the transaction amount that is considered neutral in percent."}},"additionalProperties":false,"description":"The default split of the transaction amount into different Profit & Loss (P&L) types. The sum of the percentages needs to be 100%."},"passThroughTax":{"type":"number","description":"The pass-through tax (e.g. VAT) that comes on top of the amount covered by the P&L split."}},"required":["categoryId","usingDateRule","plSplit","passThroughTax"],"additionalProperties":false,"description":"The default categorization to apply to transactions from this customer."},"domains":{"type":"array","items":{"type":"string"},"description":"An array of website domains associated with this customer."},"logo":{"type":"boolean","description":"Flag indicating if a logo is available for this customer."},"autoCreatedSource":{"type":"string","nullable":true,"enum":["searchApiGoogleWebSearch","stripe","hubspot","datevPayroll","finway","pleo",null],"description":"The source from which this customer was automatically created."},"countryCode":{"type":"string","nullable":true,"description":"ISO 3166-1 alpha-2 country code (e.g., US, DE, GB)."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"externalIds":{"type":"array","items":{"type":"string"},"description":"External IDs (URNs) linked to this customer (e.g., Stripe, HubSpot)."}},"required":["id","companyId","name","defaultCategorization","domains","logo","autoCreatedSource","countryCode","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","externalIds"]}}}}}}},"/companies/{companyId}/customers/{customerId}":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"customerId","in":"path"}],"responses":{"200":{"description":"Customer details","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the customer."},"defaultCategorization":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string","description":"The default category to assign to transactions from this counterparty."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"The default date rule to apply to transactions from this counterparty."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The share of the transaction amount that is considered revenue in percent."},"cogs":{"type":"number","description":"The share of the transaction amount that is considered cost of goods sold in percent."},"cac":{"type":"number","description":"The share of the transaction amount that is considered customer acquisition cost in percent."},"pd":{"type":"number","description":"The share of the transaction amount that is considered product development in percent."},"ga":{"type":"number","description":"The share of the transaction amount that is considered general and administrative in percent."},"no":{"type":"number","description":"The share of the transaction amount that is considered non-operating expenses in percent."},"neutral":{"type":"number","description":"The share of the transaction amount that is considered neutral in percent."}},"additionalProperties":false,"description":"The default split of the transaction amount into different Profit & Loss (P&L) types. The sum of the percentages needs to be 100%."},"passThroughTax":{"type":"number","description":"The pass-through tax (e.g. VAT) that comes on top of the amount covered by the P&L split."}},"required":["categoryId","usingDateRule","plSplit","passThroughTax"],"additionalProperties":false,"description":"The default categorization to apply to transactions from this customer."},"domains":{"type":"array","items":{"type":"string"},"description":"An array of website domains associated with this customer."},"logo":{"type":"boolean","description":"Flag indicating if a logo is available for this customer."},"autoCreatedSource":{"type":"string","nullable":true,"enum":["searchApiGoogleWebSearch","stripe","hubspot","datevPayroll","finway","pleo",null],"description":"The source from which this customer was automatically created."},"countryCode":{"type":"string","nullable":true,"description":"ISO 3166-1 alpha-2 country code (e.g., US, DE, GB)."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"externalIds":{"type":"array","items":{"type":"string"},"description":"External IDs (URNs) linked to this customer (e.g., Stripe, HubSpot)."}},"required":["id","companyId","name","defaultCategorization","domains","logo","autoCreatedSource","countryCode","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","externalIds"]}}}},"404":{"description":"Customer not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"customerId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"defaultCategorization":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string"},"usingDateRule":{"nullable":true},"plSplit":{"type":"object","additionalProperties":{"type":"number"}},"passThroughTax":{"type":"number"}},"required":["categoryId"]},"domains":{"type":"array","items":{"type":"string"}},"logo":{"type":"boolean"},"countryCode":{"type":"string","nullable":true}}}}}},"responses":{"200":{"description":"Updated customer","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the customer."},"defaultCategorization":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string","description":"The default category to assign to transactions from this counterparty."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"The default date rule to apply to transactions from this counterparty."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The share of the transaction amount that is considered revenue in percent."},"cogs":{"type":"number","description":"The share of the transaction amount that is considered cost of goods sold in percent."},"cac":{"type":"number","description":"The share of the transaction amount that is considered customer acquisition cost in percent."},"pd":{"type":"number","description":"The share of the transaction amount that is considered product development in percent."},"ga":{"type":"number","description":"The share of the transaction amount that is considered general and administrative in percent."},"no":{"type":"number","description":"The share of the transaction amount that is considered non-operating expenses in percent."},"neutral":{"type":"number","description":"The share of the transaction amount that is considered neutral in percent."}},"additionalProperties":false,"description":"The default split of the transaction amount into different Profit & Loss (P&L) types. The sum of the percentages needs to be 100%."},"passThroughTax":{"type":"number","description":"The pass-through tax (e.g. VAT) that comes on top of the amount covered by the P&L split."}},"required":["categoryId","usingDateRule","plSplit","passThroughTax"],"additionalProperties":false,"description":"The default categorization to apply to transactions from this customer."},"domains":{"type":"array","items":{"type":"string"},"description":"An array of website domains associated with this customer."},"logo":{"type":"boolean","description":"Flag indicating if a logo is available for this customer."},"autoCreatedSource":{"type":"string","nullable":true,"enum":["searchApiGoogleWebSearch","stripe","hubspot","datevPayroll","finway","pleo",null],"description":"The source from which this customer was automatically created."},"countryCode":{"type":"string","nullable":true,"description":"ISO 3166-1 alpha-2 country code (e.g., US, DE, GB)."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"externalIds":{"type":"array","items":{"type":"string"},"description":"External IDs (URNs) linked to this customer (e.g., Stripe, HubSpot)."}},"required":["id","companyId","name","defaultCategorization","domains","logo","autoCreatedSource","countryCode","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","externalIds"]}}}},"404":{"description":"Customer not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"delete":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"customerId","in":"path"}],"responses":{"200":{"description":"Customer deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}}},"/companies/{companyId}/customers/batch_delete":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"selection":{"oneOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["ids"]},"ids":{"type":"array","items":{"type":"string","minLength":1},"minItems":1,"maxItems":10000,"description":"Explicit list of entity IDs to act on."}},"required":["mode","ids"]},{"type":"object","properties":{"mode":{"type":"string","enum":["filter"]},"filter":{"type":"object","properties":{"q":{"type":"string"},"onlyActive":{"type":"boolean"}},"description":"Filter spec matching the list endpoint; resolves to all matching rows."},"excludedIds":{"type":"array","items":{"type":"string","minLength":1},"maxItems":10000,"default":[],"description":"IDs to exclude from the resolved filter result."}},"required":["mode","filter"]}]}},"required":["selection"]}}}},"responses":{"200":{"description":"Customers deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"affected":{"type":"integer","minimum":0}},"required":["success","affected"]}}}},"413":{"description":"Selection exceeds bulk cap","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["bulk_too_many"]},"count":{"type":"integer","minimum":0},"max":{"type":"integer","minimum":0}},"required":["error","count","max"]}}}}}}},"/companies/{companyId}/customers/merge":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"customerIds":{"type":"array","items":{"type":"string","minLength":1}},"newCustomer":{"type":"object","properties":{"name":{"type":"string","minLength":1},"defaultCategorization":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string"},"usingDateRule":{"nullable":true},"plSplit":{"type":"object","additionalProperties":{"type":"number"}},"passThroughTax":{"type":"number"}},"required":["categoryId"]},"domains":{"type":"array","items":{"type":"string"}},"logo":{"type":"boolean"},"countryCode":{"type":"string","nullable":true}},"required":["name","logo"]}},"required":["customerIds","newCustomer"]}}}},"responses":{"200":{"description":"The merged customer","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the customer."},"defaultCategorization":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string","description":"The default category to assign to transactions from this counterparty."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"The default date rule to apply to transactions from this counterparty."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The share of the transaction amount that is considered revenue in percent."},"cogs":{"type":"number","description":"The share of the transaction amount that is considered cost of goods sold in percent."},"cac":{"type":"number","description":"The share of the transaction amount that is considered customer acquisition cost in percent."},"pd":{"type":"number","description":"The share of the transaction amount that is considered product development in percent."},"ga":{"type":"number","description":"The share of the transaction amount that is considered general and administrative in percent."},"no":{"type":"number","description":"The share of the transaction amount that is considered non-operating expenses in percent."},"neutral":{"type":"number","description":"The share of the transaction amount that is considered neutral in percent."}},"additionalProperties":false,"description":"The default split of the transaction amount into different Profit & Loss (P&L) types. The sum of the percentages needs to be 100%."},"passThroughTax":{"type":"number","description":"The pass-through tax (e.g. VAT) that comes on top of the amount covered by the P&L split."}},"required":["categoryId","usingDateRule","plSplit","passThroughTax"],"additionalProperties":false,"description":"The default categorization to apply to transactions from this customer."},"domains":{"type":"array","items":{"type":"string"},"description":"An array of website domains associated with this customer."},"logo":{"type":"boolean","description":"Flag indicating if a logo is available for this customer."},"autoCreatedSource":{"type":"string","nullable":true,"enum":["searchApiGoogleWebSearch","stripe","hubspot","datevPayroll","finway","pleo",null],"description":"The source from which this customer was automatically created."},"countryCode":{"type":"string","nullable":true,"description":"ISO 3166-1 alpha-2 country code (e.g., US, DE, GB)."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"externalIds":{"type":"array","items":{"type":"string"},"description":"External IDs (URNs) linked to this customer (e.g., Stripe, HubSpot)."}},"required":["id","companyId","name","defaultCategorization","domains","logo","autoCreatedSource","countryCode","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","externalIds"]}}}}}}},"/companies/{companyId}/customers/{customerId}/external-ids":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"customerId","in":"path"}],"responses":{"200":{"description":"External IDs for the customer","content":{"application/json":{"schema":{"type":"object","properties":{"externalIds":{"type":"array","items":{"type":"string"}}},"required":["externalIds"]}}}}}},"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"customerId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"externalIds":{"type":"array","items":{"type":"string"}}},"required":["externalIds"]}}}},"responses":{"200":{"description":"Updated external IDs","content":{"application/json":{"schema":{"type":"object","properties":{"externalIds":{"type":"array","items":{"type":"string"}}},"required":["externalIds"]}}}},"409":{"description":"One or more externalIds already in use by another customer","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/vendors":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"q","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":500},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"List of vendors","content":{"application/json":{"schema":{"nullable":true}}}}}},"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"defaultCategorization":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string"},"usingDateRule":{"nullable":true},"plSplit":{"type":"object","additionalProperties":{"type":"number"}},"passThroughTax":{"type":"number"}},"required":["categoryId"]},"domains":{"type":"array","items":{"type":"string"}},"logo":{"type":"boolean","default":false}},"required":["name"]}}}},"responses":{"201":{"description":"Created vendor","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the vendor."},"defaultCategorization":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string","description":"The default category to assign to transactions from this counterparty."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"The default date rule to apply to transactions from this counterparty."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The share of the transaction amount that is considered revenue in percent."},"cogs":{"type":"number","description":"The share of the transaction amount that is considered cost of goods sold in percent."},"cac":{"type":"number","description":"The share of the transaction amount that is considered customer acquisition cost in percent."},"pd":{"type":"number","description":"The share of the transaction amount that is considered product development in percent."},"ga":{"type":"number","description":"The share of the transaction amount that is considered general and administrative in percent."},"no":{"type":"number","description":"The share of the transaction amount that is considered non-operating expenses in percent."},"neutral":{"type":"number","description":"The share of the transaction amount that is considered neutral in percent."}},"additionalProperties":false,"description":"The default split of the transaction amount into different Profit & Loss (P&L) types. The sum of the percentages needs to be 100%."},"passThroughTax":{"type":"number","description":"The pass-through tax (e.g. VAT) that comes on top of the amount covered by the P&L split."}},"required":["categoryId","usingDateRule","plSplit","passThroughTax"],"additionalProperties":false,"description":"The default categorization to apply to transactions from this vendor."},"domains":{"type":"array","items":{"type":"string"},"description":"An array of website domains associated with this vendor."},"logo":{"type":"boolean","description":"Flag indicating if a logo is available for this vendor."},"autoCreatedSource":{"type":"string","nullable":true,"enum":["searchApiGoogleWebSearch","stripe","hubspot","datevPayroll","finway","pleo",null],"description":"The source from which this vendor was automatically created."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"externalIds":{"type":"array","items":{"type":"string"},"description":"External IDs (URNs) linked to this vendor (e.g., DATEV Payroll)."}},"required":["id","companyId","name","defaultCategorization","domains","logo","autoCreatedSource","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","externalIds"]}}}}}}},"/companies/{companyId}/vendors/{vendorId}":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"vendorId","in":"path"}],"responses":{"200":{"description":"Vendor details","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the vendor."},"defaultCategorization":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string","description":"The default category to assign to transactions from this counterparty."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"The default date rule to apply to transactions from this counterparty."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The share of the transaction amount that is considered revenue in percent."},"cogs":{"type":"number","description":"The share of the transaction amount that is considered cost of goods sold in percent."},"cac":{"type":"number","description":"The share of the transaction amount that is considered customer acquisition cost in percent."},"pd":{"type":"number","description":"The share of the transaction amount that is considered product development in percent."},"ga":{"type":"number","description":"The share of the transaction amount that is considered general and administrative in percent."},"no":{"type":"number","description":"The share of the transaction amount that is considered non-operating expenses in percent."},"neutral":{"type":"number","description":"The share of the transaction amount that is considered neutral in percent."}},"additionalProperties":false,"description":"The default split of the transaction amount into different Profit & Loss (P&L) types. The sum of the percentages needs to be 100%."},"passThroughTax":{"type":"number","description":"The pass-through tax (e.g. VAT) that comes on top of the amount covered by the P&L split."}},"required":["categoryId","usingDateRule","plSplit","passThroughTax"],"additionalProperties":false,"description":"The default categorization to apply to transactions from this vendor."},"domains":{"type":"array","items":{"type":"string"},"description":"An array of website domains associated with this vendor."},"logo":{"type":"boolean","description":"Flag indicating if a logo is available for this vendor."},"autoCreatedSource":{"type":"string","nullable":true,"enum":["searchApiGoogleWebSearch","stripe","hubspot","datevPayroll","finway","pleo",null],"description":"The source from which this vendor was automatically created."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"externalIds":{"type":"array","items":{"type":"string"},"description":"External IDs (URNs) linked to this vendor (e.g., DATEV Payroll)."}},"required":["id","companyId","name","defaultCategorization","domains","logo","autoCreatedSource","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","externalIds"]}}}},"404":{"description":"Vendor not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"vendorId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"defaultCategorization":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string"},"usingDateRule":{"nullable":true},"plSplit":{"type":"object","additionalProperties":{"type":"number"}},"passThroughTax":{"type":"number"}},"required":["categoryId"]},"domains":{"type":"array","items":{"type":"string"}},"logo":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Updated vendor","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the vendor."},"defaultCategorization":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string","description":"The default category to assign to transactions from this counterparty."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"The default date rule to apply to transactions from this counterparty."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The share of the transaction amount that is considered revenue in percent."},"cogs":{"type":"number","description":"The share of the transaction amount that is considered cost of goods sold in percent."},"cac":{"type":"number","description":"The share of the transaction amount that is considered customer acquisition cost in percent."},"pd":{"type":"number","description":"The share of the transaction amount that is considered product development in percent."},"ga":{"type":"number","description":"The share of the transaction amount that is considered general and administrative in percent."},"no":{"type":"number","description":"The share of the transaction amount that is considered non-operating expenses in percent."},"neutral":{"type":"number","description":"The share of the transaction amount that is considered neutral in percent."}},"additionalProperties":false,"description":"The default split of the transaction amount into different Profit & Loss (P&L) types. The sum of the percentages needs to be 100%."},"passThroughTax":{"type":"number","description":"The pass-through tax (e.g. VAT) that comes on top of the amount covered by the P&L split."}},"required":["categoryId","usingDateRule","plSplit","passThroughTax"],"additionalProperties":false,"description":"The default categorization to apply to transactions from this vendor."},"domains":{"type":"array","items":{"type":"string"},"description":"An array of website domains associated with this vendor."},"logo":{"type":"boolean","description":"Flag indicating if a logo is available for this vendor."},"autoCreatedSource":{"type":"string","nullable":true,"enum":["searchApiGoogleWebSearch","stripe","hubspot","datevPayroll","finway","pleo",null],"description":"The source from which this vendor was automatically created."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"externalIds":{"type":"array","items":{"type":"string"},"description":"External IDs (URNs) linked to this vendor (e.g., DATEV Payroll)."}},"required":["id","companyId","name","defaultCategorization","domains","logo","autoCreatedSource","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","externalIds"]}}}},"404":{"description":"Vendor not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"delete":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"vendorId","in":"path"}],"responses":{"200":{"description":"Vendor deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}}},"/companies/{companyId}/vendors/{vendorId}/apply-default-categorization/preview":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"vendorId","in":"path"}],"responses":{"200":{"description":"Counts of transactions affected by re-applying default categorization","content":{"application/json":{"schema":{"type":"object","properties":{"empty":{"type":"integer","minimum":0},"autoAssigned":{"type":"integer","minimum":0},"userEdited":{"type":"integer","minimum":0}},"required":["empty","autoAssigned","userEdited"]}}}}}}},"/companies/{companyId}/vendors/{vendorId}/apply-default-categorization":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"vendorId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"applyTo":{"type":"string","enum":["empty","autoAssigned","all"]}},"required":["applyTo"]}}}},"responses":{"200":{"description":"Re-application complete","content":{"application/json":{"schema":{"type":"object","properties":{"insertedSlices":{"type":"integer","minimum":0},"updatedSlices":{"type":"integer","minimum":0}},"required":["insertedSlices","updatedSlices"]}}}},"400":{"description":"Vendor has no default categorization","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Vendor not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/vendors/batch_delete":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"selection":{"oneOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["ids"]},"ids":{"type":"array","items":{"type":"string","minLength":1},"minItems":1,"maxItems":10000,"description":"Explicit list of entity IDs to act on."}},"required":["mode","ids"]},{"type":"object","properties":{"mode":{"type":"string","enum":["filter"]},"filter":{"type":"object","properties":{"q":{"type":"string"}},"description":"Filter spec matching the list endpoint; resolves to all matching rows."},"excludedIds":{"type":"array","items":{"type":"string","minLength":1},"maxItems":10000,"default":[],"description":"IDs to exclude from the resolved filter result."}},"required":["mode","filter"]}]}},"required":["selection"]}}}},"responses":{"200":{"description":"Vendors deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"affected":{"type":"integer","minimum":0}},"required":["success","affected"]}}}},"413":{"description":"Selection exceeds bulk cap","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["bulk_too_many"]},"count":{"type":"integer","minimum":0},"max":{"type":"integer","minimum":0}},"required":["error","count","max"]}}}}}}},"/companies/{companyId}/vendors/merge":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"vendorIds":{"type":"array","items":{"type":"string","minLength":1}},"newVendor":{"type":"object","properties":{"name":{"type":"string","minLength":1},"defaultCategorization":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string"},"usingDateRule":{"nullable":true},"plSplit":{"type":"object","additionalProperties":{"type":"number"}},"passThroughTax":{"type":"number"}},"required":["categoryId"]},"domains":{"type":"array","items":{"type":"string"}},"logo":{"type":"boolean","default":false}},"required":["name"]}},"required":["vendorIds","newVendor"]}}}},"responses":{"200":{"description":"The merged vendor","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the vendor."},"defaultCategorization":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string","description":"The default category to assign to transactions from this counterparty."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"The default date rule to apply to transactions from this counterparty."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The share of the transaction amount that is considered revenue in percent."},"cogs":{"type":"number","description":"The share of the transaction amount that is considered cost of goods sold in percent."},"cac":{"type":"number","description":"The share of the transaction amount that is considered customer acquisition cost in percent."},"pd":{"type":"number","description":"The share of the transaction amount that is considered product development in percent."},"ga":{"type":"number","description":"The share of the transaction amount that is considered general and administrative in percent."},"no":{"type":"number","description":"The share of the transaction amount that is considered non-operating expenses in percent."},"neutral":{"type":"number","description":"The share of the transaction amount that is considered neutral in percent."}},"additionalProperties":false,"description":"The default split of the transaction amount into different Profit & Loss (P&L) types. The sum of the percentages needs to be 100%."},"passThroughTax":{"type":"number","description":"The pass-through tax (e.g. VAT) that comes on top of the amount covered by the P&L split."}},"required":["categoryId","usingDateRule","plSplit","passThroughTax"],"additionalProperties":false,"description":"The default categorization to apply to transactions from this vendor."},"domains":{"type":"array","items":{"type":"string"},"description":"An array of website domains associated with this vendor."},"logo":{"type":"boolean","description":"Flag indicating if a logo is available for this vendor."},"autoCreatedSource":{"type":"string","nullable":true,"enum":["searchApiGoogleWebSearch","stripe","hubspot","datevPayroll","finway","pleo",null],"description":"The source from which this vendor was automatically created."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"externalIds":{"type":"array","items":{"type":"string"},"description":"External IDs (URNs) linked to this vendor (e.g., DATEV Payroll)."}},"required":["id","companyId","name","defaultCategorization","domains","logo","autoCreatedSource","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","externalIds"]}}}}}}},"/companies/{companyId}/vendors/{vendorId}/external-ids":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"vendorId","in":"path"}],"responses":{"200":{"description":"External IDs for the vendor","content":{"application/json":{"schema":{"type":"object","properties":{"externalIds":{"type":"array","items":{"type":"string"}}},"required":["externalIds"]}}}}}},"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"vendorId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"externalIds":{"type":"array","items":{"type":"string"}}},"required":["externalIds"]}}}},"responses":{"200":{"description":"Updated external IDs","content":{"application/json":{"schema":{"type":"object","properties":{"externalIds":{"type":"array","items":{"type":"string"}}},"required":["externalIds"]}}}},"409":{"description":"One or more externalIds already in use by another vendor","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/counterparties/search":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"q","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":5000,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"types","in":"query"}],"responses":{"200":{"description":"Lightweight counterparty search","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/transactions":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":5000,"default":100,"description":"Number of transactions to return (1-5000, default 100)."},"required":false,"description":"Number of transactions to return (1-5000, default 100).","name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0,"default":0,"description":"Number of transactions to skip (default 0)."},"required":false,"description":"Number of transactions to skip (default 0).","name":"offset","in":"query"},{"schema":{"type":"string","description":"Filter by account ID."},"required":false,"description":"Filter by account ID.","name":"accountId","in":"query"},{"schema":{"type":"string","enum":["uncategorized"],"description":"\"uncategorized\" returns only transactions with NO categorizations yet (strictly open — excludes partially categorized and incomplete-transfer rows, which the POST /search \"open\" status includes). Deterministic, server-side scope for bulk categorization tooling."},"required":false,"description":"\"uncategorized\" returns only transactions with NO categorizations yet (strictly open — excludes partially categorized and incomplete-transfer rows, which the POST /search \"open\" status includes). Deterministic, server-side scope for bulk categorization tooling.","name":"status","in":"query"}],"responses":{"200":{"description":"Paginated list of transactions","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"accountId":{"type":"string","format":"uuid","description":"The ID of the account associated with this transaction."},"date":{"type":"string","description":"The date of the transaction (YYYY-MM-DD)."},"fromTo":{"type":"string","nullable":true,"description":"A description of the sender or recipient of the transaction."},"description":{"type":"string","nullable":true,"description":"A user- or bank-provided description or memo for the transaction."},"amountValue":{"type":"string","description":"The numerical value of the transaction amount."},"amountCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The currency of the transaction amount."},"categorizationsAutoAssigned":{"type":"boolean","nullable":true,"description":"Flag indicating if the categorizations were automatically assigned."},"excludeFromAutoCategorization":{"type":"boolean","description":"Flag to exclude this transaction from automatic categorization."},"notes":{"type":"string","nullable":true,"description":"Additional notes or comments for the transaction."},"source":{"type":"string","nullable":true,"description":"The source of the transaction data (e.g., bank import, manual entry)."},"assignedUserId":{"type":"string","nullable":true,"description":"The ID of the user to whom this transaction is assigned for review."},"finApiTransactionId":{"type":"string","nullable":true,"description":"The transaction ID from FinAPI, if applicable."},"plaidTransactionId":{"type":"string","nullable":true,"description":"The transaction ID from Plaid, if applicable."},"stripeBalanceTransactionId":{"type":"string","nullable":true,"description":"The balance transaction ID from Stripe, if applicable."},"stripeInvoiceId":{"type":"string","nullable":true,"description":"The invoice ID from Stripe, if applicable."},"stripeCreditNoteId":{"type":"string","nullable":true,"description":"The credit note ID from Stripe, if applicable."},"stripePaymentIntentId":{"type":"string","nullable":true,"description":"The Stripe PaymentIntent ID from the charge source."},"stripeBillingEmail":{"type":"string","nullable":true,"description":"The customer billing email from the Stripe charge source."},"hubspotPortalId":{"type":"string","nullable":true,"description":"The HubSpot portal ID from Stripe balance transaction metadata."},"hubspotInvoiceId":{"type":"string","nullable":true,"description":"The HubSpot invoice ID from Stripe balance transaction metadata."},"hubspotCategorizationResolved":{"type":"boolean","nullable":true,"description":"Whether HubSpot categorization resolution has been attempted."},"finwayExpenseNumber":{"type":"string","nullable":true},"finwayInvoiceNumber":{"type":"string","nullable":true},"pleoExpenseId":{"type":"string","nullable":true},"createdVendorId":{"type":"string","nullable":true,"format":"uuid"},"integrationId":{"type":"string","nullable":true,"format":"uuid"},"pending":{"type":"boolean","description":"Flag indicating if the transaction is pending and not yet cleared."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"categorizations":{"type":"object","additionalProperties":{"type":"object","properties":{"counterparty":{"type":"object","nullable":true,"properties":{"type":{"type":"string","enum":["customer","vendor"]},"id":{"type":"string","description":"The ID of the customer or vendor."}},"required":["type","id"],"additionalProperties":false,"description":"The customer or vendor to categorize the transaction. Null if the transaction is not mapped to a customer or vendor."},"categoryId":{"type":"string","description":"The ID of the category to categorize the transaction."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["custom"]},"startDate":{"type":"string","format":"date"},"endDate":{"type":"string","format":"date"}},"required":["type","startDate","endDate"],"additionalProperties":false}],"description":"The date rule to apply to the transaction."},"computedStartDate":{"type":"string","format":"date","description":"The start date to apply to the transaction."},"computedEndDate":{"type":"string","format":"date","description":"The end date to apply to the transaction."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The amount of the revenue."},"cogs":{"type":"number","description":"The amount of the cost of goods sold."},"cac":{"type":"number","description":"The amount of the customer acquisition cost."},"pd":{"type":"number","description":"The amount of the product development."},"ga":{"type":"number","description":"The amount of the general and administrative."},"no":{"type":"number","description":"The amount of the non-operating expenses."},"neutral":{"type":"number","description":"The amount assigned to neutral categories."}},"additionalProperties":false,"description":"The split of the transaction amount into different Profit & Loss (P&L) types within the same category."},"passThroughTax":{"type":"number","description":"The amount of the pass-through tax (e.g. VAT) that is not important for a profit & loss calculation."},"transferCounterPosition":{"type":"object","nullable":true,"properties":{"transactionId":{"type":"string","description":"The ID of the transaction that holds the categorization which is the counter object for a transfer between accounts."},"categorizationId":{"type":"string","description":"The ID of the categorization that is the counter object for a transfer between accounts."}},"required":["transactionId","categorizationId"],"additionalProperties":false,"description":"The counter object in a transfer between accounts. Only for categorizations of type \"transfer\"."},"internalTransitLink":{"type":"object","nullable":true,"properties":{"transactionId":{"type":"string","description":"The ID of the transaction on the same transit account that holds the linked categorization."},"categorizationId":{"type":"string","description":"The ID of the linked categorization on the same transit account."}},"required":["transactionId","categorizationId"],"additionalProperties":false,"description":"The sibling categorization on the same transit account that closes an in-flight transfer. Only for transfer categorizations on transit accounts."},"sourceNote":{"type":"string","nullable":true,"description":"Read-only context from the source system, e.g. the invoice line-item description behind this categorization. Set by integrations; not user-editable."}},"required":["counterparty","categoryId","usingDateRule","computedStartDate","computedEndDate","plSplit","passThroughTax"],"additionalProperties":false},"description":"A record mapping categorization IDs to categorization details."},"inTransit":{"type":"boolean","description":"True when this transaction is part of an open in-transit transfer (booked onto a transit account but not yet matched to the arriving side). Drives the \"needs attention\" indicator alongside the open status."}},"required":["id","companyId","accountId","date","fromTo","description","amountValue","amountCurrency","categorizationsAutoAssigned","excludeFromAutoCategorization","notes","source","assignedUserId","finApiTransactionId","plaidTransactionId","stripeBalanceTransactionId","stripeInvoiceId","stripeCreditNoteId","stripePaymentIntentId","stripeBillingEmail","hubspotPortalId","hubspotInvoiceId","hubspotCategorizationResolved","finwayExpenseNumber","finwayInvoiceNumber","pleoExpenseId","createdVendorId","integrationId","pending","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","categorizations"]}},"totalCount":{"type":"number","description":"Total number of transactions matching the filters."}},"required":["items","totalCount"]}}}}}},"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","minLength":1},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"fromTo":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"amountValue":{"type":"string"},"amountCurrency":{"type":"string"},"categorizations":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"notes":{"type":"string","nullable":true},"source":{"type":"string","nullable":true},"pending":{"type":"boolean","default":false},"excludeFromAutoCategorization":{"type":"boolean","default":false}},"required":["accountId","date","amountValue","amountCurrency"]}}}},"responses":{"201":{"description":"Created transaction","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"accountId":{"type":"string","format":"uuid","description":"The ID of the account associated with this transaction."},"date":{"type":"string","description":"The date of the transaction (YYYY-MM-DD)."},"fromTo":{"type":"string","nullable":true,"description":"A description of the sender or recipient of the transaction."},"description":{"type":"string","nullable":true,"description":"A user- or bank-provided description or memo for the transaction."},"amountValue":{"type":"string","description":"The numerical value of the transaction amount."},"amountCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The currency of the transaction amount."},"categorizationsAutoAssigned":{"type":"boolean","nullable":true,"description":"Flag indicating if the categorizations were automatically assigned."},"excludeFromAutoCategorization":{"type":"boolean","description":"Flag to exclude this transaction from automatic categorization."},"notes":{"type":"string","nullable":true,"description":"Additional notes or comments for the transaction."},"source":{"type":"string","nullable":true,"description":"The source of the transaction data (e.g., bank import, manual entry)."},"assignedUserId":{"type":"string","nullable":true,"description":"The ID of the user to whom this transaction is assigned for review."},"finApiTransactionId":{"type":"string","nullable":true,"description":"The transaction ID from FinAPI, if applicable."},"plaidTransactionId":{"type":"string","nullable":true,"description":"The transaction ID from Plaid, if applicable."},"stripeBalanceTransactionId":{"type":"string","nullable":true,"description":"The balance transaction ID from Stripe, if applicable."},"stripeInvoiceId":{"type":"string","nullable":true,"description":"The invoice ID from Stripe, if applicable."},"stripeCreditNoteId":{"type":"string","nullable":true,"description":"The credit note ID from Stripe, if applicable."},"stripePaymentIntentId":{"type":"string","nullable":true,"description":"The Stripe PaymentIntent ID from the charge source."},"stripeBillingEmail":{"type":"string","nullable":true,"description":"The customer billing email from the Stripe charge source."},"hubspotPortalId":{"type":"string","nullable":true,"description":"The HubSpot portal ID from Stripe balance transaction metadata."},"hubspotInvoiceId":{"type":"string","nullable":true,"description":"The HubSpot invoice ID from Stripe balance transaction metadata."},"hubspotCategorizationResolved":{"type":"boolean","nullable":true,"description":"Whether HubSpot categorization resolution has been attempted."},"finwayExpenseNumber":{"type":"string","nullable":true},"finwayInvoiceNumber":{"type":"string","nullable":true},"pleoExpenseId":{"type":"string","nullable":true},"createdVendorId":{"type":"string","nullable":true,"format":"uuid"},"integrationId":{"type":"string","nullable":true,"format":"uuid"},"pending":{"type":"boolean","description":"Flag indicating if the transaction is pending and not yet cleared."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"categorizations":{"type":"object","additionalProperties":{"type":"object","properties":{"counterparty":{"type":"object","nullable":true,"properties":{"type":{"type":"string","enum":["customer","vendor"]},"id":{"type":"string","description":"The ID of the customer or vendor."}},"required":["type","id"],"additionalProperties":false,"description":"The customer or vendor to categorize the transaction. Null if the transaction is not mapped to a customer or vendor."},"categoryId":{"type":"string","description":"The ID of the category to categorize the transaction."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["custom"]},"startDate":{"type":"string","format":"date"},"endDate":{"type":"string","format":"date"}},"required":["type","startDate","endDate"],"additionalProperties":false}],"description":"The date rule to apply to the transaction."},"computedStartDate":{"type":"string","format":"date","description":"The start date to apply to the transaction."},"computedEndDate":{"type":"string","format":"date","description":"The end date to apply to the transaction."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The amount of the revenue."},"cogs":{"type":"number","description":"The amount of the cost of goods sold."},"cac":{"type":"number","description":"The amount of the customer acquisition cost."},"pd":{"type":"number","description":"The amount of the product development."},"ga":{"type":"number","description":"The amount of the general and administrative."},"no":{"type":"number","description":"The amount of the non-operating expenses."},"neutral":{"type":"number","description":"The amount assigned to neutral categories."}},"additionalProperties":false,"description":"The split of the transaction amount into different Profit & Loss (P&L) types within the same category."},"passThroughTax":{"type":"number","description":"The amount of the pass-through tax (e.g. VAT) that is not important for a profit & loss calculation."},"transferCounterPosition":{"type":"object","nullable":true,"properties":{"transactionId":{"type":"string","description":"The ID of the transaction that holds the categorization which is the counter object for a transfer between accounts."},"categorizationId":{"type":"string","description":"The ID of the categorization that is the counter object for a transfer between accounts."}},"required":["transactionId","categorizationId"],"additionalProperties":false,"description":"The counter object in a transfer between accounts. Only for categorizations of type \"transfer\"."},"internalTransitLink":{"type":"object","nullable":true,"properties":{"transactionId":{"type":"string","description":"The ID of the transaction on the same transit account that holds the linked categorization."},"categorizationId":{"type":"string","description":"The ID of the linked categorization on the same transit account."}},"required":["transactionId","categorizationId"],"additionalProperties":false,"description":"The sibling categorization on the same transit account that closes an in-flight transfer. Only for transfer categorizations on transit accounts."},"sourceNote":{"type":"string","nullable":true,"description":"Read-only context from the source system, e.g. the invoice line-item description behind this categorization. Set by integrations; not user-editable."}},"required":["counterparty","categoryId","usingDateRule","computedStartDate","computedEndDate","plSplit","passThroughTax"],"additionalProperties":false},"description":"A record mapping categorization IDs to categorization details."}},"required":["id","companyId","accountId","date","fromTo","description","amountValue","amountCurrency","categorizationsAutoAssigned","excludeFromAutoCategorization","notes","source","assignedUserId","finApiTransactionId","plaidTransactionId","stripeBalanceTransactionId","stripeInvoiceId","stripeCreditNoteId","stripePaymentIntentId","stripeBillingEmail","hubspotPortalId","hubspotInvoiceId","hubspotCategorizationResolved","finwayExpenseNumber","finwayInvoiceNumber","pleoExpenseId","createdVendorId","integrationId","pending","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","categorizations"]}}}}}}},"/companies/{companyId}/transactions/search":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"limit":{"type":"integer","minimum":1,"maximum":500,"default":100,"description":"Number of transactions to return (1-500, default 100)."},"offset":{"type":"integer","minimum":0,"default":0,"description":"Number of transactions to skip (default 0)."},"sortBy":{"type":"string","enum":["date","amountValue","fromTo"],"default":"date","description":"Column to sort by."},"sortDirection":{"type":"string","enum":["asc","desc"],"default":"desc","description":"Sort direction."},"filters":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["status"]},"status":{"type":"string","enum":["all","open","incompleteTransfer","inTransitStale"],"description":"\"all\" = no filter, \"open\" = uncategorized, partially categorized, or an incomplete transfer (no counter yet, or still in transit / not matched), \"incompleteTransfer\" = unfinished transfers: missing a counter (directly linked or not yet booked through transit) OR still in transit (booked onto a transit account but not yet matched to the arriving side); the real leg only, not its transit mirror, \"inTransitStale\" = the in-transit subset whose money left more than 14 days ago."}},"required":["type","status"]},{"type":"object","properties":{"type":{"type":"string","enum":["account"]},"accounts":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Account IDs to include."}},"required":["type","accounts"]},{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"YYYY-MM-DD"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"YYYY-MM-DD"}},"required":["type","startDate","endDate"]},{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"texts":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Search terms (OR logic)."}},"required":["type","texts"]},{"type":"object","properties":{"type":{"type":"string","enum":["fromTo"]},"texts":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Search terms (OR logic)."}},"required":["type","texts"]},{"type":"object","properties":{"type":{"type":"string","enum":["description"]},"texts":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Search terms (OR logic)."}},"required":["type","texts"]},{"type":"object","properties":{"type":{"type":"string","enum":["amount"]},"minAmount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"],"description":"Omit for no lower bound."},"maxAmount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"],"description":"Omit for no upper bound."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["assignedUser"]},"userIds":{"type":"array","items":{"type":"string"},"minItems":1,"description":"User IDs to filter by. Omit to match any user."},"showUnassigned":{"type":"boolean","default":true,"description":"Include transactions with no assigned user."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["quickSearch"]},"text":{"type":"string","description":"Searches fromTo, description, notes, and account name."},"minAmount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"],"description":"An amount with value and currency."},"maxAmount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"],"description":"An amount with value and currency."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["plType"]},"plTypes":{"type":"array","items":{"type":"string","enum":["revenue","cogs","cac","pd","ga","no","neutral"]},"minItems":1,"description":"P&L types to filter for."}},"required":["type","plTypes"]},{"type":"object","properties":{"type":{"type":"string","enum":["category"]},"categories":{"type":"array","items":{"type":"string"},"description":"Category IDs to include. Omit to include all categories; pass an empty array to include none (use together with showUnassigned to match only uncategorized transactions)."},"showUnassigned":{"type":"boolean","default":true,"description":"Include transactions with no categorizations."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["excludeCategory"]},"categories":{"type":"array","items":{"type":"string"},"description":"Category IDs to exclude. An empty array excludes nothing."}},"required":["type","categories"]},{"type":"object","properties":{"type":{"type":"string","enum":["counterparty"]},"counterparties":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Counterparty IDs to include."},"showUnassigned":{"type":"boolean","default":false,"description":"Include categorizations with no counterparty."}},"required":["type","counterparties"]},{"type":"object","properties":{"type":{"type":"string","enum":["usingDate"]},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"YYYY-MM-DD"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"YYYY-MM-DD"}},"required":["type","startDate","endDate"]},{"type":"object","properties":{"type":{"type":"string","enum":["cashFlowDirection"]},"direction":{"type":"string","enum":["inflow","outflow"],"description":"\"inflow\" = positive amounts, \"outflow\" = negative amounts."}},"required":["type","direction"]},{"type":"object","properties":{"type":{"type":"string","enum":["transactionIds"]},"ids":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":100,"description":"Array of transaction IDs to match (max 100)."}},"required":["type","ids"]}]},"default":[],"description":"Array of filter objects. Each filter is active by its presence."}}}}}},"responses":{"200":{"description":"Paginated search results","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"accountId":{"type":"string","format":"uuid","description":"The ID of the account associated with this transaction."},"date":{"type":"string","description":"The date of the transaction (YYYY-MM-DD)."},"fromTo":{"type":"string","nullable":true,"description":"A description of the sender or recipient of the transaction."},"description":{"type":"string","nullable":true,"description":"A user- or bank-provided description or memo for the transaction."},"amountValue":{"type":"string","description":"The numerical value of the transaction amount."},"amountCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The currency of the transaction amount."},"categorizationsAutoAssigned":{"type":"boolean","nullable":true,"description":"Flag indicating if the categorizations were automatically assigned."},"excludeFromAutoCategorization":{"type":"boolean","description":"Flag to exclude this transaction from automatic categorization."},"notes":{"type":"string","nullable":true,"description":"Additional notes or comments for the transaction."},"source":{"type":"string","nullable":true,"description":"The source of the transaction data (e.g., bank import, manual entry)."},"assignedUserId":{"type":"string","nullable":true,"description":"The ID of the user to whom this transaction is assigned for review."},"finApiTransactionId":{"type":"string","nullable":true,"description":"The transaction ID from FinAPI, if applicable."},"plaidTransactionId":{"type":"string","nullable":true,"description":"The transaction ID from Plaid, if applicable."},"stripeBalanceTransactionId":{"type":"string","nullable":true,"description":"The balance transaction ID from Stripe, if applicable."},"stripeInvoiceId":{"type":"string","nullable":true,"description":"The invoice ID from Stripe, if applicable."},"stripeCreditNoteId":{"type":"string","nullable":true,"description":"The credit note ID from Stripe, if applicable."},"stripePaymentIntentId":{"type":"string","nullable":true,"description":"The Stripe PaymentIntent ID from the charge source."},"stripeBillingEmail":{"type":"string","nullable":true,"description":"The customer billing email from the Stripe charge source."},"hubspotPortalId":{"type":"string","nullable":true,"description":"The HubSpot portal ID from Stripe balance transaction metadata."},"hubspotInvoiceId":{"type":"string","nullable":true,"description":"The HubSpot invoice ID from Stripe balance transaction metadata."},"hubspotCategorizationResolved":{"type":"boolean","nullable":true,"description":"Whether HubSpot categorization resolution has been attempted."},"finwayExpenseNumber":{"type":"string","nullable":true},"finwayInvoiceNumber":{"type":"string","nullable":true},"pleoExpenseId":{"type":"string","nullable":true},"createdVendorId":{"type":"string","nullable":true,"format":"uuid"},"integrationId":{"type":"string","nullable":true,"format":"uuid"},"pending":{"type":"boolean","description":"Flag indicating if the transaction is pending and not yet cleared."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"categorizations":{"type":"object","additionalProperties":{"type":"object","properties":{"counterparty":{"type":"object","nullable":true,"properties":{"type":{"type":"string","enum":["customer","vendor"]},"id":{"type":"string","description":"The ID of the customer or vendor."}},"required":["type","id"],"additionalProperties":false,"description":"The customer or vendor to categorize the transaction. Null if the transaction is not mapped to a customer or vendor."},"categoryId":{"type":"string","description":"The ID of the category to categorize the transaction."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["custom"]},"startDate":{"type":"string","format":"date"},"endDate":{"type":"string","format":"date"}},"required":["type","startDate","endDate"],"additionalProperties":false}],"description":"The date rule to apply to the transaction."},"computedStartDate":{"type":"string","format":"date","description":"The start date to apply to the transaction."},"computedEndDate":{"type":"string","format":"date","description":"The end date to apply to the transaction."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The amount of the revenue."},"cogs":{"type":"number","description":"The amount of the cost of goods sold."},"cac":{"type":"number","description":"The amount of the customer acquisition cost."},"pd":{"type":"number","description":"The amount of the product development."},"ga":{"type":"number","description":"The amount of the general and administrative."},"no":{"type":"number","description":"The amount of the non-operating expenses."},"neutral":{"type":"number","description":"The amount assigned to neutral categories."}},"additionalProperties":false,"description":"The split of the transaction amount into different Profit & Loss (P&L) types within the same category."},"passThroughTax":{"type":"number","description":"The amount of the pass-through tax (e.g. VAT) that is not important for a profit & loss calculation."},"transferCounterPosition":{"type":"object","nullable":true,"properties":{"transactionId":{"type":"string","description":"The ID of the transaction that holds the categorization which is the counter object for a transfer between accounts."},"categorizationId":{"type":"string","description":"The ID of the categorization that is the counter object for a transfer between accounts."}},"required":["transactionId","categorizationId"],"additionalProperties":false,"description":"The counter object in a transfer between accounts. Only for categorizations of type \"transfer\"."},"internalTransitLink":{"type":"object","nullable":true,"properties":{"transactionId":{"type":"string","description":"The ID of the transaction on the same transit account that holds the linked categorization."},"categorizationId":{"type":"string","description":"The ID of the linked categorization on the same transit account."}},"required":["transactionId","categorizationId"],"additionalProperties":false,"description":"The sibling categorization on the same transit account that closes an in-flight transfer. Only for transfer categorizations on transit accounts."},"sourceNote":{"type":"string","nullable":true,"description":"Read-only context from the source system, e.g. the invoice line-item description behind this categorization. Set by integrations; not user-editable."}},"required":["counterparty","categoryId","usingDateRule","computedStartDate","computedEndDate","plSplit","passThroughTax"],"additionalProperties":false},"description":"A record mapping categorization IDs to categorization details."},"inTransit":{"type":"boolean","description":"True when this transaction is part of an open in-transit transfer (booked onto a transit account but not yet matched to the arriving side). Drives the \"needs attention\" indicator alongside the open status."},"partialAmount":{"type":"number","description":"When categorization-level filters are active, the sum of amounts from matching categorizations only. Omitted when it equals the full transaction amount."}},"required":["id","companyId","accountId","date","fromTo","description","amountValue","amountCurrency","categorizationsAutoAssigned","excludeFromAutoCategorization","notes","source","assignedUserId","finApiTransactionId","plaidTransactionId","stripeBalanceTransactionId","stripeInvoiceId","stripeCreditNoteId","stripePaymentIntentId","stripeBillingEmail","hubspotPortalId","hubspotInvoiceId","hubspotCategorizationResolved","finwayExpenseNumber","finwayInvoiceNumber","pleoExpenseId","createdVendorId","integrationId","pending","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","categorizations"]}},"totalCount":{"type":"number","description":"Total number of transactions matching all filters."},"balanceByDate":{"type":"object","additionalProperties":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"]},"description":"End-of-day account balance per visible date, in the company`s base currency. Populated only when the page rows all belong to a single account and sortBy=date."}},"required":["items","totalCount"]}}}}}}},"/companies/{companyId}/transactions/{transactionId}/transfer_chain":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"transactionId","in":"path"},{"schema":{"type":"string","minLength":1,"description":"The transfer categorization whose chain to resolve."},"required":true,"description":"The transfer categorization whose chain to resolve.","name":"categorizationId","in":"query"}],"responses":{"200":{"description":"Ordered transfer chain (real legs plus any transit hops)","content":{"application/json":{"schema":{"type":"object","properties":{"nodes":{"type":"array","items":{"type":"object","properties":{"transactionId":{"type":"string"},"categorizationId":{"type":"string"},"accountId":{"type":"string"},"accountName":{"type":"string"},"isTransit":{"type":"boolean","description":"True when the node is a transit-account mirror."},"amountValue":{"type":"string"},"amountCurrency":{"type":"string"},"date":{"type":"string"},"isCurrent":{"type":"boolean","description":"True for the categorization the chain was requested from."}},"required":["transactionId","categorizationId","accountId","accountName","isTransit","amountValue","amountCurrency","date","isCurrent"]},"description":"The transfer chain ordered \"from → to\". Empty if the categorization is not a linked transfer."}},"required":["nodes"]}}}}}}},"/companies/{companyId}/transactions/{transactionId}":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"transactionId","in":"path"}],"responses":{"200":{"description":"Transaction details with account, comments, and files","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"accountId":{"type":"string","format":"uuid","description":"The ID of the account associated with this transaction."},"date":{"type":"string","description":"The date of the transaction (YYYY-MM-DD)."},"fromTo":{"type":"string","nullable":true,"description":"A description of the sender or recipient of the transaction."},"description":{"type":"string","nullable":true,"description":"A user- or bank-provided description or memo for the transaction."},"amountValue":{"type":"string","description":"The numerical value of the transaction amount."},"amountCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The currency of the transaction amount."},"categorizationsAutoAssigned":{"type":"boolean","nullable":true,"description":"Flag indicating if the categorizations were automatically assigned."},"excludeFromAutoCategorization":{"type":"boolean","description":"Flag to exclude this transaction from automatic categorization."},"notes":{"type":"string","nullable":true,"description":"Additional notes or comments for the transaction."},"source":{"type":"string","nullable":true,"description":"The source of the transaction data (e.g., bank import, manual entry)."},"assignedUserId":{"type":"string","nullable":true,"description":"The ID of the user to whom this transaction is assigned for review."},"finApiTransactionId":{"type":"string","nullable":true,"description":"The transaction ID from FinAPI, if applicable."},"plaidTransactionId":{"type":"string","nullable":true,"description":"The transaction ID from Plaid, if applicable."},"stripeBalanceTransactionId":{"type":"string","nullable":true,"description":"The balance transaction ID from Stripe, if applicable."},"stripeInvoiceId":{"type":"string","nullable":true,"description":"The invoice ID from Stripe, if applicable."},"stripeCreditNoteId":{"type":"string","nullable":true,"description":"The credit note ID from Stripe, if applicable."},"stripePaymentIntentId":{"type":"string","nullable":true,"description":"The Stripe PaymentIntent ID from the charge source."},"stripeBillingEmail":{"type":"string","nullable":true,"description":"The customer billing email from the Stripe charge source."},"hubspotPortalId":{"type":"string","nullable":true,"description":"The HubSpot portal ID from Stripe balance transaction metadata."},"hubspotInvoiceId":{"type":"string","nullable":true,"description":"The HubSpot invoice ID from Stripe balance transaction metadata."},"hubspotCategorizationResolved":{"type":"boolean","nullable":true,"description":"Whether HubSpot categorization resolution has been attempted."},"finwayExpenseNumber":{"type":"string","nullable":true},"finwayInvoiceNumber":{"type":"string","nullable":true},"pleoExpenseId":{"type":"string","nullable":true},"createdVendorId":{"type":"string","nullable":true,"format":"uuid"},"integrationId":{"type":"string","nullable":true,"format":"uuid"},"pending":{"type":"boolean","description":"Flag indicating if the transaction is pending and not yet cleared."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"categorizations":{"type":"object","additionalProperties":{"type":"object","properties":{"counterparty":{"type":"object","nullable":true,"properties":{"type":{"type":"string","enum":["customer","vendor"]},"id":{"type":"string","description":"The ID of the customer or vendor."}},"required":["type","id"],"additionalProperties":false,"description":"The customer or vendor to categorize the transaction. Null if the transaction is not mapped to a customer or vendor."},"categoryId":{"type":"string","description":"The ID of the category to categorize the transaction."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["custom"]},"startDate":{"type":"string","format":"date"},"endDate":{"type":"string","format":"date"}},"required":["type","startDate","endDate"],"additionalProperties":false}],"description":"The date rule to apply to the transaction."},"computedStartDate":{"type":"string","format":"date","description":"The start date to apply to the transaction."},"computedEndDate":{"type":"string","format":"date","description":"The end date to apply to the transaction."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The amount of the revenue."},"cogs":{"type":"number","description":"The amount of the cost of goods sold."},"cac":{"type":"number","description":"The amount of the customer acquisition cost."},"pd":{"type":"number","description":"The amount of the product development."},"ga":{"type":"number","description":"The amount of the general and administrative."},"no":{"type":"number","description":"The amount of the non-operating expenses."},"neutral":{"type":"number","description":"The amount assigned to neutral categories."}},"additionalProperties":false,"description":"The split of the transaction amount into different Profit & Loss (P&L) types within the same category."},"passThroughTax":{"type":"number","description":"The amount of the pass-through tax (e.g. VAT) that is not important for a profit & loss calculation."},"transferCounterPosition":{"type":"object","nullable":true,"properties":{"transactionId":{"type":"string","description":"The ID of the transaction that holds the categorization which is the counter object for a transfer between accounts."},"categorizationId":{"type":"string","description":"The ID of the categorization that is the counter object for a transfer between accounts."}},"required":["transactionId","categorizationId"],"additionalProperties":false,"description":"The counter object in a transfer between accounts. Only for categorizations of type \"transfer\"."},"internalTransitLink":{"type":"object","nullable":true,"properties":{"transactionId":{"type":"string","description":"The ID of the transaction on the same transit account that holds the linked categorization."},"categorizationId":{"type":"string","description":"The ID of the linked categorization on the same transit account."}},"required":["transactionId","categorizationId"],"additionalProperties":false,"description":"The sibling categorization on the same transit account that closes an in-flight transfer. Only for transfer categorizations on transit accounts."},"sourceNote":{"type":"string","nullable":true,"description":"Read-only context from the source system, e.g. the invoice line-item description behind this categorization. Set by integrations; not user-editable."}},"required":["counterparty","categoryId","usingDateRule","computedStartDate","computedEndDate","plSplit","passThroughTax"],"additionalProperties":false},"description":"A record mapping categorization IDs to categorization details."},"account":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"importType":{"type":"string","enum":["manual","automated"]},"bankConnection":{"type":"object","properties":{"integrationId":{"type":"string","nullable":true}},"required":["integrationId"]},"accountGroup":{"type":"object","nullable":true,"properties":{"name":{"type":"string"}},"required":["name"]}},"required":["id","name","importType","bankConnection","accountGroup"]},"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"transactionId":{"type":"string","format":"uuid"},"text":{"type":"string","description":"The content of the comment."},"taggedUserIds":{"type":"array","items":{"type":"string"},"description":"User IDs mentioned in the comment."},"likedUserIds":{"type":"array","items":{"type":"string"},"description":"User IDs that liked the comment."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","transactionId","text","taggedUserIds","likedUserIds","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}},"files":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"transactionIds":{"type":"array","items":{"type":"string"},"description":"The IDs of transactions this file is attached to."},"filename":{"type":"string","description":"The original filename."},"fileExtension":{"type":"string","description":"The file extension (e.g., pdf, png)."},"size":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"description":"The file size in bytes."},"storagePath":{"type":"string","description":"The storage path in cloud storage."},"parseStatus":{"type":"string","enum":["open","running","failed","succeeded"],"description":"The status of automated document parsing."},"parseData":{"type":"object","nullable":true,"properties":{"amount":{"type":"object","nullable":true,"properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"]},"date":{"type":"string","nullable":true},"type":{"type":"string","nullable":true,"enum":["invoice","creditNote","contract","receipt","other",null]}},"required":["amount","date","type"],"description":"Parsed data extracted from the document."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","transactionIds","filename","fileExtension","size","storagePath","parseStatus","parseData","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}},"required":["id","companyId","accountId","date","fromTo","description","amountValue","amountCurrency","categorizationsAutoAssigned","excludeFromAutoCategorization","notes","source","assignedUserId","finApiTransactionId","plaidTransactionId","stripeBalanceTransactionId","stripeInvoiceId","stripeCreditNoteId","stripePaymentIntentId","stripeBillingEmail","hubspotPortalId","hubspotInvoiceId","hubspotCategorizationResolved","finwayExpenseNumber","finwayInvoiceNumber","pleoExpenseId","createdVendorId","integrationId","pending","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","categorizations","account","comments","files"]}}}},"404":{"description":"Transaction not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"transactionId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","minLength":1},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"fromTo":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"amountValue":{"type":"string"},"amountCurrency":{"type":"string"},"categorizations":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"notes":{"type":"string","nullable":true},"source":{"type":"string","nullable":true},"pending":{"type":"boolean"},"assignedUserId":{"type":"string","nullable":true}}}}}},"responses":{"200":{"description":"Updated transaction","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"accountId":{"type":"string","format":"uuid","description":"The ID of the account associated with this transaction."},"date":{"type":"string","description":"The date of the transaction (YYYY-MM-DD)."},"fromTo":{"type":"string","nullable":true,"description":"A description of the sender or recipient of the transaction."},"description":{"type":"string","nullable":true,"description":"A user- or bank-provided description or memo for the transaction."},"amountValue":{"type":"string","description":"The numerical value of the transaction amount."},"amountCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The currency of the transaction amount."},"categorizationsAutoAssigned":{"type":"boolean","nullable":true,"description":"Flag indicating if the categorizations were automatically assigned."},"excludeFromAutoCategorization":{"type":"boolean","description":"Flag to exclude this transaction from automatic categorization."},"notes":{"type":"string","nullable":true,"description":"Additional notes or comments for the transaction."},"source":{"type":"string","nullable":true,"description":"The source of the transaction data (e.g., bank import, manual entry)."},"assignedUserId":{"type":"string","nullable":true,"description":"The ID of the user to whom this transaction is assigned for review."},"finApiTransactionId":{"type":"string","nullable":true,"description":"The transaction ID from FinAPI, if applicable."},"plaidTransactionId":{"type":"string","nullable":true,"description":"The transaction ID from Plaid, if applicable."},"stripeBalanceTransactionId":{"type":"string","nullable":true,"description":"The balance transaction ID from Stripe, if applicable."},"stripeInvoiceId":{"type":"string","nullable":true,"description":"The invoice ID from Stripe, if applicable."},"stripeCreditNoteId":{"type":"string","nullable":true,"description":"The credit note ID from Stripe, if applicable."},"stripePaymentIntentId":{"type":"string","nullable":true,"description":"The Stripe PaymentIntent ID from the charge source."},"stripeBillingEmail":{"type":"string","nullable":true,"description":"The customer billing email from the Stripe charge source."},"hubspotPortalId":{"type":"string","nullable":true,"description":"The HubSpot portal ID from Stripe balance transaction metadata."},"hubspotInvoiceId":{"type":"string","nullable":true,"description":"The HubSpot invoice ID from Stripe balance transaction metadata."},"hubspotCategorizationResolved":{"type":"boolean","nullable":true,"description":"Whether HubSpot categorization resolution has been attempted."},"finwayExpenseNumber":{"type":"string","nullable":true},"finwayInvoiceNumber":{"type":"string","nullable":true},"pleoExpenseId":{"type":"string","nullable":true},"createdVendorId":{"type":"string","nullable":true,"format":"uuid"},"integrationId":{"type":"string","nullable":true,"format":"uuid"},"pending":{"type":"boolean","description":"Flag indicating if the transaction is pending and not yet cleared."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"categorizations":{"type":"object","additionalProperties":{"type":"object","properties":{"counterparty":{"type":"object","nullable":true,"properties":{"type":{"type":"string","enum":["customer","vendor"]},"id":{"type":"string","description":"The ID of the customer or vendor."}},"required":["type","id"],"additionalProperties":false,"description":"The customer or vendor to categorize the transaction. Null if the transaction is not mapped to a customer or vendor."},"categoryId":{"type":"string","description":"The ID of the category to categorize the transaction."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["custom"]},"startDate":{"type":"string","format":"date"},"endDate":{"type":"string","format":"date"}},"required":["type","startDate","endDate"],"additionalProperties":false}],"description":"The date rule to apply to the transaction."},"computedStartDate":{"type":"string","format":"date","description":"The start date to apply to the transaction."},"computedEndDate":{"type":"string","format":"date","description":"The end date to apply to the transaction."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The amount of the revenue."},"cogs":{"type":"number","description":"The amount of the cost of goods sold."},"cac":{"type":"number","description":"The amount of the customer acquisition cost."},"pd":{"type":"number","description":"The amount of the product development."},"ga":{"type":"number","description":"The amount of the general and administrative."},"no":{"type":"number","description":"The amount of the non-operating expenses."},"neutral":{"type":"number","description":"The amount assigned to neutral categories."}},"additionalProperties":false,"description":"The split of the transaction amount into different Profit & Loss (P&L) types within the same category."},"passThroughTax":{"type":"number","description":"The amount of the pass-through tax (e.g. VAT) that is not important for a profit & loss calculation."},"transferCounterPosition":{"type":"object","nullable":true,"properties":{"transactionId":{"type":"string","description":"The ID of the transaction that holds the categorization which is the counter object for a transfer between accounts."},"categorizationId":{"type":"string","description":"The ID of the categorization that is the counter object for a transfer between accounts."}},"required":["transactionId","categorizationId"],"additionalProperties":false,"description":"The counter object in a transfer between accounts. Only for categorizations of type \"transfer\"."},"internalTransitLink":{"type":"object","nullable":true,"properties":{"transactionId":{"type":"string","description":"The ID of the transaction on the same transit account that holds the linked categorization."},"categorizationId":{"type":"string","description":"The ID of the linked categorization on the same transit account."}},"required":["transactionId","categorizationId"],"additionalProperties":false,"description":"The sibling categorization on the same transit account that closes an in-flight transfer. Only for transfer categorizations on transit accounts."},"sourceNote":{"type":"string","nullable":true,"description":"Read-only context from the source system, e.g. the invoice line-item description behind this categorization. Set by integrations; not user-editable."}},"required":["counterparty","categoryId","usingDateRule","computedStartDate","computedEndDate","plSplit","passThroughTax"],"additionalProperties":false},"description":"A record mapping categorization IDs to categorization details."}},"required":["id","companyId","accountId","date","fromTo","description","amountValue","amountCurrency","categorizationsAutoAssigned","excludeFromAutoCategorization","notes","source","assignedUserId","finApiTransactionId","plaidTransactionId","stripeBalanceTransactionId","stripeInvoiceId","stripeCreditNoteId","stripePaymentIntentId","stripeBillingEmail","hubspotPortalId","hubspotInvoiceId","hubspotCategorizationResolved","finwayExpenseNumber","finwayInvoiceNumber","pleoExpenseId","createdVendorId","integrationId","pending","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","categorizations"]}}}},"404":{"description":"Transaction not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"delete":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"transactionId","in":"path"}],"responses":{"200":{"description":"Transaction deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}}},"/companies/{companyId}/transactions/batch_delete":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"selection":{"oneOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["ids"]},"ids":{"type":"array","items":{"type":"string","minLength":1},"minItems":1,"maxItems":10000,"description":"Explicit list of entity IDs to act on."}},"required":["mode","ids"]},{"type":"object","properties":{"mode":{"type":"string","enum":["filter"]},"filter":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["status"]},"status":{"type":"string","enum":["all","open","incompleteTransfer","inTransitStale"],"description":"\"all\" = no filter, \"open\" = uncategorized, partially categorized, or an incomplete transfer (no counter yet, or still in transit / not matched), \"incompleteTransfer\" = unfinished transfers: missing a counter (directly linked or not yet booked through transit) OR still in transit (booked onto a transit account but not yet matched to the arriving side); the real leg only, not its transit mirror, \"inTransitStale\" = the in-transit subset whose money left more than 14 days ago."}},"required":["type","status"]},{"type":"object","properties":{"type":{"type":"string","enum":["account"]},"accounts":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Account IDs to include."}},"required":["type","accounts"]},{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"YYYY-MM-DD"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"YYYY-MM-DD"}},"required":["type","startDate","endDate"]},{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"texts":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Search terms (OR logic)."}},"required":["type","texts"]},{"type":"object","properties":{"type":{"type":"string","enum":["fromTo"]},"texts":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Search terms (OR logic)."}},"required":["type","texts"]},{"type":"object","properties":{"type":{"type":"string","enum":["description"]},"texts":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Search terms (OR logic)."}},"required":["type","texts"]},{"type":"object","properties":{"type":{"type":"string","enum":["amount"]},"minAmount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"],"description":"Omit for no lower bound."},"maxAmount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"],"description":"Omit for no upper bound."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["assignedUser"]},"userIds":{"type":"array","items":{"type":"string"},"minItems":1,"description":"User IDs to filter by. Omit to match any user."},"showUnassigned":{"type":"boolean","default":true,"description":"Include transactions with no assigned user."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["quickSearch"]},"text":{"type":"string","description":"Searches fromTo, description, notes, and account name."},"minAmount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"],"description":"An amount with value and currency."},"maxAmount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"],"description":"An amount with value and currency."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["plType"]},"plTypes":{"type":"array","items":{"type":"string","enum":["revenue","cogs","cac","pd","ga","no","neutral"]},"minItems":1,"description":"P&L types to filter for."}},"required":["type","plTypes"]},{"type":"object","properties":{"type":{"type":"string","enum":["category"]},"categories":{"type":"array","items":{"type":"string"},"description":"Category IDs to include. Omit to include all categories; pass an empty array to include none (use together with showUnassigned to match only uncategorized transactions)."},"showUnassigned":{"type":"boolean","default":true,"description":"Include transactions with no categorizations."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["excludeCategory"]},"categories":{"type":"array","items":{"type":"string"},"description":"Category IDs to exclude. An empty array excludes nothing."}},"required":["type","categories"]},{"type":"object","properties":{"type":{"type":"string","enum":["counterparty"]},"counterparties":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Counterparty IDs to include."},"showUnassigned":{"type":"boolean","default":false,"description":"Include categorizations with no counterparty."}},"required":["type","counterparties"]},{"type":"object","properties":{"type":{"type":"string","enum":["usingDate"]},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"YYYY-MM-DD"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"YYYY-MM-DD"}},"required":["type","startDate","endDate"]},{"type":"object","properties":{"type":{"type":"string","enum":["cashFlowDirection"]},"direction":{"type":"string","enum":["inflow","outflow"],"description":"\"inflow\" = positive amounts, \"outflow\" = negative amounts."}},"required":["type","direction"]},{"type":"object","properties":{"type":{"type":"string","enum":["transactionIds"]},"ids":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":100,"description":"Array of transaction IDs to match (max 100)."}},"required":["type","ids"]}]},"description":"Filter spec matching the list endpoint; resolves to all matching rows."},"excludedIds":{"type":"array","items":{"type":"string","minLength":1},"maxItems":10000,"default":[],"description":"IDs to exclude from the resolved filter result."}},"required":["mode","filter"]}]}},"required":["selection"]}}}},"responses":{"200":{"description":"Transactions deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"affected":{"type":"integer","minimum":0}},"required":["success","affected"]}}}},"413":{"description":"Selection exceeds bulk cap","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["bulk_too_many"]},"count":{"type":"integer","minimum":0},"max":{"type":"integer","minimum":0}},"required":["error","count","max"]}}}},"422":{"description":"Selection contains integration-managed transactions","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["integration_managed"]},"count":{"type":"integer","minimum":0}},"required":["error","count"]}}}}}}},"/companies/{companyId}/transactions/uncategorize":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"selection":{"oneOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["ids"]},"ids":{"type":"array","items":{"type":"string","minLength":1},"minItems":1,"maxItems":10000,"description":"Explicit list of entity IDs to act on."}},"required":["mode","ids"]},{"type":"object","properties":{"mode":{"type":"string","enum":["filter"]},"filter":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["status"]},"status":{"type":"string","enum":["all","open","incompleteTransfer","inTransitStale"],"description":"\"all\" = no filter, \"open\" = uncategorized, partially categorized, or an incomplete transfer (no counter yet, or still in transit / not matched), \"incompleteTransfer\" = unfinished transfers: missing a counter (directly linked or not yet booked through transit) OR still in transit (booked onto a transit account but not yet matched to the arriving side); the real leg only, not its transit mirror, \"inTransitStale\" = the in-transit subset whose money left more than 14 days ago."}},"required":["type","status"]},{"type":"object","properties":{"type":{"type":"string","enum":["account"]},"accounts":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Account IDs to include."}},"required":["type","accounts"]},{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"YYYY-MM-DD"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"YYYY-MM-DD"}},"required":["type","startDate","endDate"]},{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"texts":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Search terms (OR logic)."}},"required":["type","texts"]},{"type":"object","properties":{"type":{"type":"string","enum":["fromTo"]},"texts":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Search terms (OR logic)."}},"required":["type","texts"]},{"type":"object","properties":{"type":{"type":"string","enum":["description"]},"texts":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Search terms (OR logic)."}},"required":["type","texts"]},{"type":"object","properties":{"type":{"type":"string","enum":["amount"]},"minAmount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"],"description":"Omit for no lower bound."},"maxAmount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"],"description":"Omit for no upper bound."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["assignedUser"]},"userIds":{"type":"array","items":{"type":"string"},"minItems":1,"description":"User IDs to filter by. Omit to match any user."},"showUnassigned":{"type":"boolean","default":true,"description":"Include transactions with no assigned user."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["quickSearch"]},"text":{"type":"string","description":"Searches fromTo, description, notes, and account name."},"minAmount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"],"description":"An amount with value and currency."},"maxAmount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"],"description":"An amount with value and currency."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["plType"]},"plTypes":{"type":"array","items":{"type":"string","enum":["revenue","cogs","cac","pd","ga","no","neutral"]},"minItems":1,"description":"P&L types to filter for."}},"required":["type","plTypes"]},{"type":"object","properties":{"type":{"type":"string","enum":["category"]},"categories":{"type":"array","items":{"type":"string"},"description":"Category IDs to include. Omit to include all categories; pass an empty array to include none (use together with showUnassigned to match only uncategorized transactions)."},"showUnassigned":{"type":"boolean","default":true,"description":"Include transactions with no categorizations."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["excludeCategory"]},"categories":{"type":"array","items":{"type":"string"},"description":"Category IDs to exclude. An empty array excludes nothing."}},"required":["type","categories"]},{"type":"object","properties":{"type":{"type":"string","enum":["counterparty"]},"counterparties":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Counterparty IDs to include."},"showUnassigned":{"type":"boolean","default":false,"description":"Include categorizations with no counterparty."}},"required":["type","counterparties"]},{"type":"object","properties":{"type":{"type":"string","enum":["usingDate"]},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"YYYY-MM-DD"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"YYYY-MM-DD"}},"required":["type","startDate","endDate"]},{"type":"object","properties":{"type":{"type":"string","enum":["cashFlowDirection"]},"direction":{"type":"string","enum":["inflow","outflow"],"description":"\"inflow\" = positive amounts, \"outflow\" = negative amounts."}},"required":["type","direction"]},{"type":"object","properties":{"type":{"type":"string","enum":["transactionIds"]},"ids":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":100,"description":"Array of transaction IDs to match (max 100)."}},"required":["type","ids"]}]},"description":"Filter spec matching the list endpoint; resolves to all matching rows."},"excludedIds":{"type":"array","items":{"type":"string","minLength":1},"maxItems":10000,"default":[],"description":"IDs to exclude from the resolved filter result."}},"required":["mode","filter"]}]}},"required":["selection"]}}}},"responses":{"200":{"description":"Transactions uncategorized","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"affected":{"type":"integer","minimum":0}},"required":["success","affected"]}}}},"413":{"description":"Selection exceeds bulk cap","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["bulk_too_many"]},"count":{"type":"integer","minimum":0},"max":{"type":"integer","minimum":0}},"required":["error","count","max"]}}}}}}},"/companies/{companyId}/transactions/batch_edit":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"selection":{"oneOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["ids"]},"ids":{"type":"array","items":{"type":"string","minLength":1},"minItems":1,"maxItems":10000,"description":"Explicit list of entity IDs to act on."}},"required":["mode","ids"]},{"type":"object","properties":{"mode":{"type":"string","enum":["filter"]},"filter":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["status"]},"status":{"type":"string","enum":["all","open","incompleteTransfer","inTransitStale"],"description":"\"all\" = no filter, \"open\" = uncategorized, partially categorized, or an incomplete transfer (no counter yet, or still in transit / not matched), \"incompleteTransfer\" = unfinished transfers: missing a counter (directly linked or not yet booked through transit) OR still in transit (booked onto a transit account but not yet matched to the arriving side); the real leg only, not its transit mirror, \"inTransitStale\" = the in-transit subset whose money left more than 14 days ago."}},"required":["type","status"]},{"type":"object","properties":{"type":{"type":"string","enum":["account"]},"accounts":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Account IDs to include."}},"required":["type","accounts"]},{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"YYYY-MM-DD"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"YYYY-MM-DD"}},"required":["type","startDate","endDate"]},{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"texts":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Search terms (OR logic)."}},"required":["type","texts"]},{"type":"object","properties":{"type":{"type":"string","enum":["fromTo"]},"texts":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Search terms (OR logic)."}},"required":["type","texts"]},{"type":"object","properties":{"type":{"type":"string","enum":["description"]},"texts":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Search terms (OR logic)."}},"required":["type","texts"]},{"type":"object","properties":{"type":{"type":"string","enum":["amount"]},"minAmount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"],"description":"Omit for no lower bound."},"maxAmount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"],"description":"Omit for no upper bound."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["assignedUser"]},"userIds":{"type":"array","items":{"type":"string"},"minItems":1,"description":"User IDs to filter by. Omit to match any user."},"showUnassigned":{"type":"boolean","default":true,"description":"Include transactions with no assigned user."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["quickSearch"]},"text":{"type":"string","description":"Searches fromTo, description, notes, and account name."},"minAmount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"],"description":"An amount with value and currency."},"maxAmount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"],"description":"An amount with value and currency."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["plType"]},"plTypes":{"type":"array","items":{"type":"string","enum":["revenue","cogs","cac","pd","ga","no","neutral"]},"minItems":1,"description":"P&L types to filter for."}},"required":["type","plTypes"]},{"type":"object","properties":{"type":{"type":"string","enum":["category"]},"categories":{"type":"array","items":{"type":"string"},"description":"Category IDs to include. Omit to include all categories; pass an empty array to include none (use together with showUnassigned to match only uncategorized transactions)."},"showUnassigned":{"type":"boolean","default":true,"description":"Include transactions with no categorizations."}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["excludeCategory"]},"categories":{"type":"array","items":{"type":"string"},"description":"Category IDs to exclude. An empty array excludes nothing."}},"required":["type","categories"]},{"type":"object","properties":{"type":{"type":"string","enum":["counterparty"]},"counterparties":{"type":"array","items":{"type":"string"},"minItems":1,"description":"Counterparty IDs to include."},"showUnassigned":{"type":"boolean","default":false,"description":"Include categorizations with no counterparty."}},"required":["type","counterparties"]},{"type":"object","properties":{"type":{"type":"string","enum":["usingDate"]},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"YYYY-MM-DD"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"YYYY-MM-DD"}},"required":["type","startDate","endDate"]},{"type":"object","properties":{"type":{"type":"string","enum":["cashFlowDirection"]},"direction":{"type":"string","enum":["inflow","outflow"],"description":"\"inflow\" = positive amounts, \"outflow\" = negative amounts."}},"required":["type","direction"]},{"type":"object","properties":{"type":{"type":"string","enum":["transactionIds"]},"ids":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":100,"description":"Array of transaction IDs to match (max 100)."}},"required":["type","ids"]}]},"description":"Filter spec matching the list endpoint; resolves to all matching rows."},"excludedIds":{"type":"array","items":{"type":"string","minLength":1},"maxItems":10000,"default":[],"description":"IDs to exclude from the resolved filter result."}},"required":["mode","filter"]}]},"patch":{"type":"object","properties":{"assignedUserId":{"type":"string","nullable":true,"description":"Set the assigned user for every selected transaction. Null clears the field. Omit to leave unchanged."},"notes":{"type":"string","nullable":true,"description":"Set notes on every selected transaction. Null clears the field. Omit to leave unchanged."},"categorizationTemplate":{"type":"object","properties":{"counterparty":{"type":"object","nullable":true,"properties":{"type":{"type":"string","enum":["customer","vendor"]},"id":{"type":"string","description":"The ID of the customer or vendor."}},"required":["type","id"],"additionalProperties":false,"description":"The customer or vendor to categorize the transaction. Null if the transaction is not mapped to a customer or vendor."},"categoryId":{"type":"string","description":"The default category to assign to transactions from this counterparty."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"The default date rule to apply to transactions from this counterparty."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The share of the transaction amount that is considered revenue in percent."},"cogs":{"type":"number","description":"The share of the transaction amount that is considered cost of goods sold in percent."},"cac":{"type":"number","description":"The share of the transaction amount that is considered customer acquisition cost in percent."},"pd":{"type":"number","description":"The share of the transaction amount that is considered product development in percent."},"ga":{"type":"number","description":"The share of the transaction amount that is considered general and administrative in percent."},"no":{"type":"number","description":"The share of the transaction amount that is considered non-operating expenses in percent."},"neutral":{"type":"number","description":"The share of the transaction amount that is considered neutral in percent."}},"additionalProperties":false,"description":"The default split of the transaction amount into different Profit & Loss (P&L) types. The sum of the percentages needs to be 100%."},"passThroughTax":{"type":"number","description":"The pass-through tax (e.g. VAT) that comes on top of the amount covered by the P&L split."}},"required":["counterparty","categoryId","usingDateRule","plSplit","passThroughTax"],"additionalProperties":false,"description":"Apply a categorization template to every selected transaction. The split is computed per-row from each row`s amount and date. Replaces any existing categorizations on those rows."}}}},"required":["selection","patch"]}}}},"responses":{"200":{"description":"Transactions updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"affected":{"type":"integer","minimum":0}},"required":["success","affected"]}}}},"413":{"description":"Selection exceeds bulk cap","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["bulk_too_many"]},"count":{"type":"integer","minimum":0},"max":{"type":"integer","minimum":0}},"required":["error","count","max"]}}}}}}},"/companies/{companyId}/transactions/categorization_status":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"transactionIds":{"type":"array","items":{"type":"string","minLength":1},"maxItems":10000}},"required":["transactionIds"]}}}},"responses":{"200":{"description":"The subset of the given transactions that are still open.","content":{"application/json":{"schema":{"type":"object","properties":{"openTransactionIds":{"type":"array","items":{"type":"string"}},"amountsById":{"type":"object","additionalProperties":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"]}}},"required":["openTransactionIds","amountsById"]}}}}}}},"/companies/{companyId}/transactions/import":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"transactions":{"type":"array","items":{"type":"object","properties":{"accountId":{"type":"string","minLength":1},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"fromTo":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"amountValue":{"anyOf":[{"type":"string"},{"type":"number"}]},"amountCurrency":{"type":"string"}},"required":["accountId","date","fromTo","description","amountValue","amountCurrency"]}}},"required":["transactions"]}}}},"responses":{"201":{"description":"Transactions imported","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"count":{"type":"number"}},"required":["success","count"]}}}}}}},"/companies/{companyId}/transactions/unlink_transfer":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1},"categorizationId":{"type":"string","minLength":1},"link":{"type":"string","enum":["counter","path","transit"],"default":"counter","description":"How much of a transit-routed transfer to unlink: \"path\" dissolves the whole transfer — both account transactions are unlinked and the auto-created transit bookings are removed; \"counter\" (default) unlinks only this transaction from its transit booking; \"transit\" reopens a closed path by unlinking only the two transit positions. For directly linked (non-transit) transfers the value is ignored."}},"required":["transactionId","categorizationId"]}}}},"responses":{"200":{"description":"Transfer unlinked","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"404":{"description":"Transaction not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"The link changed concurrently — reload and retry","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"422":{"description":"The transfer cannot be unlinked in this state","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/transactions/create_counter_transaction":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"sourceTransactionId":{"type":"string","minLength":1},"sourceCategorizationId":{"type":"string","minLength":1},"targetAccountId":{"type":"string","minLength":1}},"required":["sourceTransactionId","sourceCategorizationId","targetAccountId"]}}}},"responses":{"201":{"description":"Counter transaction created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"accountId":{"type":"string","format":"uuid","description":"The ID of the account associated with this transaction."},"date":{"type":"string","description":"The date of the transaction (YYYY-MM-DD)."},"fromTo":{"type":"string","nullable":true,"description":"A description of the sender or recipient of the transaction."},"description":{"type":"string","nullable":true,"description":"A user- or bank-provided description or memo for the transaction."},"amountValue":{"type":"string","description":"The numerical value of the transaction amount."},"amountCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The currency of the transaction amount."},"categorizationsAutoAssigned":{"type":"boolean","nullable":true,"description":"Flag indicating if the categorizations were automatically assigned."},"excludeFromAutoCategorization":{"type":"boolean","description":"Flag to exclude this transaction from automatic categorization."},"notes":{"type":"string","nullable":true,"description":"Additional notes or comments for the transaction."},"source":{"type":"string","nullable":true,"description":"The source of the transaction data (e.g., bank import, manual entry)."},"assignedUserId":{"type":"string","nullable":true,"description":"The ID of the user to whom this transaction is assigned for review."},"finApiTransactionId":{"type":"string","nullable":true,"description":"The transaction ID from FinAPI, if applicable."},"plaidTransactionId":{"type":"string","nullable":true,"description":"The transaction ID from Plaid, if applicable."},"stripeBalanceTransactionId":{"type":"string","nullable":true,"description":"The balance transaction ID from Stripe, if applicable."},"stripeInvoiceId":{"type":"string","nullable":true,"description":"The invoice ID from Stripe, if applicable."},"stripeCreditNoteId":{"type":"string","nullable":true,"description":"The credit note ID from Stripe, if applicable."},"stripePaymentIntentId":{"type":"string","nullable":true,"description":"The Stripe PaymentIntent ID from the charge source."},"stripeBillingEmail":{"type":"string","nullable":true,"description":"The customer billing email from the Stripe charge source."},"hubspotPortalId":{"type":"string","nullable":true,"description":"The HubSpot portal ID from Stripe balance transaction metadata."},"hubspotInvoiceId":{"type":"string","nullable":true,"description":"The HubSpot invoice ID from Stripe balance transaction metadata."},"hubspotCategorizationResolved":{"type":"boolean","nullable":true,"description":"Whether HubSpot categorization resolution has been attempted."},"finwayExpenseNumber":{"type":"string","nullable":true},"finwayInvoiceNumber":{"type":"string","nullable":true},"pleoExpenseId":{"type":"string","nullable":true},"createdVendorId":{"type":"string","nullable":true,"format":"uuid"},"integrationId":{"type":"string","nullable":true,"format":"uuid"},"pending":{"type":"boolean","description":"Flag indicating if the transaction is pending and not yet cleared."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"categorizations":{"type":"object","additionalProperties":{"type":"object","properties":{"counterparty":{"type":"object","nullable":true,"properties":{"type":{"type":"string","enum":["customer","vendor"]},"id":{"type":"string","description":"The ID of the customer or vendor."}},"required":["type","id"],"additionalProperties":false,"description":"The customer or vendor to categorize the transaction. Null if the transaction is not mapped to a customer or vendor."},"categoryId":{"type":"string","description":"The ID of the category to categorize the transaction."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["custom"]},"startDate":{"type":"string","format":"date"},"endDate":{"type":"string","format":"date"}},"required":["type","startDate","endDate"],"additionalProperties":false}],"description":"The date rule to apply to the transaction."},"computedStartDate":{"type":"string","format":"date","description":"The start date to apply to the transaction."},"computedEndDate":{"type":"string","format":"date","description":"The end date to apply to the transaction."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The amount of the revenue."},"cogs":{"type":"number","description":"The amount of the cost of goods sold."},"cac":{"type":"number","description":"The amount of the customer acquisition cost."},"pd":{"type":"number","description":"The amount of the product development."},"ga":{"type":"number","description":"The amount of the general and administrative."},"no":{"type":"number","description":"The amount of the non-operating expenses."},"neutral":{"type":"number","description":"The amount assigned to neutral categories."}},"additionalProperties":false,"description":"The split of the transaction amount into different Profit & Loss (P&L) types within the same category."},"passThroughTax":{"type":"number","description":"The amount of the pass-through tax (e.g. VAT) that is not important for a profit & loss calculation."},"transferCounterPosition":{"type":"object","nullable":true,"properties":{"transactionId":{"type":"string","description":"The ID of the transaction that holds the categorization which is the counter object for a transfer between accounts."},"categorizationId":{"type":"string","description":"The ID of the categorization that is the counter object for a transfer between accounts."}},"required":["transactionId","categorizationId"],"additionalProperties":false,"description":"The counter object in a transfer between accounts. Only for categorizations of type \"transfer\"."},"internalTransitLink":{"type":"object","nullable":true,"properties":{"transactionId":{"type":"string","description":"The ID of the transaction on the same transit account that holds the linked categorization."},"categorizationId":{"type":"string","description":"The ID of the linked categorization on the same transit account."}},"required":["transactionId","categorizationId"],"additionalProperties":false,"description":"The sibling categorization on the same transit account that closes an in-flight transfer. Only for transfer categorizations on transit accounts."},"sourceNote":{"type":"string","nullable":true,"description":"Read-only context from the source system, e.g. the invoice line-item description behind this categorization. Set by integrations; not user-editable."}},"required":["counterparty","categoryId","usingDateRule","computedStartDate","computedEndDate","plSplit","passThroughTax"],"additionalProperties":false},"description":"A record mapping categorization IDs to categorization details."}},"required":["id","companyId","accountId","date","fromTo","description","amountValue","amountCurrency","categorizationsAutoAssigned","excludeFromAutoCategorization","notes","source","assignedUserId","finApiTransactionId","plaidTransactionId","stripeBalanceTransactionId","stripeInvoiceId","stripeCreditNoteId","stripePaymentIntentId","stripeBillingEmail","hubspotPortalId","hubspotInvoiceId","hubspotCategorizationResolved","finwayExpenseNumber","finwayInvoiceNumber","pleoExpenseId","createdVendorId","integrationId","pending","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","categorizations"]}}}},"404":{"description":"Source transaction not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"The source transaction is already linked or changed concurrently","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"422":{"description":"The counter transaction cannot be booked through transit","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/transactions/link_transfer":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"sourceTransactionId":{"type":"string","minLength":1},"sourceCategorizationId":{"type":"string","minLength":1},"targetTransactionId":{"type":"string","minLength":1}},"required":["sourceTransactionId","sourceCategorizationId","targetTransactionId"]}}}},"responses":{"200":{"description":"Transfer linked","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"404":{"description":"Transaction not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"One side is already linked or changed concurrently","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"422":{"description":"The two transactions cannot be linked as a transfer in this state","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/integrations":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"responses":{"200":{"description":"List of integrations","content":{"application/json":{"schema":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["stripe"],"description":"The type of integration."},"stripeMode":{"type":"string","enum":["test","live"],"description":"The mode of the Stripe integration (test or live)."},"lastAccountSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful account synchronization. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSubscriptionSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful subscription synchronization. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","lastAccountSyncTime","lastSubscriptionSyncTime","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["slack"],"description":"The type of integration."},"slackChannel":{"type":"string","description":"The Slack channel name."},"slackChannelId":{"type":"string","description":"The Slack channel ID."},"slackTeamId":{"type":"string","description":"The Slack team ID."},"slackTeamName":{"type":"string","description":"The Slack team name."},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","slackChannel","slackChannelId","slackTeamId","slackTeamName","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["hubspot"],"description":"The type of integration."},"hubspotPortalId":{"type":"string","description":"The HubSpot portal (account) ID."},"lastSubscriptionSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful subscription synchronization. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","hubspotPortalId","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["datevPayroll"],"description":"The type of integration."},"lastUploadTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful CSV upload. Null if never uploaded. Format: YYYY-MM-DDTHH:MM:SSZ"},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","lastUploadTime","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["finway"],"description":"The type of integration."},"lastWalletUploadTime":{"type":"string","nullable":true,"format":"date-time","description":"ISO datetime of the last successful wallet statement upload. Null if never."},"lastAntragUploadTime":{"type":"string","nullable":true,"format":"date-time","description":"ISO datetime of the last successful Antrag ('Alle Formate' zip) upload. Null if never."},"costCategoryMap":{"type":"object","additionalProperties":{"type":"object","properties":{"template":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string","description":"The default category to assign to transactions from this counterparty."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"The default date rule to apply to transactions from this counterparty."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The share of the transaction amount that is considered revenue in percent."},"cogs":{"type":"number","description":"The share of the transaction amount that is considered cost of goods sold in percent."},"cac":{"type":"number","description":"The share of the transaction amount that is considered customer acquisition cost in percent."},"pd":{"type":"number","description":"The share of the transaction amount that is considered product development in percent."},"ga":{"type":"number","description":"The share of the transaction amount that is considered general and administrative in percent."},"no":{"type":"number","description":"The share of the transaction amount that is considered non-operating expenses in percent."},"neutral":{"type":"number","description":"The share of the transaction amount that is considered neutral in percent."}},"additionalProperties":false,"description":"The default split of the transaction amount into different Profit & Loss (P&L) types. The sum of the percentages needs to be 100%."},"passThroughTax":{"type":"number","description":"The pass-through tax (e.g. VAT) that comes on top of the amount covered by the P&L split."}},"required":["categoryId","usingDateRule","plSplit","passThroughTax"],"additionalProperties":false,"description":"Categorization template applied to every wallet payment line under this cost center. Null means skipped. `passThroughTax` and `usingDateRule` are placeholders for Finway — real tax / dates come from the Antrag line."},"label":{"type":"string","description":"Human-readable Kostenstelle label as last seen in Finway (e.g. 'Materialkosten/ Produktion'). Refreshed on every Antrag upload."},"mappedTime":{"type":"string","format":"date-time","description":"ISO datetime the mapping was created."},"mappedByUserId":{"type":"string","description":"Firebase UID that created the mapping."}},"required":["template","label","mappedTime","mappedByUserId"]},"default":{},"description":"Map keyed by Finway CostCenter1ID (e.g. '30') to the chosen SaaSFlow category. Always present in Antrag exports, stable across Finway tenants — preferred over Sachkonto string keying."},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","lastWalletUploadTime","lastAntragUploadTime","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["pleo"],"description":"The type of integration."},"lastExportUploadTime":{"type":"string","nullable":true,"format":"date-time","description":"ISO datetime of the last successful Pleo export upload. Null if never."},"lastReimbursementsUploadTime":{"type":"string","nullable":true,"format":"date-time","default":null,"description":"ISO datetime of the last successful Pleo reimbursements (Rückerstattungen) upload. Null if never."},"plMappingField":{"type":"object","nullable":true,"properties":{"keyColumn":{"type":"string","description":"CSV column header whose value uniquely identifies the categorization bucket (e.g. 'Chart of Accounts - Code')."},"labelColumn":{"type":"string","nullable":true,"description":"Optional CSV column header used as the human-readable label for picker rows. Null falls back to using the keyColumn value as both key and label."}},"required":["keyColumn","labelColumn"],"description":"CSV column pair used to derive the categorization key + label. Null until the first upload completes the column-picker step."},"mappingValueMap":{"type":"object","additionalProperties":{"type":"object","properties":{"template":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string","description":"The default category to assign to transactions from this counterparty."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"The default date rule to apply to transactions from this counterparty."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The share of the transaction amount that is considered revenue in percent."},"cogs":{"type":"number","description":"The share of the transaction amount that is considered cost of goods sold in percent."},"cac":{"type":"number","description":"The share of the transaction amount that is considered customer acquisition cost in percent."},"pd":{"type":"number","description":"The share of the transaction amount that is considered product development in percent."},"ga":{"type":"number","description":"The share of the transaction amount that is considered general and administrative in percent."},"no":{"type":"number","description":"The share of the transaction amount that is considered non-operating expenses in percent."},"neutral":{"type":"number","description":"The share of the transaction amount that is considered neutral in percent."}},"additionalProperties":false,"description":"The default split of the transaction amount into different Profit & Loss (P&L) types. The sum of the percentages needs to be 100%."},"passThroughTax":{"type":"number","description":"The pass-through tax (e.g. VAT) that comes on top of the amount covered by the P&L split."}},"required":["categoryId","usingDateRule","plSplit","passThroughTax"],"additionalProperties":false,"description":"Categorization template applied to every Pleo wallet row whose mapping field equals this entry key. Null means skipped. `passThroughTax` and `usingDateRule` are placeholders — real values come from the CSV row at apply time."},"label":{"type":"string","description":"Human-readable label for the mapping value (typically the matching \"Name\" column, e.g. \"266 Marketing Magazine FR\" when the key is \"266\"). Refreshed on every Pleo upload."},"mappedTime":{"type":"string","format":"date-time","description":"ISO datetime the mapping was created."},"mappedByUserId":{"type":"string","description":"Firebase UID that created the mapping."}},"required":["template","label","mappedTime","mappedByUserId"]},"default":{},"description":"Map keyed by the chosen CSV column's value (e.g. '266') to the user-picked SaaSFlow category template. Re-used on every subsequent upload — only new mapping values are surfaced to the picker."},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","lastExportUploadTime","plMappingField","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["salesforce"],"description":"The type of integration."},"salesforceOrgId":{"type":"string","description":"The Salesforce org ID (15- or 18-char, starts with 00D)."},"salesforceInstanceUrl":{"type":"string","description":"The per-org Salesforce REST API host returned by OAuth (e.g. https://acme.my.salesforce.com). Required for every API call to this org."},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","salesforceOrgId","salesforceInstanceUrl","id"],"additionalProperties":false}]}}}}}}}},"/companies/{companyId}/integrations/{integrationId}":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"integrationId","in":"path"}],"responses":{"200":{"description":"Integration details","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["stripe"],"description":"The type of integration."},"stripeMode":{"type":"string","enum":["test","live"],"description":"The mode of the Stripe integration (test or live)."},"lastAccountSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful account synchronization. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"lastSubscriptionSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful subscription synchronization. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","lastAccountSyncTime","lastSubscriptionSyncTime","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["slack"],"description":"The type of integration."},"slackChannel":{"type":"string","description":"The Slack channel name."},"slackChannelId":{"type":"string","description":"The Slack channel ID."},"slackTeamId":{"type":"string","description":"The Slack team ID."},"slackTeamName":{"type":"string","description":"The Slack team name."},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","slackChannel","slackChannelId","slackTeamId","slackTeamName","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["hubspot"],"description":"The type of integration."},"hubspotPortalId":{"type":"string","description":"The HubSpot portal (account) ID."},"lastSubscriptionSyncTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful subscription synchronization. Null if never synced. Format: YYYY-MM-DDTHH:MM:SSZ"},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","hubspotPortalId","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["datevPayroll"],"description":"The type of integration."},"lastUploadTime":{"type":"string","nullable":true,"format":"date-time","description":"The ISO datetime of the last successful CSV upload. Null if never uploaded. Format: YYYY-MM-DDTHH:MM:SSZ"},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","lastUploadTime","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["finway"],"description":"The type of integration."},"lastWalletUploadTime":{"type":"string","nullable":true,"format":"date-time","description":"ISO datetime of the last successful wallet statement upload. Null if never."},"lastAntragUploadTime":{"type":"string","nullable":true,"format":"date-time","description":"ISO datetime of the last successful Antrag ('Alle Formate' zip) upload. Null if never."},"costCategoryMap":{"type":"object","additionalProperties":{"type":"object","properties":{"template":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string","description":"The default category to assign to transactions from this counterparty."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"The default date rule to apply to transactions from this counterparty."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The share of the transaction amount that is considered revenue in percent."},"cogs":{"type":"number","description":"The share of the transaction amount that is considered cost of goods sold in percent."},"cac":{"type":"number","description":"The share of the transaction amount that is considered customer acquisition cost in percent."},"pd":{"type":"number","description":"The share of the transaction amount that is considered product development in percent."},"ga":{"type":"number","description":"The share of the transaction amount that is considered general and administrative in percent."},"no":{"type":"number","description":"The share of the transaction amount that is considered non-operating expenses in percent."},"neutral":{"type":"number","description":"The share of the transaction amount that is considered neutral in percent."}},"additionalProperties":false,"description":"The default split of the transaction amount into different Profit & Loss (P&L) types. The sum of the percentages needs to be 100%."},"passThroughTax":{"type":"number","description":"The pass-through tax (e.g. VAT) that comes on top of the amount covered by the P&L split."}},"required":["categoryId","usingDateRule","plSplit","passThroughTax"],"additionalProperties":false,"description":"Categorization template applied to every wallet payment line under this cost center. Null means skipped. `passThroughTax` and `usingDateRule` are placeholders for Finway — real tax / dates come from the Antrag line."},"label":{"type":"string","description":"Human-readable Kostenstelle label as last seen in Finway (e.g. 'Materialkosten/ Produktion'). Refreshed on every Antrag upload."},"mappedTime":{"type":"string","format":"date-time","description":"ISO datetime the mapping was created."},"mappedByUserId":{"type":"string","description":"Firebase UID that created the mapping."}},"required":["template","label","mappedTime","mappedByUserId"]},"default":{},"description":"Map keyed by Finway CostCenter1ID (e.g. '30') to the chosen SaaSFlow category. Always present in Antrag exports, stable across Finway tenants — preferred over Sachkonto string keying."},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","lastWalletUploadTime","lastAntragUploadTime","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["pleo"],"description":"The type of integration."},"lastExportUploadTime":{"type":"string","nullable":true,"format":"date-time","description":"ISO datetime of the last successful Pleo export upload. Null if never."},"lastReimbursementsUploadTime":{"type":"string","nullable":true,"format":"date-time","default":null,"description":"ISO datetime of the last successful Pleo reimbursements (Rückerstattungen) upload. Null if never."},"plMappingField":{"type":"object","nullable":true,"properties":{"keyColumn":{"type":"string","description":"CSV column header whose value uniquely identifies the categorization bucket (e.g. 'Chart of Accounts - Code')."},"labelColumn":{"type":"string","nullable":true,"description":"Optional CSV column header used as the human-readable label for picker rows. Null falls back to using the keyColumn value as both key and label."}},"required":["keyColumn","labelColumn"],"description":"CSV column pair used to derive the categorization key + label. Null until the first upload completes the column-picker step."},"mappingValueMap":{"type":"object","additionalProperties":{"type":"object","properties":{"template":{"type":"object","nullable":true,"properties":{"categoryId":{"type":"string","description":"The default category to assign to transactions from this counterparty."},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"The default date rule to apply to transactions from this counterparty."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number","description":"The share of the transaction amount that is considered revenue in percent."},"cogs":{"type":"number","description":"The share of the transaction amount that is considered cost of goods sold in percent."},"cac":{"type":"number","description":"The share of the transaction amount that is considered customer acquisition cost in percent."},"pd":{"type":"number","description":"The share of the transaction amount that is considered product development in percent."},"ga":{"type":"number","description":"The share of the transaction amount that is considered general and administrative in percent."},"no":{"type":"number","description":"The share of the transaction amount that is considered non-operating expenses in percent."},"neutral":{"type":"number","description":"The share of the transaction amount that is considered neutral in percent."}},"additionalProperties":false,"description":"The default split of the transaction amount into different Profit & Loss (P&L) types. The sum of the percentages needs to be 100%."},"passThroughTax":{"type":"number","description":"The pass-through tax (e.g. VAT) that comes on top of the amount covered by the P&L split."}},"required":["categoryId","usingDateRule","plSplit","passThroughTax"],"additionalProperties":false,"description":"Categorization template applied to every Pleo wallet row whose mapping field equals this entry key. Null means skipped. `passThroughTax` and `usingDateRule` are placeholders — real values come from the CSV row at apply time."},"label":{"type":"string","description":"Human-readable label for the mapping value (typically the matching \"Name\" column, e.g. \"266 Marketing Magazine FR\" when the key is \"266\"). Refreshed on every Pleo upload."},"mappedTime":{"type":"string","format":"date-time","description":"ISO datetime the mapping was created."},"mappedByUserId":{"type":"string","description":"Firebase UID that created the mapping."}},"required":["template","label","mappedTime","mappedByUserId"]},"default":{},"description":"Map keyed by the chosen CSV column's value (e.g. '266') to the user-picked SaaSFlow category template. Re-used on every subsequent upload — only new mapping values are surfaced to the picker."},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","lastExportUploadTime","plMappingField","id"],"additionalProperties":false},{"type":"object","properties":{"name":{"type":"string","description":"The name of the integration (usually the company name from the provider)."},"externalAccountId":{"type":"string","description":"The external account ID for the integration (usually the account ID from the provider)."},"status":{"type":"string","enum":["active","error"],"default":"active","description":"The current status of the integration."},"initialSetupComplete":{"type":"boolean","default":true,"description":"Whether the initial setup (full sync + first data refresh) has completed. False during initial setup, true once ready."},"createdTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was created."},"createdUserId":{"type":"string","nullable":true,"description":"The ID of the user who created the entity. Null if the entity was created by the system."},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time","description":"When the entity was last updated."},"lastUpdatedUserId":{"type":"string","nullable":true,"description":"The ID of the user who last updated the entity. Null if the entity was updated by the system."},"type":{"type":"string","enum":["salesforce"],"description":"The type of integration."},"salesforceOrgId":{"type":"string","description":"The Salesforce org ID (15- or 18-char, starts with 00D)."},"salesforceInstanceUrl":{"type":"string","description":"The per-org Salesforce REST API host returned by OAuth (e.g. https://acme.my.salesforce.com). Required for every API call to this org."},"id":{"type":"string"}},"required":["name","externalAccountId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","type","salesforceOrgId","salesforceInstanceUrl","id"],"additionalProperties":false}]}}}},"404":{"description":"Integration not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"delete":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"integrationId","in":"path"},{"schema":{"type":"string","enum":["true","false"],"default":"true"},"required":false,"name":"convertToManual","in":"query"}],"responses":{"200":{"description":"Integration deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}}},"/companies/{companyId}/comments":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"transactionId","in":"query"}],"responses":{"200":{"description":"List of comments","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"transactionId":{"type":"string","format":"uuid"},"text":{"type":"string","description":"The content of the comment."},"taggedUserIds":{"type":"array","items":{"type":"string"},"description":"User IDs mentioned in the comment."},"likedUserIds":{"type":"array","items":{"type":"string"},"description":"User IDs that liked the comment."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","transactionId","text","taggedUserIds","likedUserIds","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}}}}},"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"transactionId":{"type":"string","minLength":1},"text":{"type":"string","minLength":1},"taggedUserIds":{"type":"array","items":{"type":"string"}}},"required":["transactionId","text"]}}}},"responses":{"201":{"description":"Created comment","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"transactionId":{"type":"string","format":"uuid"},"text":{"type":"string","description":"The content of the comment."},"taggedUserIds":{"type":"array","items":{"type":"string"},"description":"User IDs mentioned in the comment."},"likedUserIds":{"type":"array","items":{"type":"string"},"description":"User IDs that liked the comment."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","transactionId","text","taggedUserIds","likedUserIds","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}}}}},"/companies/{companyId}/comments/{commentId}":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"commentId","in":"path"}],"responses":{"200":{"description":"Comment details","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"transactionId":{"type":"string","format":"uuid"},"text":{"type":"string","description":"The content of the comment."},"taggedUserIds":{"type":"array","items":{"type":"string"},"description":"User IDs mentioned in the comment."},"likedUserIds":{"type":"array","items":{"type":"string"},"description":"User IDs that liked the comment."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","transactionId","text","taggedUserIds","likedUserIds","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Comment not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"commentId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":1},"taggedUserIds":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"Updated comment","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"transactionId":{"type":"string","format":"uuid"},"text":{"type":"string","description":"The content of the comment."},"taggedUserIds":{"type":"array","items":{"type":"string"},"description":"User IDs mentioned in the comment."},"likedUserIds":{"type":"array","items":{"type":"string"},"description":"User IDs that liked the comment."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","transactionId","text","taggedUserIds","likedUserIds","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Comment not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"delete":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"commentId","in":"path"}],"responses":{"200":{"description":"Comment deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}}},"/companies/{companyId}/comments/{commentId}/like":{"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"commentId","in":"path"}],"responses":{"200":{"description":"Comment liked","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}}},"/companies/{companyId}/comments/{commentId}/unlike":{"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"commentId","in":"path"}],"responses":{"200":{"description":"Comment unliked","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}}},"/companies/{companyId}/notifications":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"recipientUserId","in":"query"},{"schema":{"type":"string","description":"Comma-separated notification types to return, e.g. \"bankConnectionError,subscriptionChange\". Omit to return all types."},"required":false,"description":"Comma-separated notification types to return, e.g. \"bankConnectionError,subscriptionChange\". Omit to return all types.","name":"types","in":"query"},{"schema":{"type":"string","description":"For subscriptionChange notifications, return only this MRR event type: new, upgrade, downgrade, cancel, or reactivate."},"required":false,"description":"For subscriptionChange notifications, return only this MRR event type: new, upgrade, downgrade, cancel, or reactivate.","name":"eventType","in":"query"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Return notifications created on or after this date (YYYY-MM-DD)."},"required":false,"description":"Return notifications created on or after this date (YYYY-MM-DD).","name":"createdAfter","in":"query"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Return notifications created on or before this date (YYYY-MM-DD)."},"required":false,"description":"Return notifications created on or before this date (YYYY-MM-DD).","name":"createdBefore","in":"query"},{"schema":{"type":"string"},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"Paginated list of notifications","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"type":{"type":"string","description":"The type of notification."},"recipientUserId":{"type":"string","description":"The ID of the user who should receive this notification."},"readTime":{"type":"string","nullable":true,"format":"date-time","description":"When the notification was read. Null if unread."},"payload":{"type":"object","additionalProperties":{"nullable":true},"description":"Type-specific notification data."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","type","recipientUserId","readTime","payload","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}},"totalCount":{"type":"number"},"earliestCreatedTime":{"type":"string","nullable":true,"description":"Date of the earliest notification (YYYY-MM-DD) for this company and recipient, ignoring the active filter; null if there are none. Used to anchor a date picker."}},"required":["items","totalCount","earliestCreatedTime"]}}}}}},"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","minLength":1},"recipientUserId":{"type":"string","minLength":1},"payload":{"type":"object","additionalProperties":{"nullable":true}}},"required":["type","recipientUserId"]}}}},"responses":{"201":{"description":"Created notification","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"type":{"type":"string","description":"The type of notification."},"recipientUserId":{"type":"string","description":"The ID of the user who should receive this notification."},"readTime":{"type":"string","nullable":true,"format":"date-time","description":"When the notification was read. Null if unread."},"payload":{"type":"object","additionalProperties":{"nullable":true},"description":"Type-specific notification data."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","type","recipientUserId","readTime","payload","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"403":{"description":"Not allowed to create a notification for another user","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/notifications/batch_delete":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"notificationIds":{"type":"array","items":{"type":"string","minLength":1}}},"required":["notificationIds"]}}}},"responses":{"200":{"description":"Notifications deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}}},"/companies/{companyId}/notifications/{notificationId}/read":{"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"notificationId","in":"path"}],"responses":{"200":{"description":"Notification marked as read","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"type":{"type":"string","description":"The type of notification."},"recipientUserId":{"type":"string","description":"The ID of the user who should receive this notification."},"readTime":{"type":"string","nullable":true,"format":"date-time","description":"When the notification was read. Null if unread."},"payload":{"type":"object","additionalProperties":{"nullable":true},"description":"Type-specific notification data."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","type","recipientUserId","readTime","payload","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Notification not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/notifications/read-all":{"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"responses":{"200":{"description":"All unread notifications for the current user marked as read","content":{"application/json":{"schema":{"type":"object","properties":{"updatedCount":{"type":"number"}},"required":["updatedCount"]}}}}}}},"/companies/{companyId}/notifications/{notificationId}/unread":{"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"notificationId","in":"path"}],"responses":{"200":{"description":"Notification marked as unread","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"type":{"type":"string","description":"The type of notification."},"recipientUserId":{"type":"string","description":"The ID of the user who should receive this notification."},"readTime":{"type":"string","nullable":true,"format":"date-time","description":"When the notification was read. Null if unread."},"payload":{"type":"object","additionalProperties":{"nullable":true},"description":"Type-specific notification data."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","type","recipientUserId","readTime","payload","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Notification not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/files":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"unassignedOnly","in":"query"},{"schema":{"type":"string"},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"Paginated list of files","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"transactionIds":{"type":"array","items":{"type":"string"},"description":"The IDs of transactions this file is attached to."},"filename":{"type":"string","description":"The original filename."},"fileExtension":{"type":"string","description":"The file extension (e.g., pdf, png)."},"size":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"description":"The file size in bytes."},"storagePath":{"type":"string","description":"The storage path in cloud storage."},"parseStatus":{"type":"string","enum":["open","running","failed","succeeded"],"description":"The status of automated document parsing."},"parseData":{"type":"object","nullable":true,"properties":{"amount":{"type":"object","nullable":true,"properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"]},"date":{"type":"string","nullable":true},"type":{"type":"string","nullable":true,"enum":["invoice","creditNote","contract","receipt","other",null]}},"required":["amount","date","type"],"description":"Parsed data extracted from the document."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","transactionIds","filename","fileExtension","size","storagePath","parseStatus","parseData","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}},"totalCount":{"type":"number"}},"required":["items","totalCount"]}}}}}}},"/companies/{companyId}/files/{fileId}":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"fileId","in":"path"}],"responses":{"200":{"description":"File details","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"transactionIds":{"type":"array","items":{"type":"string"},"description":"The IDs of transactions this file is attached to."},"filename":{"type":"string","description":"The original filename."},"fileExtension":{"type":"string","description":"The file extension (e.g., pdf, png)."},"size":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"description":"The file size in bytes."},"storagePath":{"type":"string","description":"The storage path in cloud storage."},"parseStatus":{"type":"string","enum":["open","running","failed","succeeded"],"description":"The status of automated document parsing."},"parseData":{"type":"object","nullable":true,"properties":{"amount":{"type":"object","nullable":true,"properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"]},"date":{"type":"string","nullable":true},"type":{"type":"string","nullable":true,"enum":["invoice","creditNote","contract","receipt","other",null]}},"required":["amount","date","type"],"description":"Parsed data extracted from the document."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","transactionIds","filename","fileExtension","size","storagePath","parseStatus","parseData","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"File not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"fileId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"transactionIds":{"type":"array","items":{"type":"string"}},"filename":{"type":"string"},"parseData":{"type":"object","nullable":true,"properties":{"amount":{"type":"object","nullable":true,"properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"]},"type":{"type":"string","nullable":true},"date":{"type":"string","nullable":true}}}}}}}},"responses":{"200":{"description":"Updated file","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"transactionIds":{"type":"array","items":{"type":"string"},"description":"The IDs of transactions this file is attached to."},"filename":{"type":"string","description":"The original filename."},"fileExtension":{"type":"string","description":"The file extension (e.g., pdf, png)."},"size":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"description":"The file size in bytes."},"storagePath":{"type":"string","description":"The storage path in cloud storage."},"parseStatus":{"type":"string","enum":["open","running","failed","succeeded"],"description":"The status of automated document parsing."},"parseData":{"type":"object","nullable":true,"properties":{"amount":{"type":"object","nullable":true,"properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"]},"date":{"type":"string","nullable":true},"type":{"type":"string","nullable":true,"enum":["invoice","creditNote","contract","receipt","other",null]}},"required":["amount","date","type"],"description":"Parsed data extracted from the document."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","transactionIds","filename","fileExtension","size","storagePath","parseStatus","parseData","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"File not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"delete":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"fileId","in":"path"}],"responses":{"200":{"description":"File deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}}},"/companies/{companyId}/files/batch_delete":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"selection":{"oneOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["ids"]},"ids":{"type":"array","items":{"type":"string","minLength":1},"minItems":1,"maxItems":10000,"description":"Explicit list of entity IDs to act on."}},"required":["mode","ids"]},{"type":"object","properties":{"mode":{"type":"string","enum":["filter"]},"filter":{"type":"object","properties":{"unassignedOnly":{"type":"boolean"}},"description":"Filter spec matching the list endpoint; resolves to all matching rows."},"excludedIds":{"type":"array","items":{"type":"string","minLength":1},"maxItems":10000,"default":[],"description":"IDs to exclude from the resolved filter result."}},"required":["mode","filter"]}]}},"required":["selection"]}}}},"responses":{"200":{"description":"Files deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"affected":{"type":"integer","minimum":0}},"required":["success","affected"]}}}},"413":{"description":"Selection exceeds bulk cap","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["bulk_too_many"]},"count":{"type":"integer","minimum":0},"max":{"type":"integer","minimum":0}},"required":["error","count","max"]}}}}}}},"/companies/{companyId}/files/upload":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"fileBase64":{"type":"string"},"fileName":{"type":"string","minLength":1},"size":{"type":"number","maximum":10485760},"contentType":{"type":"string"},"transactionIds":{"type":"array","items":{"type":"string"}}},"required":["fileBase64","fileName","size","contentType"]}}}},"responses":{"201":{"description":"File uploaded","content":{"application/json":{"schema":{"type":"object","properties":{"fileId":{"type":"string"}},"required":["fileId"]}}}}}}},"/companies/{companyId}/files/{fileId}/download":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"fileId","in":"path"}],"responses":{"200":{"description":"Signed download URL (15 min expiry)","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"]}}}},"404":{"description":"File not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/background_tasks":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"responses":{"200":{"description":"List of background tasks","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["resolveTransfers","autoCategorizeTransactions","finapiRefreshAccountTransactions","plaidRefreshAccountTransactions","stripeRefreshAccountTransactions","stripeRefreshSubscriptions","stripeFullSync","stripeDeltaSync","hubspotRefreshSubscriptions","resolveHubSpotCategorizations"],"description":"The type of background task."},"status":{"type":"string","enum":["open","running","failed","succeeded"],"description":"The current status of the task."},"createdTime":{"type":"string","format":"date-time"},"finishedTime":{"type":"string","nullable":true,"format":"date-time"},"error":{"type":"string","nullable":true,"description":"Error message if the task failed."},"errorDetails":{"type":"string","nullable":true,"description":"Detailed error information if the task failed."},"accountId":{"type":"string","nullable":true},"integrationId":{"type":"string","nullable":true},"visible":{"type":"boolean"},"data":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"nullable":true},{"type":"object","additionalProperties":{"nullable":true}},{"type":"array","items":{"nullable":true}}],"description":"Type-specific payload (e.g. newTransactionCount, processedCount, totalCount)."}},"required":["id","companyId","type","status","createdTime","finishedTime","error","errorDetails","accountId","integrationId","visible","data"]}}}}}}}},"/companies/{companyId}/background_tasks/{id}":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Background task","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["resolveTransfers","autoCategorizeTransactions","finapiRefreshAccountTransactions","plaidRefreshAccountTransactions","stripeRefreshAccountTransactions","stripeRefreshSubscriptions","stripeFullSync","stripeDeltaSync","hubspotRefreshSubscriptions","resolveHubSpotCategorizations"],"description":"The type of background task."},"status":{"type":"string","enum":["open","running","failed","succeeded"],"description":"The current status of the task."},"createdTime":{"type":"string","format":"date-time"},"finishedTime":{"type":"string","nullable":true,"format":"date-time"},"error":{"type":"string","nullable":true,"description":"Error message if the task failed."},"errorDetails":{"type":"string","nullable":true,"description":"Detailed error information if the task failed."},"accountId":{"type":"string","nullable":true},"integrationId":{"type":"string","nullable":true},"visible":{"type":"boolean"},"data":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"nullable":true},{"type":"object","additionalProperties":{"nullable":true}},{"type":"array","items":{"nullable":true}}],"description":"Type-specific payload (e.g. newTransactionCount, processedCount, totalCount)."}},"required":["id","companyId","type","status","createdTime","finishedTime","error","errorDetails","accountId","integrationId","visible","data"]}}}},"404":{"description":"Background task not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/agent_definitions":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"responses":{"200":{"description":"Agent definitions that can be run.","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"}},"required":["id","title","description"]}}}}}}}},"/companies/{companyId}/agent_runs":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"responses":{"200":{"description":"List of agent runs","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"definitionId":{"type":"string","description":"The agent definition (registry key) this run instantiates."},"status":{"type":"string","enum":["open","running","needs_input","failed","succeeded"],"description":"The current lifecycle status of the run."},"triggeredByUserId":{"type":"string","nullable":true,"format":"uuid"},"suppressNotification":{"type":"boolean"},"createdTime":{"type":"string","format":"date-time"},"finishedTime":{"type":"string","nullable":true,"format":"date-time"},"error":{"type":"string","nullable":true,"description":"Error message if the run failed."},"errorDetails":{"type":"string","nullable":true,"description":"Detailed error information if the run failed."},"sessionId":{"type":"string","nullable":true,"description":"The agent SDK session id — the handle to resume this run."},"cloudRunExecutionId":{"type":"string","nullable":true},"lastHeartbeatTime":{"type":"string","nullable":true,"format":"date-time"},"costUsd":{"type":"string","nullable":true,"description":"Accumulated model spend for the run, in USD."},"data":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"nullable":true},{"type":"object","additionalProperties":{"nullable":true}},{"type":"array","items":{"nullable":true}}],"description":"Kickoff input plus the throttled progress projection (summary, last tool, counters)."}},"required":["id","companyId","definitionId","status","triggeredByUserId","suppressNotification","createdTime","finishedTime","error","errorDetails","sessionId","cloudRunExecutionId","lastHeartbeatTime","costUsd","data"]}}}}}}},"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"definitionId":{"type":"string","minLength":1},"input":{"type":"object","additionalProperties":{"nullable":true}},"suppressNotification":{"type":"boolean"}},"required":["definitionId"]}}}},"responses":{"201":{"description":"Agent run started","content":{"application/json":{"schema":{"type":"object","properties":{"runId":{"type":"string"}},"required":["runId"]}}}},"400":{"description":"Unknown agent definition","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Caller lacks a permission the agent requires","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"A run is already in progress for this company","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"429":{"description":"Per-company run rate limit reached","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"retryAt":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/agent_runs/{id}":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Agent run","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"definitionId":{"type":"string","description":"The agent definition (registry key) this run instantiates."},"status":{"type":"string","enum":["open","running","needs_input","failed","succeeded"],"description":"The current lifecycle status of the run."},"triggeredByUserId":{"type":"string","nullable":true,"format":"uuid"},"suppressNotification":{"type":"boolean"},"createdTime":{"type":"string","format":"date-time"},"finishedTime":{"type":"string","nullable":true,"format":"date-time"},"error":{"type":"string","nullable":true,"description":"Error message if the run failed."},"errorDetails":{"type":"string","nullable":true,"description":"Detailed error information if the run failed."},"sessionId":{"type":"string","nullable":true,"description":"The agent SDK session id — the handle to resume this run."},"cloudRunExecutionId":{"type":"string","nullable":true},"lastHeartbeatTime":{"type":"string","nullable":true,"format":"date-time"},"costUsd":{"type":"string","nullable":true,"description":"Accumulated model spend for the run, in USD."},"data":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"nullable":true},{"type":"object","additionalProperties":{"nullable":true}},{"type":"array","items":{"nullable":true}}],"description":"Kickoff input plus the throttled progress projection (summary, last tool, counters)."}},"required":["id","companyId","definitionId","status","triggeredByUserId","suppressNotification","createdTime","finishedTime","error","errorDetails","sessionId","cloudRunExecutionId","lastHeartbeatTime","costUsd","data"]}}}},"404":{"description":"Agent run not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/categorization_suggestions/apply":{"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"suggestions":{"type":"array","items":{"type":"object","properties":{"rule":{"type":"string"},"categoryId":{"type":"string"},"categorySystemKey":{"type":"string","nullable":true},"counterparty":{"anyOf":[{"nullable":true},{"type":"object","properties":{"type":{"type":"string","enum":["vendor","customer"]},"id":{"type":"string"}},"required":["type","id"]},{"type":"object","properties":{"type":{"type":"string","enum":["vendor","customer"]},"ref":{"type":"string"}},"required":["type","ref"]},{"type":"object","properties":{"type":{"type":"string","enum":["vendor","customer"]},"tempId":{"type":"string"}},"required":["type","tempId"]}],"default":null},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"Rules for determining the effective/accrual date range of a transaction (excluding custom)."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number"},"cogs":{"type":"number"},"cac":{"type":"number"},"pd":{"type":"number"},"ga":{"type":"number"},"no":{"type":"number"},"neutral":{"type":"number"}}},"passThroughTax":{"type":"number","default":0},"templateSource":{"type":"string"},"confidence":{"type":"string","enum":["high","medium"]},"rationale":{"type":"string"},"totalsByCurrency":{"type":"object","additionalProperties":{"type":"number"}},"transactionIds":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["categoryId","usingDateRule","plSplit","transactionIds"]}},"vendorsToCreate":{"type":"array","items":{"type":"object","properties":{"tempId":{"type":"string"},"name":{"type":"string"},"domains":{"type":"array","items":{"type":"string"},"default":[]},"defaultCategorization":{"type":"object","properties":{"categoryId":{"type":"string"},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"Rules for determining the effective/accrual date range of a transaction (excluding custom)."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number"},"cogs":{"type":"number"},"cac":{"type":"number"},"pd":{"type":"number"},"ga":{"type":"number"},"no":{"type":"number"},"neutral":{"type":"number"}}},"passThroughTax":{"type":"number"}},"required":["categoryId","usingDateRule","plSplit","passThroughTax"]},"confidence":{"type":"string","enum":["high","medium"]},"rationale":{"type":"string"}},"required":["tempId","name","defaultCategorization"]},"default":[]},"customersToCreate":{"type":"array","items":{"type":"object","properties":{"tempId":{"type":"string"},"name":{"type":"string"},"domains":{"type":"array","items":{"type":"string"},"default":[]},"defaultCategorization":{"type":"object","properties":{"categoryId":{"type":"string"},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"Rules for determining the effective/accrual date range of a transaction (excluding custom)."},"plSplit":{"type":"object","properties":{"revenue":{"type":"number"},"cogs":{"type":"number"},"cac":{"type":"number"},"pd":{"type":"number"},"ga":{"type":"number"},"no":{"type":"number"},"neutral":{"type":"number"}}},"passThroughTax":{"type":"number"}},"required":["categoryId","usingDateRule","plSplit","passThroughTax"]},"confidence":{"type":"string","enum":["high","medium"]},"rationale":{"type":"string"}},"required":["tempId","name","defaultCategorization"]},"default":[]}},"required":["suggestions"]}}}},"responses":{"200":{"description":"Suggestions applied","content":{"application/json":{"schema":{"type":"object","properties":{"appliedSuggestions":{"type":"number"},"appliedTransactions":{"type":"number"},"skippedTransactions":{"type":"number"},"createdVendors":{"type":"array","items":{"type":"object","properties":{"tempId":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"}},"required":["tempId","id","name"]}},"createdCustomers":{"type":"array","items":{"type":"object","properties":{"tempId":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"}},"required":["tempId","id","name"]}}},"required":["appliedSuggestions","appliedTransactions","skippedTransactions","createdVendors","createdCustomers"]}}}},"400":{"description":"A suggestion referenced an unknown new counterparty","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"403":{"description":"Caller lacks a permission required to create a counterparty","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/plan_items":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"responses":{"200":{"description":"List of plan items","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"month":{"type":"string","description":"The month this plan item applies to (YYYY-MM format)."},"plType":{"type":"string","enum":["revenue","cogs","cac","pd","ga","no","neutral"],"description":"The P&L type of the item."},"categoryId":{"type":"string","description":"The category ID for this plan item."},"amount":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["fixed"]},"amount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The list of supported currencies."}},"required":["value","currency"]},"relativeChange":{"type":"number"}},"required":["type","amount","relativeChange"]},{"type":"object","properties":{"type":{"type":"string","enum":["average"]},"referencePeriod":{"type":"number"},"relativeChange":{"type":"number"}},"required":["type","referencePeriod","relativeChange"]},{"type":"object","properties":{"type":{"type":"string","enum":["reference"]},"ref":{"type":"object","properties":{"plType":{"type":"string","enum":["revenue","cogs","cac","pd","ga","no","neutral"],"description":"The different Profit & Loss (P&L) types for creating a typical SaaS Profit & Loss statement."},"categoryId":{"type":"string"}},"required":["plType","categoryId"]},"share":{"type":"number"},"referenceMonth":{"type":"string","enum":["same","previous"]}},"required":["type","ref","share","referenceMonth"]}],"description":"The amount configuration (fixed, average, or reference)."},"duration":{"type":"integer","nullable":true,"minimum":-2147483648,"maximum":2147483647,"description":"Duration in months. Null for indefinite."},"frequency":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"description":"How often the item recurs."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","month","plType","categoryId","amount","duration","frequency","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}}}}},"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"month":{"type":"string","minLength":1},"plType":{"type":"string","minLength":1},"categoryId":{"type":"string","minLength":1},"amount":{"nullable":true},"duration":{"type":"integer","nullable":true},"frequency":{"type":"integer"}},"required":["month","plType","categoryId","frequency"]}}}},"responses":{"201":{"description":"Created plan item","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"month":{"type":"string","description":"The month this plan item applies to (YYYY-MM format)."},"plType":{"type":"string","enum":["revenue","cogs","cac","pd","ga","no","neutral"],"description":"The P&L type of the item."},"categoryId":{"type":"string","description":"The category ID for this plan item."},"amount":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["fixed"]},"amount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The list of supported currencies."}},"required":["value","currency"]},"relativeChange":{"type":"number"}},"required":["type","amount","relativeChange"]},{"type":"object","properties":{"type":{"type":"string","enum":["average"]},"referencePeriod":{"type":"number"},"relativeChange":{"type":"number"}},"required":["type","referencePeriod","relativeChange"]},{"type":"object","properties":{"type":{"type":"string","enum":["reference"]},"ref":{"type":"object","properties":{"plType":{"type":"string","enum":["revenue","cogs","cac","pd","ga","no","neutral"],"description":"The different Profit & Loss (P&L) types for creating a typical SaaS Profit & Loss statement."},"categoryId":{"type":"string"}},"required":["plType","categoryId"]},"share":{"type":"number"},"referenceMonth":{"type":"string","enum":["same","previous"]}},"required":["type","ref","share","referenceMonth"]}],"description":"The amount configuration (fixed, average, or reference)."},"duration":{"type":"integer","nullable":true,"minimum":-2147483648,"maximum":2147483647,"description":"Duration in months. Null for indefinite."},"frequency":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"description":"How often the item recurs."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","month","plType","categoryId","amount","duration","frequency","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}}}}},"/companies/{companyId}/plan_items/{planItemId}":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"planItemId","in":"path"}],"responses":{"200":{"description":"Plan item details","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"month":{"type":"string","description":"The month this plan item applies to (YYYY-MM format)."},"plType":{"type":"string","enum":["revenue","cogs","cac","pd","ga","no","neutral"],"description":"The P&L type of the item."},"categoryId":{"type":"string","description":"The category ID for this plan item."},"amount":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["fixed"]},"amount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The list of supported currencies."}},"required":["value","currency"]},"relativeChange":{"type":"number"}},"required":["type","amount","relativeChange"]},{"type":"object","properties":{"type":{"type":"string","enum":["average"]},"referencePeriod":{"type":"number"},"relativeChange":{"type":"number"}},"required":["type","referencePeriod","relativeChange"]},{"type":"object","properties":{"type":{"type":"string","enum":["reference"]},"ref":{"type":"object","properties":{"plType":{"type":"string","enum":["revenue","cogs","cac","pd","ga","no","neutral"],"description":"The different Profit & Loss (P&L) types for creating a typical SaaS Profit & Loss statement."},"categoryId":{"type":"string"}},"required":["plType","categoryId"]},"share":{"type":"number"},"referenceMonth":{"type":"string","enum":["same","previous"]}},"required":["type","ref","share","referenceMonth"]}],"description":"The amount configuration (fixed, average, or reference)."},"duration":{"type":"integer","nullable":true,"minimum":-2147483648,"maximum":2147483647,"description":"Duration in months. Null for indefinite."},"frequency":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"description":"How often the item recurs."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","month","plType","categoryId","amount","duration","frequency","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Plan item not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"planItemId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"month":{"type":"string","minLength":1},"plType":{"type":"string","minLength":1},"categoryId":{"type":"string","minLength":1},"amount":{"nullable":true},"duration":{"type":"integer","nullable":true},"frequency":{"type":"integer"}}}}}},"responses":{"200":{"description":"Updated plan item","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"month":{"type":"string","description":"The month this plan item applies to (YYYY-MM format)."},"plType":{"type":"string","enum":["revenue","cogs","cac","pd","ga","no","neutral"],"description":"The P&L type of the item."},"categoryId":{"type":"string","description":"The category ID for this plan item."},"amount":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["fixed"]},"amount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The list of supported currencies."}},"required":["value","currency"]},"relativeChange":{"type":"number"}},"required":["type","amount","relativeChange"]},{"type":"object","properties":{"type":{"type":"string","enum":["average"]},"referencePeriod":{"type":"number"},"relativeChange":{"type":"number"}},"required":["type","referencePeriod","relativeChange"]},{"type":"object","properties":{"type":{"type":"string","enum":["reference"]},"ref":{"type":"object","properties":{"plType":{"type":"string","enum":["revenue","cogs","cac","pd","ga","no","neutral"],"description":"The different Profit & Loss (P&L) types for creating a typical SaaS Profit & Loss statement."},"categoryId":{"type":"string"}},"required":["plType","categoryId"]},"share":{"type":"number"},"referenceMonth":{"type":"string","enum":["same","previous"]}},"required":["type","ref","share","referenceMonth"]}],"description":"The amount configuration (fixed, average, or reference)."},"duration":{"type":"integer","nullable":true,"minimum":-2147483648,"maximum":2147483647,"description":"Duration in months. Null for indefinite."},"frequency":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"description":"How often the item recurs."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","month","plType","categoryId","amount","duration","frequency","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Plan item not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"delete":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"planItemId","in":"path"}],"responses":{"200":{"description":"Plan item deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}}},"/companies/{companyId}/products":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"responses":{"200":{"description":"List of products with CMRR and usage data","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the product."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"externalIds":{"type":"array","items":{"type":"string"},"description":"External IDs (URNs) linked to this product (e.g., Stripe, HubSpot)."},"eventCount":{"type":"number"},"cmrrByCurrency":{"type":"object","additionalProperties":{"type":"number"}}},"required":["id","companyId","name","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","externalIds","eventCount","cmrrByCurrency"]}}}}}}},"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1}},"required":["name"]}}}},"responses":{"201":{"description":"Created product","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the product."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"externalIds":{"type":"array","items":{"type":"string"},"description":"External IDs (URNs) linked to this product (e.g., Stripe, HubSpot)."}},"required":["id","companyId","name","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","externalIds"]}}}}}}},"/companies/{companyId}/products/{productId}":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"productId","in":"path"}],"responses":{"200":{"description":"Product details","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the product."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"externalIds":{"type":"array","items":{"type":"string"},"description":"External IDs (URNs) linked to this product (e.g., Stripe, HubSpot)."}},"required":["id","companyId","name","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","externalIds"]}}}},"404":{"description":"Product not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"productId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1}}}}}},"responses":{"200":{"description":"Updated product","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"name":{"type":"string","description":"The name of the product."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true},"externalIds":{"type":"array","items":{"type":"string"},"description":"External IDs (URNs) linked to this product (e.g., Stripe, HubSpot)."}},"required":["id","companyId","name","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId","externalIds"]}}}},"404":{"description":"Product not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"delete":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"productId","in":"path"}],"responses":{"200":{"description":"Product deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}}},"/companies/{companyId}/products/{productId}/external-ids":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"productId","in":"path"}],"responses":{"200":{"description":"External IDs for the product","content":{"application/json":{"schema":{"type":"object","properties":{"externalIds":{"type":"array","items":{"type":"string"}}},"required":["externalIds"]}}}}}},"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"productId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"externalIds":{"type":"array","items":{"type":"string"}}},"required":["externalIds"]}}}},"responses":{"200":{"description":"Updated external IDs","content":{"application/json":{"schema":{"type":"object","properties":{"externalIds":{"type":"array","items":{"type":"string"}}},"required":["externalIds"]}}}},"409":{"description":"One or more externalIds already in use by another product","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/subscriptions":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"customerId","in":"query"}],"responses":{"200":{"description":"List of subscriptions","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","description":"The ID of the customer this subscription belongs to."},"externalId":{"type":"string","nullable":true,"description":"External subscription ID (e.g., Stripe subscription ID)."},"name":{"type":"string","nullable":true,"description":"The name of the subscription."},"currency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The currency of the subscription."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","customerId","externalId","name","currency","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}}}}},"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"name":{"type":"string","nullable":true},"currency":{"type":"string","minLength":1},"externalId":{"type":"string","nullable":true}},"required":["customerId","currency"]}}}},"responses":{"201":{"description":"Created subscription","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","description":"The ID of the customer this subscription belongs to."},"externalId":{"type":"string","nullable":true,"description":"External subscription ID (e.g., Stripe subscription ID)."},"name":{"type":"string","nullable":true,"description":"The name of the subscription."},"currency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The currency of the subscription."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","customerId","externalId","name","currency","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"409":{"description":"externalId already in use","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/subscriptions/{subscriptionId}":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"subscriptionId","in":"path"}],"responses":{"200":{"description":"Subscription details","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","description":"The ID of the customer this subscription belongs to."},"externalId":{"type":"string","nullable":true,"description":"External subscription ID (e.g., Stripe subscription ID)."},"name":{"type":"string","nullable":true,"description":"The name of the subscription."},"currency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The currency of the subscription."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","customerId","externalId","name","currency","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Subscription not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"subscriptionId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","nullable":true},"currency":{"type":"string","minLength":1}}}}}},"responses":{"200":{"description":"Updated subscription","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","description":"The ID of the customer this subscription belongs to."},"externalId":{"type":"string","nullable":true,"description":"External subscription ID (e.g., Stripe subscription ID)."},"name":{"type":"string","nullable":true,"description":"The name of the subscription."},"currency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The currency of the subscription."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","customerId","externalId","name","currency","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Subscription not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"delete":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"subscriptionId","in":"path"}],"responses":{"200":{"description":"Subscription deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"400":{"description":"Cannot delete externally managed subscription","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/subscription_events":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"subscriptionId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"customerId","in":"query"}],"responses":{"200":{"description":"List of subscription events","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"subscriptionId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid"},"committedTime":{"type":"string","format":"date-time","description":"When the subscription change was committed."},"effectiveTime":{"type":"string","format":"date-time","description":"When the subscription change takes effect."},"mrrChange":{"type":"string","description":"The change in monthly recurring revenue."},"quantityChange":{"type":"number","minimum":-8388608,"maximum":8388607,"description":"The change in quantity (non-monetary)."},"billingInterval":{"type":"string","enum":["day","week","month","year"],"description":"The billing interval (day, week, month, year)."},"billingIntervalCount":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"description":"The number of billing intervals per cycle."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","subscriptionId","productId","committedTime","effectiveTime","mrrChange","quantityChange","billingInterval","billingIntervalCount","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}}}}},"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"subscriptionId":{"type":"string","minLength":1},"productId":{"type":"string","minLength":1},"committedTime":{"type":"string","minLength":1},"effectiveTime":{"type":"string","minLength":1},"mrrChange":{"type":"string"},"quantityChange":{"type":"number"},"billingInterval":{"type":"string","minLength":1},"billingIntervalCount":{"type":"integer"}},"required":["subscriptionId","productId","committedTime","effectiveTime","mrrChange","quantityChange","billingInterval","billingIntervalCount"]}}}},"responses":{"201":{"description":"Created subscription event","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"subscriptionId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid"},"committedTime":{"type":"string","format":"date-time","description":"When the subscription change was committed."},"effectiveTime":{"type":"string","format":"date-time","description":"When the subscription change takes effect."},"mrrChange":{"type":"string","description":"The change in monthly recurring revenue."},"quantityChange":{"type":"number","minimum":-8388608,"maximum":8388607,"description":"The change in quantity (non-monetary)."},"billingInterval":{"type":"string","enum":["day","week","month","year"],"description":"The billing interval (day, week, month, year)."},"billingIntervalCount":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"description":"The number of billing intervals per cycle."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","subscriptionId","productId","committedTime","effectiveTime","mrrChange","quantityChange","billingInterval","billingIntervalCount","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Subscription not found in this company","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/subscription_events/{eventId}":{"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"eventId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"productId":{"type":"string","minLength":1},"committedTime":{"type":"string","minLength":1},"effectiveTime":{"type":"string","minLength":1},"mrrChange":{"type":"string"},"quantityChange":{"type":"number"},"billingInterval":{"type":"string","minLength":1},"billingIntervalCount":{"type":"integer"}}}}}},"responses":{"200":{"description":"Updated subscription event","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"subscriptionId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid"},"committedTime":{"type":"string","format":"date-time","description":"When the subscription change was committed."},"effectiveTime":{"type":"string","format":"date-time","description":"When the subscription change takes effect."},"mrrChange":{"type":"string","description":"The change in monthly recurring revenue."},"quantityChange":{"type":"number","minimum":-8388608,"maximum":8388607,"description":"The change in quantity (non-monetary)."},"billingInterval":{"type":"string","enum":["day","week","month","year"],"description":"The billing interval (day, week, month, year)."},"billingIntervalCount":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"description":"The number of billing intervals per cycle."},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","subscriptionId","productId","committedTime","effectiveTime","mrrChange","quantityChange","billingInterval","billingIntervalCount","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Subscription event not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"delete":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"eventId","in":"path"}],"responses":{"200":{"description":"Subscription event deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"404":{"description":"Subscription event not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/companies/{companyId}/planned_transactions":{"get":{"description":"List planned transactions for a company. Each row is a recurrence rule — to get individual dated occurrences (and to compute totals for a date range), use the `planned_transaction_occurrences` endpoint instead. Amount semantics: `amountValue` is the **net** amount excluding pass-through taxes (e.g. VAT). When `passThroughTaxAmount` is non-null, the **gross cash impact** on the bank account is `amountValue + passThroughTaxAmount`. For \"planned cash inflow / outflow\" questions, sum the gross amount; for \"planned revenue / cost net of VAT\", sum `amountValue` only.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"responses":{"200":{"description":"List of planned transactions","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"accountId":{"type":"string","nullable":true},"name":{"type":"string","description":"The name of the planned transaction."},"startDate":{"type":"string","description":"The start date of the planned transaction."},"amountValue":{"type":"string","description":"The numerical value of the planned amount."},"amountCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The currency of the planned amount."},"passThroughTaxAmount":{"type":"string","nullable":true,"description":"The pass-through tax amount (e.g., VAT)."},"categoryId":{"type":"string","nullable":true},"counterparty":{"type":"object","nullable":true,"properties":{"type":{"type":"string","enum":["customer","vendor"]},"id":{"type":"string"}},"required":["type","id"]},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"Rules for determining the effective/accrual date range of a transaction (excluding custom)."},"recurrence":{"type":"object","nullable":true,"properties":{"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number"},"lastDayOfMonth":{"type":"boolean"},"end":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"date":{"type":"string"}},"required":["type","date"]},{"type":"object","properties":{"type":{"type":"string","enum":["count"]},"count":{"type":"number"}},"required":["type","count"]},{"nullable":true}]}},"required":["frequency","interval","end"],"description":"Recurrence configuration (frequency, interval, end condition)."},"overrides":{"type":"object","additionalProperties":{"nullable":true}},"source":{"type":"string","nullable":true,"description":"The source of the planned transaction (e.g., Stripe, HubSpot)."},"externalId":{"type":"string","nullable":true},"externalSubscriptionId":{"type":"string","nullable":true},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","accountId","name","startDate","amountValue","amountCurrency","passThroughTaxAmount","categoryId","counterparty","usingDateRule","recurrence","overrides","source","externalId","externalSubscriptionId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}}}}},"post":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"startDate":{"type":"string","minLength":1},"amountValue":{"type":"string"},"amountCurrency":{"type":"string","minLength":1},"accountId":{"type":"string","nullable":true},"categoryId":{"type":"string","nullable":true},"counterparty":{"nullable":true},"usingDateRule":{"nullable":true},"recurrence":{"nullable":true},"passThroughTaxAmount":{"type":"string","nullable":true}},"required":["name","startDate","amountValue","amountCurrency"]}}}},"responses":{"201":{"description":"Created planned transaction","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"accountId":{"type":"string","nullable":true},"name":{"type":"string","description":"The name of the planned transaction."},"startDate":{"type":"string","description":"The start date of the planned transaction."},"amountValue":{"type":"string","description":"The numerical value of the planned amount."},"amountCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The currency of the planned amount."},"passThroughTaxAmount":{"type":"string","nullable":true,"description":"The pass-through tax amount (e.g., VAT)."},"categoryId":{"type":"string","nullable":true},"counterparty":{"type":"object","nullable":true,"properties":{"type":{"type":"string","enum":["customer","vendor"]},"id":{"type":"string"}},"required":["type","id"]},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"Rules for determining the effective/accrual date range of a transaction (excluding custom)."},"recurrence":{"type":"object","nullable":true,"properties":{"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number"},"lastDayOfMonth":{"type":"boolean"},"end":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"date":{"type":"string"}},"required":["type","date"]},{"type":"object","properties":{"type":{"type":"string","enum":["count"]},"count":{"type":"number"}},"required":["type","count"]},{"nullable":true}]}},"required":["frequency","interval","end"],"description":"Recurrence configuration (frequency, interval, end condition)."},"overrides":{"type":"object","additionalProperties":{"nullable":true}},"source":{"type":"string","nullable":true,"description":"The source of the planned transaction (e.g., Stripe, HubSpot)."},"externalId":{"type":"string","nullable":true},"externalSubscriptionId":{"type":"string","nullable":true},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","accountId","name","startDate","amountValue","amountCurrency","passThroughTaxAmount","categoryId","counterparty","usingDateRule","recurrence","overrides","source","externalId","externalSubscriptionId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}}}}},"/companies/{companyId}/planned_transaction_occurrences":{"get":{"description":"List individual dated occurrences of planned transactions within a date range, expanded from recurrence rules. Each item represents one expected cash event on a specific date. Amount semantics: `amount.value` is the **net** amount excluding pass-through taxes (e.g. VAT). When the underlying planned transaction has VAT, the tax portion is returned **separately** as `passThroughTaxAmount` — it is **not** included in `amount.value`. To compute the total gross cash inflow / outflow for a period (e.g. for a cash flow forecast that matches what hits the bank account), sum `amount.value + (passThroughTaxAmount?.value ?? 0)` over all items. To compute net planned revenue / cost (excluding VAT, matching P&L), sum only `amount.value`. Use pagination (`limit`, `offset`) to fetch all items — `totalCount` is the unpaginated total.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"startDate","in":"query"},{"schema":{"type":"string","minLength":1},"required":true,"name":"endDate","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":500,"default":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0,"default":0},"required":false,"name":"offset","in":"query"},{"schema":{"type":"string"},"required":false,"name":"accountIds","in":"query"},{"schema":{"type":"string"},"required":false,"name":"categoryIds","in":"query"},{"schema":{"type":"string","enum":["0","1","true","false"]},"required":false,"name":"showUncategorized","in":"query"},{"schema":{"type":"string"},"required":false,"name":"counterpartyIds","in":"query"},{"schema":{"type":"string","enum":["0","1","true","false"]},"required":false,"name":"showUnassignedCounterparty","in":"query"},{"schema":{"type":"string"},"required":false,"name":"customerId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"vendorId","in":"query"}],"responses":{"200":{"description":"Paginated list of planned transaction occurrences","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"plannedTransactionId":{"type":"string"},"date":{"type":"string"},"computedStartDate":{"type":"string"},"computedEndDate":{"type":"string"},"usingPeriodDays":{"type":"number"},"amount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"],"description":"Net amount of this occurrence, **excluding** pass-through taxes (e.g. VAT). Sign indicates direction (positive = inflow, negative = outflow). To compute the gross cash impact on the bank account, add `passThroughTaxAmount.value` when it is non-null."},"passThroughTaxAmount":{"type":"object","nullable":true,"properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"],"description":"Pass-through tax (e.g. VAT) collected or paid on top of `amount`, when applicable. Null when the planned transaction has no pass-through tax. This amount is **not** included in `amount` — add it to `amount.value` to get the gross cash flow that hits the bank account."},"accountId":{"type":"string","nullable":true},"categoryId":{"type":"string","nullable":true},"counterparty":{"type":"object","nullable":true,"properties":{"type":{"type":"string","enum":["customer","vendor"]},"id":{"type":"string"}},"required":["type","id"]},"counterpartyName":{"type":"string","nullable":true},"counterpartyLogoUrl":{"type":"string","nullable":true},"name":{"type":"string"},"startDate":{"type":"string"},"recurrence":{"nullable":true},"overrides":{"type":"object","additionalProperties":{"nullable":true}},"source":{"type":"string","nullable":true}},"required":["id","plannedTransactionId","date","computedStartDate","computedEndDate","usingPeriodDays","amount","passThroughTaxAmount","accountId","categoryId","counterparty","counterpartyName","counterpartyLogoUrl","name","startDate","overrides","source"]}},"totalCount":{"type":"number"}},"required":["items","totalCount"]}}}}}}},"/companies/{companyId}/planned_transactions/{plannedTransactionId}":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"plannedTransactionId","in":"path"}],"responses":{"200":{"description":"Planned transaction details","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"accountId":{"type":"string","nullable":true},"name":{"type":"string","description":"The name of the planned transaction."},"startDate":{"type":"string","description":"The start date of the planned transaction."},"amountValue":{"type":"string","description":"The numerical value of the planned amount."},"amountCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The currency of the planned amount."},"passThroughTaxAmount":{"type":"string","nullable":true,"description":"The pass-through tax amount (e.g., VAT)."},"categoryId":{"type":"string","nullable":true},"counterparty":{"type":"object","nullable":true,"properties":{"type":{"type":"string","enum":["customer","vendor"]},"id":{"type":"string"}},"required":["type","id"]},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"Rules for determining the effective/accrual date range of a transaction (excluding custom)."},"recurrence":{"type":"object","nullable":true,"properties":{"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number"},"lastDayOfMonth":{"type":"boolean"},"end":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"date":{"type":"string"}},"required":["type","date"]},{"type":"object","properties":{"type":{"type":"string","enum":["count"]},"count":{"type":"number"}},"required":["type","count"]},{"nullable":true}]}},"required":["frequency","interval","end"],"description":"Recurrence configuration (frequency, interval, end condition)."},"overrides":{"type":"object","additionalProperties":{"nullable":true}},"source":{"type":"string","nullable":true,"description":"The source of the planned transaction (e.g., Stripe, HubSpot)."},"externalId":{"type":"string","nullable":true},"externalSubscriptionId":{"type":"string","nullable":true},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","accountId","name","startDate","amountValue","amountCurrency","passThroughTaxAmount","categoryId","counterparty","usingDateRule","recurrence","overrides","source","externalId","externalSubscriptionId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Planned transaction not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"put":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"plannedTransactionId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"startDate":{"type":"string","minLength":1},"amountValue":{"type":"string"},"amountCurrency":{"type":"string","minLength":1},"accountId":{"type":"string","nullable":true},"categoryId":{"type":"string","nullable":true},"counterparty":{"nullable":true},"usingDateRule":{"nullable":true},"recurrence":{"nullable":true},"passThroughTaxAmount":{"type":"string","nullable":true}}}}}},"responses":{"200":{"description":"Updated planned transaction","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"accountId":{"type":"string","nullable":true},"name":{"type":"string","description":"The name of the planned transaction."},"startDate":{"type":"string","description":"The start date of the planned transaction."},"amountValue":{"type":"string","description":"The numerical value of the planned amount."},"amountCurrency":{"type":"string","enum":["EUR","AUD","BRL","CAD","CHF","CNY","CZK","DKK","GBP","HKD","HUF","IDR","ILS","INR","ISK","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PLN","RON","SEK","SGD","THB","TRY","USD","ZAR"],"description":"The currency of the planned amount."},"passThroughTaxAmount":{"type":"string","nullable":true,"description":"The pass-through tax amount (e.g., VAT)."},"categoryId":{"type":"string","nullable":true},"counterparty":{"type":"object","nullable":true,"properties":{"type":{"type":"string","enum":["customer","vendor"]},"id":{"type":"string"}},"required":["type","id"]},"usingDateRule":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["transactionDate"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["spread"]},"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number","minimum":1}},"required":["type","frequency","interval"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["calendarPeriod"]},"period":{"type":"string","enum":["month","year"]},"offset":{"type":"number"}},"required":["type","period","offset"],"additionalProperties":false}],"description":"Rules for determining the effective/accrual date range of a transaction (excluding custom)."},"recurrence":{"type":"object","nullable":true,"properties":{"frequency":{"type":"string","enum":["day","week","month","year"]},"interval":{"type":"number"},"lastDayOfMonth":{"type":"boolean"},"end":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"date":{"type":"string"}},"required":["type","date"]},{"type":"object","properties":{"type":{"type":"string","enum":["count"]},"count":{"type":"number"}},"required":["type","count"]},{"nullable":true}]}},"required":["frequency","interval","end"],"description":"Recurrence configuration (frequency, interval, end condition)."},"overrides":{"type":"object","additionalProperties":{"nullable":true}},"source":{"type":"string","nullable":true,"description":"The source of the planned transaction (e.g., Stripe, HubSpot)."},"externalId":{"type":"string","nullable":true},"externalSubscriptionId":{"type":"string","nullable":true},"createdTime":{"type":"string","nullable":true,"format":"date-time"},"createdUserId":{"type":"string","nullable":true},"lastUpdatedTime":{"type":"string","nullable":true,"format":"date-time"},"lastUpdatedUserId":{"type":"string","nullable":true}},"required":["id","companyId","accountId","name","startDate","amountValue","amountCurrency","passThroughTaxAmount","categoryId","counterparty","usingDateRule","recurrence","overrides","source","externalId","externalSubscriptionId","createdTime","createdUserId","lastUpdatedTime","lastUpdatedUserId"]}}}},"404":{"description":"Planned transaction not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"delete":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"plannedTransactionId","in":"path"}],"responses":{"200":{"description":"Planned transaction deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}}}}},"/companies/{companyId}/data/recurring-transactions":{"get":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"responses":{"200":{"description":"Recurring transaction series grouped by vendor id","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"vendorId":{"type":"string"},"amount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"]},"frequency":{"type":"string","enum":["daily","weekly","monthly","quarterly","half-yearly","yearly"]},"status":{"type":"string","enum":["active","inactive"]},"earliestItem":{"type":"object","properties":{"id":{"type":"string"},"transactionId":{"type":"string"},"categorizationId":{"type":"string"},"date":{"type":"string"},"vendorId":{"type":"string"},"amount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"]}},"required":["id","transactionId","categorizationId","date","vendorId","amount"]},"latestItem":{"type":"object","properties":{"id":{"type":"string"},"transactionId":{"type":"string"},"categorizationId":{"type":"string"},"date":{"type":"string"},"vendorId":{"type":"string"},"amount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"]}},"required":["id","transactionId","categorizationId","date","vendorId","amount"]},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"transactionId":{"type":"string"},"categorizationId":{"type":"string"},"date":{"type":"string"},"vendorId":{"type":"string"},"amount":{"type":"object","properties":{"value":{"type":"number"},"currency":{"type":"string"}},"required":["value","currency"]}},"required":["id","transactionId","categorizationId","date","vendorId","amount"]}}},"required":["id","vendorId","amount","frequency","status","earliestItem","latestItem","items"]}}}}}}}}},"/companies/{companyId}/data/batch":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"slices":{"type":"array","items":{"nullable":true}},"timeZone":{"type":"string"}},"required":["slices"]}}}},"responses":{"200":{"description":"Batch slice data","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"One or more slices have invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for one of the requested slices","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/mrrAtDate":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mrrType":{"type":"string","enum":["cmrr","mrr"],"description":"MRR variant. cmrr = committed MRR (CMRR), mrr = recognised MRR."},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}","description":"Snapshot date (YYYY-MM-DD)."},"timeZone":{"type":"string","description":"IANA time zone. Defaults to BatchContext.timeZone, then UTC."}},"required":["mrrType","date"]}}}},"responses":{"200":{"description":"mrrAtDate result","content":{"application/json":{"schema":{"type":"object","properties":{"mrr":{"type":"number"},"customerCount":{"type":"number"}},"required":["mrr","customerCount"]}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/mrrData":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mrrType":{"type":"string","enum":["cmrr","mrr"],"description":"MRR variant. cmrr = committed MRR (CMRR), mrr = recognised MRR."},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"timeZone":{"type":"string","description":"IANA time zone. Defaults to BatchContext.timeZone, then UTC."},"filterCustomerIds":{"type":"array","items":{"type":"string"}}},"required":["mrrType"]}}}},"responses":{"200":{"description":"mrrData result","content":{"application/json":{"schema":{"type":"array","items":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"object","properties":{"mrr":{"type":"number"},"customerCount":{"type":"number"}},"required":["mrr","customerCount"]}]},"minItems":2,"maxItems":2}}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/monthlyData":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mrrType":{"type":"string","enum":["cmrr","mrr"],"description":"MRR variant. cmrr = committed MRR (CMRR), mrr = recognised MRR."},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"timeZone":{"type":"string","description":"IANA time zone. Defaults to BatchContext.timeZone, then UTC."}},"required":["mrrType"]}}}},"responses":{"200":{"description":"monthlyData result","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"month":{"type":"string"},"start":{"type":"number"},"startCount":{"type":"number"},"new":{"type":"number"},"newCount":{"type":"number"},"reactivate":{"type":"number"},"reactivateCount":{"type":"number"},"upgrade":{"type":"number"},"upgradeCount":{"type":"number"},"downgrade":{"type":"number"},"downgradeCount":{"type":"number"},"cancel":{"type":"number"},"cancelCount":{"type":"number"},"currency":{"type":"number"},"currencyCount":{"type":"number"},"end":{"type":"number"},"endCount":{"type":"number"}},"required":["month","start","startCount","new","newCount","reactivate","reactivateCount","upgrade","upgradeCount","downgrade","downgradeCount","cancel","cancelCount","currency","currencyCount","end","endCount"]}}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/customerMrr":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mrrType":{"type":"string","enum":["cmrr","mrr"],"description":"MRR variant. cmrr = committed MRR (CMRR), mrr = recognised MRR."},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"limit":{"type":"integer","minimum":1},"offset":{"type":"integer","minimum":0},"timeZone":{"type":"string","description":"IANA time zone. Defaults to BatchContext.timeZone, then UTC."}},"required":["mrrType","date"]}}}},"responses":{"200":{"description":"customerMrr result","content":{"application/json":{"schema":{"type":"object","properties":{"customers":{"type":"array","items":{"type":"object","properties":{"customerId":{"type":"string"},"value":{"type":"number"},"customer":{"type":"object","nullable":true,"properties":{"name":{"type":"string"},"countryCode":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true}},"required":["name","countryCode","logoUrl"]}},"required":["customerId","value","customer"]}},"totalCount":{"type":"number"}},"required":["customers","totalCount"]}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/mrrChangeEvents":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mrrType":{"type":"string","enum":["cmrr","mrr"],"description":"MRR variant. cmrr = committed MRR (CMRR), mrr = recognised MRR."},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"limit":{"type":"integer","minimum":1},"offset":{"type":"integer","minimum":0},"timeZone":{"type":"string","description":"IANA time zone. Defaults to BatchContext.timeZone, then UTC."}},"required":["mrrType","startDate","endDate"]}}}},"responses":{"200":{"description":"mrrChangeEvents result","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"nullable":true}},"totalCount":{"type":"number"}},"required":["events","totalCount"]}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/mrrByProduct":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mrrType":{"type":"string","enum":["cmrr","mrr"],"description":"MRR variant. cmrr = committed MRR (CMRR), mrr = recognised MRR."},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}$"}},"required":["mrrType","startDate","endDate"]}}}},"responses":{"200":{"description":"mrrByProduct result","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/analytics":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"metricNames":{"type":"array","items":{"type":"string"}},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"mrrType":{"type":"string","enum":["cmrr","mrr"],"description":"MRR variant. cmrr = committed MRR (CMRR), mrr = recognised MRR."},"timeZone":{"type":"string","description":"IANA time zone. Defaults to BatchContext.timeZone, then UTC."},"smoothingMonths":{"type":"integer","minimum":1,"maximum":12,"default":1}},"required":["metricNames","startDate","endDate","mrrType"]}}}},"responses":{"200":{"description":"analytics result","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"object","properties":{"title":{"type":"string"},"subTitle":{"type":"string"},"format":{"type":"string"},"values":{"type":"object","additionalProperties":{"type":"number","nullable":true}}},"required":["title","subTitle","format","values"]}}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/revenueExpenses":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"filter":{"type":"object","properties":{"accountIds":{"type":"array","items":{"type":"string"}},"categoryIds":{"type":"array","items":{"type":"string"}}},"description":"Common filter shared by P&L slices."}},"required":["startDate","endDate"]}}}},"responses":{"200":{"description":"revenueExpenses result","content":{"application/json":{"schema":{"type":"object","properties":{"kpis":{"type":"object","properties":{"revenue":{"type":"number"},"revenuePreviousPeriod":{"type":"number"},"revenueChange":{"type":"number"},"expenses":{"type":"number"},"expensesPreviousPeriod":{"type":"number"},"expensesChange":{"type":"number"},"nonOperating":{"type":"number"},"nonOperatingPreviousPeriod":{"type":"number"},"nonOperatingChange":{"type":"number"},"uncategorized":{"type":"number"},"uncategorizedPreviousPeriod":{"type":"number"},"uncategorizedChange":{"type":"number"},"profit":{"type":"number"},"profitPreviousPeriod":{"type":"number"},"profitChange":{"type":"number"},"plainProfit":{"type":"number"},"plainProfitPreviousPeriod":{"type":"number"},"plainProfitChange":{"type":"number"}},"required":["revenue","revenuePreviousPeriod","revenueChange","expenses","expensesPreviousPeriod","expensesChange","nonOperating","nonOperatingPreviousPeriod","nonOperatingChange","uncategorized","uncategorizedPreviousPeriod","uncategorizedChange","profit","profitPreviousPeriod","profitChange","plainProfit","plainProfitPreviousPeriod","plainProfitChange"]},"monthly":{"type":"array","items":{"type":"object","properties":{"month":{"type":"string"},"revenue":{"type":"number"},"cogs":{"type":"number"},"cac":{"type":"number"},"pd":{"type":"number"},"ga":{"type":"number"},"nonOperating":{"type":"number"},"uncategorized":{"type":"number"}},"required":["month","revenue","cogs","cac","pd","ga","nonOperating","uncategorized"]}}},"required":["kpis","monthly"]}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/revenueExpensesBar":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"filter":{"type":"object","properties":{"accountIds":{"type":"array","items":{"type":"string"}},"categoryIds":{"type":"array","items":{"type":"string"}}},"description":"Common filter shared by P&L slices."}},"required":["startDate","endDate"]}}}},"responses":{"200":{"description":"revenueExpensesBar result","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"month":{"type":"string"},"revenueRecurring":{"type":"number"},"revenueOneOff":{"type":"number"},"revenueUsage":{"type":"number"},"revenueOther":{"type":"number"},"cogs":{"type":"number"},"cac":{"type":"number"},"pd":{"type":"number"},"ga":{"type":"number"}},"required":["month","revenueRecurring","revenueOneOff","revenueUsage","revenueOther","cogs","cac","pd","ga"]}}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/revenueExpensesByCategory":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"filter":{"type":"object","properties":{"accountIds":{"type":"array","items":{"type":"string"}},"categoryIds":{"type":"array","items":{"type":"string"}}},"description":"Common filter shared by P&L slices."}},"required":["startDate","endDate"]}}}},"responses":{"200":{"description":"revenueExpensesByCategory result","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"plType":{"type":"string"},"categories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"value":{"type":"number"}},"required":["id","name","value"]}}},"required":["plType","categories"]}}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/topExpenseVendors":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"filter":{"type":"object","properties":{"accountIds":{"type":"array","items":{"type":"string"}},"categoryIds":{"type":"array","items":{"type":"string"}}},"description":"Common filter shared by P&L slices."},"limit":{"type":"integer","minimum":1}},"required":["startDate","endDate"]}}}},"responses":{"200":{"description":"topExpenseVendors result","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"vendorId":{"type":"string"},"vendorName":{"type":"string"},"amount":{"type":"number"}},"required":["vendorId","vendorName","amount"]}}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/accountBalanceKpis":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"accountIds":{"type":"array","items":{"type":"string"}}},"required":["startDate","endDate"]}}}},"responses":{"200":{"description":"accountBalanceKpis result","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"number"},"totalPreviousPeriod":{"type":"number"},"totalChange":{"type":"number"}},"required":["total","totalPreviousPeriod","totalChange"]}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/accountBalanceByAccount":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"accountIds":{"type":"array","items":{"type":"string"}}},"required":["startDate","endDate"]}}}},"responses":{"200":{"description":"accountBalanceByAccount result","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"object","properties":{"accountId":{"type":"string"},"accountName":{"type":"string"},"value":{"type":"number"},"valuePreviousPeriod":{"type":"number"},"valueChange":{"type":"number"}},"required":["accountId","accountName","value","valuePreviousPeriod","valueChange"]}}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/balanceTimeSeries":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"accountIds":{"type":"array","items":{"type":"string"}}},"required":["startDate","endDate"]}}}},"responses":{"200":{"description":"balanceTimeSeries result","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"value":{"type":"number"}},"required":["date","value"]}}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/balanceByCashType":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"accountIds":{"type":"array","items":{"type":"string"}}},"required":["startDate","endDate"]}}}},"responses":{"200":{"description":"balanceByCashType result","content":{"application/json":{"schema":{"type":"object","properties":{"cash":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"value":{"type":"number"}},"required":["date","value"]}},"nonCash":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"value":{"type":"number"}},"required":["date","value"]}}},"required":["cash","nonCash"]}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/cashFlowTimeSeries":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"accountIds":{"type":"array","items":{"type":"string"}}},"required":["endDate"]}}}},"responses":{"200":{"description":"cashFlowTimeSeries result","content":{"application/json":{"schema":{"type":"object","properties":{"inflow":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"value":{"type":"number"}},"required":["date","value"]}},"outflow":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"value":{"type":"number"}},"required":["date","value"]}}},"required":["inflow","outflow"]}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/forecastCashFlowTimeSeries":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}","description":"Start of the window (YYYY-MM-DD). Defaults to the batch context start date."},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}","description":"End of the window (YYYY-MM-DD). Typically a future date so the forecast extends past today."},"accountIds":{"type":"array","items":{"type":"string"},"description":"Restrict to these account ids. Omit to include all accounts."},"asOfDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}","description":"Cutover between actual and planned cash flow (YYYY-MM-DD). Dates on or before asOfDate come from actual transactions (inflow/outflow); dates after it come from planned (forecast) occurrences (plannedInflow/plannedOutflow). Defaults to today."}},"required":["endDate"]}}}},"responses":{"200":{"description":"forecastCashFlowTimeSeries result","content":{"application/json":{"schema":{"type":"object","properties":{"inflow":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"value":{"type":"number"}},"required":["date","value"]}},"outflow":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"value":{"type":"number"}},"required":["date","value"]}},"plannedInflow":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"value":{"type":"number"}},"required":["date","value"]}},"plannedOutflow":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"value":{"type":"number"}},"required":["date","value"]}}},"required":["inflow","outflow","plannedInflow","plannedOutflow"],"description":"Daily cash inflows and outflows, split into actual (inflow/outflow, dates on or before asOfDate) and planned (plannedInflow/plannedOutflow, dates after asOfDate). Inflows are positive; outflows are negative (money leaving the accounts). Transfers between own accounts are excluded from the actual series. Sum the values per calendar month to reproduce the \"Cash inflows and outflows\" chart."}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/cashFlowByCategory":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"}},"required":["startDate","endDate"]}}}},"responses":{"200":{"description":"cashFlowByCategory result","content":{"application/json":{"schema":{"type":"object","properties":{"categories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"inflow":{"type":"object","additionalProperties":{"type":"number"}},"outflow":{"type":"object","additionalProperties":{"type":"number"}}},"required":["id","name","inflow","outflow"]}},"unassignedInflow":{"type":"object","additionalProperties":{"type":"number"}},"unassignedOutflow":{"type":"object","additionalProperties":{"type":"number"}},"currencyChangeEffect":{"type":"object","additionalProperties":{"type":"number"}}},"required":["categories","unassignedInflow","unassignedOutflow","currencyChangeEffect"]}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/profitLossData":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"}},"required":["startDate","endDate"]}}}},"responses":{"200":{"description":"profitLossData result","content":{"application/json":{"schema":{"type":"object","properties":{"plTypes":{"type":"object","additionalProperties":{"type":"object","properties":{"categories":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{"type":"number"}}}},"required":["categories"]}},"currencyChangeEffect":{"type":"object","additionalProperties":{"type":"number"}}},"required":["plTypes","currencyChangeEffect"]}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/periodDetails":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"dateDefinition":{"type":"string","enum":["distributed","cash"]},"splitBy":{"type":"string","enum":["account","counterparty"]},"filter":{"type":"object","additionalProperties":{"nullable":true}}},"required":["startDate","endDate","dateDefinition","splitBy"]}}}},"responses":{"200":{"description":"periodDetails result","content":{"application/json":{"schema":{"type":"object","properties":{"amountBySplitId":{"type":"object","additionalProperties":{"type":"number"}},"total":{"type":"number"},"namesBySplitId":{"type":"object","additionalProperties":{"type":"string"}}},"required":["amountBySplitId","total"]}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/cohorts":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mrrType":{"type":"string","enum":["cmrr","mrr"],"description":"MRR variant. cmrr = committed MRR (CMRR), mrr = recognised MRR."},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}$"}},"required":["mrrType"]}}}},"responses":{"200":{"description":"cohorts result","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/customerMonthlyData":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mrrType":{"type":"string","enum":["cmrr","mrr"],"description":"MRR variant. cmrr = committed MRR (CMRR), mrr = recognised MRR."},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"dataType":{"type":"string"},"dataTypes":{"type":"array","items":{"type":"string"}}},"required":["mrrType","startDate","endDate"]}}}},"responses":{"200":{"description":"customerMonthlyData result","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"customerId":{"type":"string"},"value":{"type":"number"},"customer":{"type":"object","nullable":true,"properties":{"name":{"type":"string"},"externalIds":{"nullable":true}},"required":["name"]}},"required":["customerId","value"]}}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/customerChanges":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mrrType":{"type":"string","enum":["cmrr","mrr"],"description":"MRR variant. cmrr = committed MRR (CMRR), mrr = recognised MRR."},"startDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"},"endDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}"}},"required":["mrrType","startDate","endDate"]}}}},"responses":{"200":{"description":"customerChanges result","content":{"application/json":{"schema":{"type":"array","items":{"nullable":true}}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/data/retentionCohortDetail":{"post":{"tags":["Data"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"month":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"horizon":{"type":"string","enum":["monthly","annual"]},"mrrType":{"type":"string","enum":["cmrr","mrr"],"description":"MRR variant. cmrr = committed MRR (CMRR), mrr = recognised MRR."},"timeZone":{"type":"string","description":"IANA time zone. Defaults to BatchContext.timeZone, then UTC."}},"required":["month","mrrType"]}}}},"responses":{"200":{"description":"retentionCohortDetail result","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"customerId":{"type":"string"},"customerName":{"type":"string","nullable":true},"mrrStart":{"type":"number"},"mrrEnd":{"type":"number"}},"required":["customerId","customerName","mrrStart","mrrEnd"]}}}}},"400":{"description":"Invalid params","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"Caller lacks permission for this slice","content":{"application/json":{"schema":{"nullable":true}}}}}}},"/companies/{companyId}/search":{"get":{"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"companyId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"q","in":"query"}],"responses":{"200":{"description":"Unified command-palette search results for the current company","content":{"application/json":{"schema":{"type":"object","properties":{"customers":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["customer"]},"id":{"type":"string"},"name":{"type":"string"},"logo":{"type":"boolean"}},"required":["type","id","name","logo"]}},"vendors":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["vendor"]},"id":{"type":"string"},"name":{"type":"string"},"logo":{"type":"boolean"}},"required":["type","id","name","logo"]}},"accounts":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["account"]},"id":{"type":"string"},"name":{"type":"string"},"accountType":{"type":"string","enum":["bank","cash","creditCard","loan","other"]}},"required":["type","id","name","accountType"]}},"transactions":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["transaction"]},"id":{"type":"string"},"fromTo":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"date":{"type":"string"},"amountValue":{"type":"number"},"amountCurrency":{"type":"string"},"accountId":{"type":"string"},"accountName":{"type":"string"}},"required":["type","id","fromTo","description","date","amountValue","amountCurrency","accountId","accountName"]}}},"required":["customers","vendors","accounts","transactions"]}}}}}}}}}