Balance monitors let you keep track of balances in your Blnk Ledger. This is useful for scenarios where balances should meet specific thresholds.

You can monitor all 3 sub-balances of a ledger balance — credit balance (credit_balance), debit balance (debit_balance) and total balance (balance).

Let’s get started ✨

What we’ll cover …

  1. Why monitor balances?
  2. Set up balance monitors
  3. Supported operators
  4. Manage existing balance monitors

1. Why monitor balances?

  1. Fraud detection: Unusual balance changes can be an early indication of fraudulent activities. Monitoring can trigger alerts for suspicious transactions and ensure timely intervention.

  2. Regulatory compliance: Many financial regulations require institutions to maintain specific balance thresholds. Real-time balance monitoring makes it easy to comply with these regulations.

  3. Customer notifications: Customers can be notified in real-time if their balance crosses a specific threshold. It can also be used for segmenting your customers in your application.

  4. Operational efficiency: Instantly knowing when a balance reaches a certain threshold can trigger automatic actions, such as transferring funds between accounts or purchasing assets.

2. Set up balance monitors

To set up balance monitoring, you need to determine your conditions, e.g., notify me when the debit_balance is above 100000.

Next, call the create-balance-monitor endpoint and provide the following request body:

POST http://YOUR_BLNK_INSTANCE_URL/balance-monitors
Request
{
    "balance_id": "bln_0be360ca-86fe-457d-be43-daa3f966d8f0",
    "condition": {
        "field": "debit_balance",
        "operator": ">",
        "value": 1000,
        "precision": 100
    },
    "description": "Tier 1 Account"
}
FieldDescriptionRequired?Type
balance_idUnique identifier of the balance to be monitored.Yesstring
conditionObject representing the condition to be satisfied.Yes
fieldSpecific sub-balance to monitor. It can be debit_balance, credit_balance, or balance.Yesstring
operatorIndicates the comparison operation to be performed between the field and operator. See below → Supported operators.Yesstring
valueThe value against which the field is compared.Yesint64
precisionConverts the value to lowest possible unit. Ensure that the precision specified is the same as the precision applied to the balanceYesint64
descriptionDescription of your balance monitor. It is left empty if it’s not passed in the request.Nostring

In this example, Blnk is asked to monitor the balance and send a notification when its debit_balance is greater than 100000.

You can also include a meta_data in your request if you need to add custom data to your balance monitor.

Once the request is received, Blnk stores your balance monitor with a unique monitor_id. When the condition is met, you will get instantly notified via the balance.monitor webhook event.

Response
{
    "monitor_id": "mon_e0e77b0c-4985-472a-9bf5-76a48b0259b0",
    "balance_id": "bln_0be360ca-86fe-457d-be43-daa3f966d8f0",
    "condition": {
        "field": "debit_balance",
        "operator": ">",
        "value": 1000000
    },
    "description": "Tier 1 Account",
    "created_at": "2024-02-20T05:56:58.257315054Z"
}
FieldDescriptionType
monitor_idUnique identifier for your balance monitor.string
created_atDate and time of creation.string

3. Supported operators

This is a list of all supported operators by the Balance monitor:

OperatorsSymbolDescription
Greater than>Checks if the specified balance in field is greater than value
Less than<Checks if the specified balance in field is less than value
Equal to=Checks if the specified balance in field is exactly equal to value
Not equal to!=Checks if the specified balance in field is not equal to value
Greater than or equal to>=Checks if the specified balance in field is greater than or equal to value
Less than or equal to<=Checks if the specified balance in field is less than or equal to value

4. Manage existing balance monitors

You can request to view or update the details of a particular monitor.

To view balance monitors, call the get-balance-monitor endpoint:

GET http://YOUR_BLNK_INSTANCE_URL/balance-monitors/{monitor-id}

GET http://YOUR_BLNK_INSTANCE_URL/balance-monitors will return a list of all balance monitors.

To update a balance monitor, call the update-balance-monitor endpoint:

PUT http://YOUR_BLNK_INSTANCE_URL/balance-monitors/{monitor-id}

and provided the updated conditions in the request body.

Need help?

We are very happy to help you make the most of Blnk, regardless of whether it is your first time or you are switching from another tool.

To ask questions or discuss issues, please join our Discord community.