{
 "openapi": "3.1.0",
 "info": {
  "title": "Bank Accounts (Accounting)",
  "version": "20261030b",
  "description": "The accounts themselves, with the live balance the feed reports and the GL account each one posts to."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "bank-accounts": {
    "type": "object",
    "required": [
     "name",
     "bank_name",
     "account_masked"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "name": {
      "type": "string",
      "description": "Account name"
     },
     "bank_name": {
      "type": "string",
      "description": "Bank name"
     },
     "account_masked": {
      "type": "string",
      "description": "Masked number"
     },
     "currency": {
      "type": "string",
      "description": "Currency"
     },
     "gl_account_id": {
      "type": "string",
      "format": "uuid",
      "description": "Cash GL account"
     },
     "is_active": {
      "type": "boolean",
      "description": "Active"
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org unit id",
      "readOnly": true
     },
     "provider_id": {
      "type": "string",
      "format": "uuid",
      "description": "Bank",
      "readOnly": true
     },
     "connection_id": {
      "type": "string",
      "format": "uuid",
      "description": "Connection",
      "readOnly": true
     },
     "account_number_cipher": {
      "type": "string",
      "description": "Account number cipher",
      "readOnly": true
     },
     "routing_number": {
      "type": "string",
      "description": "Routing number",
      "readOnly": true
     },
     "iban": {
      "type": "string",
      "description": "IBAN",
      "readOnly": true
     },
     "swift_bic": {
      "type": "string",
      "description": "SWIFT BIC",
      "readOnly": true
     },
     "external_account_id": {
      "type": "string",
      "description": "Account id at the bank",
      "readOnly": true
     },
     "account_type": {
      "type": "string",
      "description": "Type",
      "readOnly": true
     },
     "purpose": {
      "type": "string",
      "description": "What it is for",
      "readOnly": true
     },
     "ledger_balance": {
      "type": "string",
      "format": "decimal",
      "description": "Ledger balance",
      "readOnly": true
     },
     "available_balance": {
      "type": "string",
      "format": "decimal",
      "description": "Available balance",
      "readOnly": true
     },
     "balance_as_of": {
      "type": "string",
      "format": "date-time",
      "description": "Balance as of",
      "readOnly": true
     },
     "overdraft_limit": {
      "type": "string",
      "format": "decimal",
      "description": "Overdraft limit",
      "readOnly": true
     },
     "minimum_balance": {
      "type": "string",
      "format": "decimal",
      "description": "Minimum balance",
      "readOnly": true
     },
     "sync_enabled": {
      "type": "boolean",
      "description": "Collect from the bank",
      "readOnly": true
     },
     "last_sync_at": {
      "type": "string",
      "format": "date-time",
      "description": "Last sync at",
      "readOnly": true
     },
     "last_statement_date": {
      "type": "string",
      "format": "date",
      "description": "Last statement date",
      "readOnly": true
     },
     "is_primary": {
      "type": "boolean",
      "description": "Primary account for this currency",
      "readOnly": true
     },
     "cost_center_id": {
      "type": "string",
      "format": "uuid",
      "description": "Cost center",
      "readOnly": true
     },
     "link_session_id": {
      "type": "string",
      "format": "uuid",
      "description": "Link session id",
      "readOnly": true
     },
     "ofx_bank_id": {
      "type": "string",
      "description": "Ofx bank id",
      "readOnly": true
     },
     "ofx_account_type": {
      "type": "string",
      "description": "Ofx account type",
      "readOnly": true
     },
     "country": {
      "type": "string",
      "description": "Country",
      "readOnly": true
     },
     "iban_masked": {
      "type": "string",
      "description": "Iban masked",
      "readOnly": true
     },
     "target_balance": {
      "type": "string",
      "format": "decimal",
      "description": "Target balance",
      "readOnly": true
     },
     "is_restricted": {
      "type": "boolean",
      "description": "Is restricted",
      "readOnly": true
     },
     "restriction_reason": {
      "type": "string",
      "description": "Restriction reason",
      "readOnly": true
     },
     "interest_rate_pct": {
      "type": "string",
      "format": "decimal",
      "description": "Interest rate pct",
      "readOnly": true
     },
     "value_date_offset_days": {
      "type": "integer",
      "description": "Value date offset days",
      "readOnly": true
     },
     "pool_id": {
      "type": "string",
      "format": "uuid",
      "description": "Pool id",
      "readOnly": true
     },
     "opened_date": {
      "type": "string",
      "format": "date",
      "description": "Opened date",
      "readOnly": true
     },
     "closed_date": {
      "type": "string",
      "format": "date",
      "description": "Closed date",
      "readOnly": true
     },
     "signatories": {
      "type": "string",
      "description": "Signatories",
      "readOnly": true
     },
     "notes": {
      "type": "string",
      "description": "Notes",
      "readOnly": true
     },
     "xf_text_1": {
      "type": "string",
      "description": "Xf text 1",
      "readOnly": true
     },
     "xf_text_2": {
      "type": "string",
      "description": "Xf text 2",
      "readOnly": true
     },
     "xf_text_3": {
      "type": "string",
      "description": "Xf text 3",
      "readOnly": true
     },
     "xf_text_4": {
      "type": "string",
      "description": "Xf text 4",
      "readOnly": true
     },
     "xf_text_5": {
      "type": "string",
      "description": "Xf text 5",
      "readOnly": true
     },
     "xf_num_1": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 1",
      "readOnly": true
     },
     "xf_num_2": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 2",
      "readOnly": true
     },
     "xf_num_3": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 3",
      "readOnly": true
     },
     "xf_date_1": {
      "type": "string",
      "format": "date",
      "description": "Xf date 1",
      "readOnly": true
     },
     "xf_date_2": {
      "type": "string",
      "format": "date",
      "description": "Xf date 2",
      "readOnly": true
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "readOnly": true
     },
     "created_by": {
      "type": "string",
      "format": "uuid",
      "description": "Created by",
      "readOnly": true
     },
     "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Updated at",
      "readOnly": true
     },
     "updated_by": {
      "type": "string",
      "format": "uuid",
      "description": "Updated by",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/accounting/bank-accounts": {
   "get": {
    "summary": "list bank-accounts",
    "operationId": "list_bank_accounts_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create bank-accounts",
    "operationId": "create_bank_accounts_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/bank-accounts/{id}": {
   "get": {
    "summary": "get bank-accounts",
    "operationId": "get_bank_accounts_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change bank-accounts",
    "operationId": "change_bank_accounts_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete bank-accounts",
    "operationId": "delete_bank_accounts_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/bank-accounts/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_bank_accounts_0_6",
    "description": "Body keys: overrides, preview, withLines",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/bank-accounts/{id}/account-number": {
   "put": {
    "summary": "Account number",
    "operationId": "action_bank_accounts_0_6",
    "description": "Body keys: accountNumber",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/bank-accounts/{id}/recognise": {
   "post": {
    "summary": "Recognise",
    "operationId": "action_bank_accounts_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/bank-accounts/{id}/settle-open-items": {
   "post": {
    "summary": "Settle open items",
    "operationId": "action_bank_accounts_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/bank-accounts/{id}/post-recognised": {
   "post": {
    "summary": "Post recognised",
    "operationId": "action_bank_accounts_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/bank-accounts/{id}/reconcile": {
   "post": {
    "summary": "Reconcile",
    "operationId": "action_bank_accounts_0_6",
    "description": "Body keys: periodStart*, periodEnd, statementId, statementBalance",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}