openapi: 3.0.1 info: title: Modern Treasury AccountCapability LedgerAccountBalanceMonitor API version: v1 contact: name: Modern Treasury Engineering Team url: https://moderntreasury.com description: The Modern Treasury REST API. Please see https://docs.moderntreasury.com for more details. servers: - url: http://localhost:3000 - url: https://app.moderntreasury.com tags: - name: LedgerAccountBalanceMonitor paths: /api/ledger_account_balance_monitors: get: summary: list ledger_account_balance_monitors tags: - LedgerAccountBalanceMonitor operationId: listLedgerAccountBalanceMonitors description: Get a list of ledger account balance monitors. security: - basic_auth: [] parameters: - name: after_cursor in: query schema: type: string nullable: true required: false - name: per_page in: query schema: type: integer required: false - $ref: '#/components/parameters/metadata_query' - $ref: '#/components/parameters/bulk_id' - name: ledger_account_id in: query schema: type: string description: Query the balance monitors for a single ledger account. required: false responses: '200': description: successful headers: X-After-Cursor: schema: type: string nullable: true required: false description: The cursor for the next page. Including this in a call as `after_cursor` will return the next page. X-Per-Page: schema: type: integer nullable: true description: The current `per_page`. content: application/json: schema: type: array items: $ref: '#/components/schemas/ledger_account_balance_monitor' post: summary: create ledger_account_balance_monitor tags: - LedgerAccountBalanceMonitor operationId: createLedgerAccountBalanceMonitor description: Create a ledger account balance monitor. security: - basic_auth: [] parameters: - name: Idempotency-Key in: header required: false description: This key should be something unique, preferably something like an UUID. schema: type: string responses: '201': description: successful content: application/json: schema: $ref: '#/components/schemas/ledger_account_balance_monitor' '403': description: forbidden content: application/json: schema: $ref: '#/components/schemas/error_message' '422': description: unsuccessful content: application/json: schema: $ref: '#/components/schemas/error_message' requestBody: content: application/json: schema: $ref: '#/components/schemas/ledger_account_balance_monitor_create_request' /api/ledger_account_balance_monitors/{id}: parameters: - name: id in: path schema: type: string description: id required: true get: summary: get ledger_account_balance_monitor tags: - LedgerAccountBalanceMonitor operationId: getLedgerAccountBalanceMonitor description: Get details on a single ledger account balance monitor. security: - basic_auth: [] responses: '200': description: successful content: application/json: schema: $ref: '#/components/schemas/ledger_account_balance_monitor' '404': description: not found content: application/json: schema: $ref: '#/components/schemas/error_message' patch: summary: update ledger_account_balance_monitor tags: - LedgerAccountBalanceMonitor operationId: updateLedgerAccountBalanceMonitor description: Update a ledger account balance monitor. security: - basic_auth: [] parameters: [] responses: '200': description: successful content: application/json: schema: $ref: '#/components/schemas/ledger_account_balance_monitor' '403': description: forbidden content: application/json: schema: $ref: '#/components/schemas/error_message' '404': description: not found content: application/json: schema: $ref: '#/components/schemas/error_message' '422': description: unsuccessful content: application/json: schema: $ref: '#/components/schemas/error_message' requestBody: content: application/json: schema: $ref: '#/components/schemas/ledger_account_balance_monitor_update_request' delete: summary: delete ledger_account_balance_monitor tags: - LedgerAccountBalanceMonitor operationId: deleteLedgerAccountBalanceMonitor description: Delete a ledger account balance monitor. security: - basic_auth: [] responses: '200': description: successful content: application/json: schema: $ref: '#/components/schemas/ledger_account_balance_monitor' '403': description: forbidden content: application/json: schema: $ref: '#/components/schemas/error_message' '404': description: not found content: application/json: schema: $ref: '#/components/schemas/error_message' components: schemas: alert_condition_create_request: type: object properties: field: type: string description: One of `available_balance_amount`, `pending_balance_amount`, `posted_balance_amount`, `ledger_account_lock_version`. operator: type: string description: A logical operator to compare the `field` against the `value`. One of `less_than`, `less_than_or_equals`, `equals`, `greater_than_or_equals`, `greater_than`. value: type: integer description: The monitor's `current_ledger_account_balance_state.triggered` will be `true` when comparing the `field` to this integer value using the `operator` is logically true. required: - field - operator - value current_ledger_account_balance_state: type: object properties: balances: $ref: '#/components/schemas/ledger_balances' ledger_account_lock_version: type: integer description: The current lock version of the ledger account. triggered: type: boolean description: If `true`, the ledger account's balances satisfy the `alert_condition` at this lock version. additionalProperties: false minProperties: 3 required: - balances - ledger_account_lock_version - triggered alert_condition: type: object properties: field: type: string description: One of `available_balance_amount`, `pending_balance_amount`, `posted_balance_amount`, `ledger_account_lock_version`. operator: type: string description: A logical operator to compare the `field` against the `value`. One of `less_than`, `less_than_or_equals`, `equals`, `greater_than_or_equals`, `greater_than`. value: type: integer description: The monitor's `current_ledger_account_balance_state.triggered` will be `true` when comparing the `field` to this integer value using the `operator` is logically true. additionalProperties: false minProperties: 3 required: - field - operator - value ledger_account_balance_monitor_create_request: type: object properties: ledger_account_id: type: string description: The ledger account associated with this balance monitor. description: type: string description: An optional, free-form description for internal use. alert_condition: $ref: '#/components/schemas/alert_condition_create_request' description: Describes the condition that must be satisfied for the monitor to be triggered. metadata: type: object description: Additional data represented as key-value pairs. Both the key and value must be strings. additionalProperties: type: string example: key: value foo: bar modern: treasury required: - ledger_account_id - alert_condition error_message: type: object properties: errors: type: object properties: code: type: string enum: - parameter_invalid - parameter_missing - resource_not_found - not_found - forbidden - invalid_ip - invalid_key - header_invalid - expired_key - conflict - too_many_requests message: type: string parameter: type: string required: - errors ledger_balance: type: object properties: credits: type: integer debits: type: integer amount: type: integer currency: type: string description: The currency of the ledger account. currency_exponent: type: integer description: The currency exponent of the ledger account. additionalProperties: false minProperties: 5 required: - credits - debits - amount - currency - currency_exponent ledger_account_balance_monitor_update_request: type: object properties: description: type: string description: An optional, free-form description for internal use. metadata: type: object description: Additional data represented as key-value pairs. Both the key and value must be strings. additionalProperties: type: string example: key: value foo: bar modern: treasury ledger_account_balance_monitor: type: object properties: id: type: string format: uuid object: type: string live_mode: type: boolean description: This field will be true if this object exists in the live environment or false if it exists in the test environment. created_at: type: string format: date-time updated_at: type: string format: date-time discarded_at: type: string format: date-time nullable: true ledger_account_id: type: string description: The ledger account associated with this balance monitor. description: type: string description: An optional, free-form description for internal use. nullable: true alert_condition: $ref: '#/components/schemas/alert_condition' description: Describes the condition that must be satisfied for the monitor to be triggered. current_ledger_account_balance_state: $ref: '#/components/schemas/current_ledger_account_balance_state' description: The ledger account's balances and the monitor state as of the current ledger account lock version. metadata: type: object description: Additional data represented as key-value pairs. Both the key and value must be strings. additionalProperties: type: string example: key: value foo: bar modern: treasury additionalProperties: false minProperties: 11 required: - id - object - live_mode - created_at - updated_at - discarded_at - ledger_account_id - description - alert_condition - current_ledger_account_balance_state - metadata ledger_balances: type: object properties: pending_balance: $ref: '#/components/schemas/ledger_balance' description: The pending_balance is the sum of all pending and posted entries. posted_balance: $ref: '#/components/schemas/ledger_balance' description: The posted_balance is the sum of all posted entries. available_balance: $ref: '#/components/schemas/ledger_balance' description: The available_balance is the sum of all posted inbound entries and pending outbound entries. For credit normal, available_amount = posted_credits - pending_debits; for debit normal, available_amount = posted_debits - pending_credits. additionalProperties: false minProperties: 3 required: - pending_balance - posted_balance - available_balance parameters: bulk_id: name: id[] in: query style: form explode: true allowReserved: true schema: type: array items: type: string required: false description: If you have specific IDs to retrieve in bulk, you can pass them as query parameters delimited with `id[]=`, for example `?id[]=123&id[]=abc`. metadata_query: name: metadata in: query schema: type: object additionalProperties: type: string style: deepObject explode: true required: false description: For example, if you want to query for records with metadata key `Type` and value `Loan`, the query would be `metadata%5BType%5D=Loan`. This encodes the query parameters. securitySchemes: basic_auth: type: http scheme: basic