Skip to main content

Lock Deposit Amount

Overviewโ€‹

The Lock Deposit Amount API enables financial institutions to place a hold on a specific amount in a customer's deposit account. This operation reduces the available balance while maintaining the actual account balance, preventing the locked funds from being used in other transactions.

Command Detailsโ€‹

Command Name: LockDepositAmountCommand

Operation Type: Command (Write Operation)

Transaction Type: AmountLock

Use Casesโ€‹

  • Card Authorization Holds: Lock funds for card transactions pending settlement
  • Check Holds: Place holds on deposited checks pending clearance
  • Regulatory Compliance: Lock funds for legal or regulatory requirements
  • Collateral Management: Hold funds as collateral for loans or guarantees
  • Payment Guarantees: Ensure funds availability for scheduled payments

API Endpointโ€‹

POST /api/bpm/cmd
Content-Type: application/json
Authorization: Bearer {access_token}

Request Structureโ€‹

Request Bodyโ€‹

{
"commandName": "LockDepositAmountCommand",
"data": {
"accountEncodedKey": "string",
"blockReference": "string",
"amount": 0.00,
"allowNegativeBalance": false,
"lockReason": "string"
}
}

Request Fieldsโ€‹

Field NameTypeMandatoryDescriptionAdditional Information
accountEncodedKeyStringYesThe unique identifier or account number of the deposit accountCan be either the encoded key or account number
blockReferenceStringYesUnique reference for this lock operationMust be unique for the account. Used to identify and release/seize the lock
amountDecimalYesAmount to be lockedMust be a positive number. Precision up to 2 decimal places
allowNegativeBalanceBooleanNoWhether to allow locking even if it results in negative balanceDefault: false. Set to true for overdraft scenarios
lockReasonStringNoDescription or reason for locking the amountFree text field for audit trail purposes

Sample Requestsโ€‹

Example 1: Standard Amount Lockโ€‹

{
"commandName": "LockDepositAmountCommand",
"data": {
"accountEncodedKey": "8a818e8c7f2d7e39017f2d8f4b250001",
"blockReference": "HOLD-2024-12-17-0001",
"amount": 50000.00,
"allowNegativeBalance": false,
"lockReason": "Card authorization hold for POS transaction"
}
}

Example 2: Check Holdโ€‹

{
"commandName": "LockDepositAmountCommand",
"data": {
"accountEncodedKey": "2000123456",
"blockReference": "CHK-HOLD-202412170001",
"amount": 150000.00,
"lockReason": "Check hold - pending clearance for Check #12345"
}
}
{
"commandName": "LockDepositAmountCommand",
"data": {
"accountEncodedKey": "8a818e8c7f2d7e39017f2d8f4b250002",
"blockReference": "LEGAL-HOLD-CT-2024-789",
"amount": 2500000.00,
"allowNegativeBalance": false,
"lockReason": "Court order - Case #CT/2024/789"
}
}

Example 4: Overdraft Scenarioโ€‹

{
"commandName": "LockDepositAmountCommand",
"data": {
"accountEncodedKey": "8a818e8c7f2d7e39017f2d8f4b250003",
"blockReference": "OD-LOCK-20241217-001",
"amount": 75000.00,
"allowNegativeBalance": true,
"lockReason": "Overdraft facility lock"
}
}

Response Structureโ€‹

Success Responseโ€‹

HTTP Status: 200 OKโ€‹

{
"isSuccessful": true,
"statusCode": "00",
"message": "Amount locked successfully.",
"data": {
"blockReference": "HOLD-2024-12-17-0001",
"transactionId": "A7B3F2E1D9C8B6A5E4F3D2C1B0A98765"
},
"pages": 0,
"hasNext": false,
"hasPrevious": false,
"count": 0,
"size": 0
}

Success Response Fieldsโ€‹

Field NameTypeDescription
isSuccessfulBooleanIndicates operation success (true for successful locks)
statusCodeStringResponse code ("00" for success)
messageStringHuman-readable success message
data.blockReferenceStringEcho of the block reference from request
data.transactionIdStringUnique transaction identifier for the lock operation

Error Response Examplesโ€‹

Error 1: Account Not Foundโ€‹

HTTP Status: 200 OK (Application-level error)

{
"isSuccessful": false,
"statusCode": "CBS_404",
"message": "The account number is not valid",
"data": null
}

Error 2: Duplicate Block Referenceโ€‹

{
"isSuccessful": false,
"statusCode": "CBS_409",
"message": "The block reference must be unique. The reference - HOLD-2024-12-17-0001 already exists.",
"data": null
}

Error 3: Account Locked/Frozenโ€‹

{
"isSuccessful": false,
"statusCode": "CBS_400",
"message": "You cannot perform any transaction on this account. It is presently locked.",
"data": null
}

Error 4: Insufficient Balanceโ€‹

{
"isSuccessful": false,
"statusCode": "CBS_402",
"message": "Insufficient balance to lock the specified amount.",
"data": null
}

Business Logicโ€‹

Pre-Conditionsโ€‹

  1. Account Validation:

    • Account must exist in the system
    • Account must be in an active state
    • Account must not be frozen or locked
  2. Balance Validation:

    • If allowNegativeBalance is false, available balance must be รขโ€ฐยฅ lock amount
    • Available balance = Account balance - Already blocked amount
  3. Uniqueness Validation:

    • Block reference must be unique for the account
    • System checks existing locks before creating new one

Processing Stepsโ€‹

  1. Validate Input:

    • Validate account existence and status
    • Check block reference uniqueness
    • Verify account is not frozen or locked
  2. Check Balance:

    • If allowNegativeBalance is false, validate sufficient balance
    • Calculate: Available Balance = Account Balance - Blocked Amount
  3. Create CBS Transaction:

    • Generate unique transaction key
    • Create transaction record with type AmountLock
    • Set transaction hold state to HOLD
  4. Create Amount Lock Record:

    • Store lock details (amount, reference, reason)
    • Link to CBS transaction
    • Set lock state to LOCKED
  5. Update Account Balances:

    • Reduce available account balance by lock amount
    • Increase blocked amount by lock amount
    • Note: Actual balance remains unchanged
  6. Commit Transaction:

    • Persist all changes atomically
    • Return success response with transaction details

Post-Conditionsโ€‹

  • Account Balance: Unchanged
  • Available Balance: Reduced by lock amount
  • Blocked Amount: Increased by lock amount
  • Lock Record: Created with state LOCKED
  • CBS Transaction: Created with hold state HOLD

Account Balance Impactโ€‹

Before Lock:
รขโ€ล“รขโ€โ‚ฌรขโ€โ‚ฌ Account Balance: 100,000.00
รขโ€ล“รขโ€โ‚ฌรขโ€โ‚ฌ Blocked Amount: 0.00
รขโ€โ€รขโ€โ‚ฌรขโ€โ‚ฌ Available Balance: 100,000.00

Lock Operation: 50,000.00

After Lock:
รขโ€ล“รขโ€โ‚ฌรขโ€โ‚ฌ Account Balance: 100,000.00 (unchanged)
รขโ€ล“รขโ€โ‚ฌรขโ€โ‚ฌ Blocked Amount: 50,000.00 (increased)
รขโ€โ€รขโ€โ‚ฌรขโ€โ‚ฌ Available Balance: 50,000.00 (reduced)

Unlock/Release Amountโ€‹

To remove a lock and restore available balance:

  • Command: DeleteDepositLockAmountCommand
  • Required: accountEncodedKey, blockReference
  • Effect: Restores available balance, removes lock

Seize Locked Amountโ€‹

To convert locked amount to an actual debit:

  • Command: SeizeDepositLockAmountCommand
  • Required: accountEncodedKey, blockReference, channelEncodedKey
  • Effect: Debits account, removes lock

Query Locksโ€‹

To retrieve lock information:

  • Command: GetLockDepositAmountQuery
  • Required: accountEncodedKey
  • Effect: Returns list of active/historical locks

Architecture Diagramโ€‹

Security Considerationsโ€‹

Authorizationโ€‹

  • User must have appropriate permissions to lock amounts
  • Some lock types (e.g., legal holds) may require elevated permissions
  • Audit trail is maintained for all lock operations

Fraud Preventionโ€‹

  • System validates block reference uniqueness to prevent duplicate locks
  • Account status checks prevent operations on frozen/locked accounts
  • Transaction logging enables forensic analysis

Complianceโ€‹

  • Lock reason field supports regulatory reporting requirements
  • All locks are tracked with user details and timestamps
  • Supports legal and regulatory hold requirements

Performance Considerationsโ€‹

Database Operationsโ€‹

  • Single database transaction for atomicity
  • Includes validation queries and insert operations
  • Typical response time: 100-300ms

Concurrencyโ€‹

  • Uses database transactions for consistency
  • Handles concurrent lock requests on same account
  • Prevents race conditions through atomic operations

Scalabilityโ€‹

  • Stateless operation supports horizontal scaling
  • Database indexes on account number and block reference
  • Suitable for high-volume environments

Troubleshootingโ€‹

Issue: Duplicate Block Reference Errorโ€‹

Symptom: CBS_409 error even with unique reference

Cause: Previous lock with same reference exists

Solution:

  1. Query existing locks: GetLockDepositAmountQuery
  2. Check if lock needs to be released
  3. Use different block reference if needed

Issue: Insufficient Balanceโ€‹

Symptom: CBS_402 error despite sufficient account balance

Cause: Existing locks reducing available balance

Solution:

  1. Check account's blocked amount
  2. Review existing locks
  3. Release unnecessary locks or reduce lock amount

Issue: Cannot Lock Frozen Accountโ€‹

Symptom: CBS_400 error - account locked/frozen

Cause: Account has operational restrictions

Solution:

  1. Verify account status
  2. Remove freeze/lock if appropriate
  3. Use administrative override if authorized

Monitoring and Alertsโ€‹

Key Metricsโ€‹

  • Lock success rate
  • Average lock duration
  • Locks by type/reason
  • Unlocked vs seized ratio
  • Failed lock attempts
  • Locks exceeding 30 days
  • Multiple failed lock attempts
  • Unusual lock amounts
  • High volume of locks on single account

Audit and Complianceโ€‹

Audit Trailโ€‹

Every lock operation creates audit records including:

  • User who created the lock
  • Timestamp of operation
  • Account and amount details
  • Lock reason
  • System and channel information

Regulatory Reportingโ€‹

Lock data supports:

  • Suspicious activity reporting
  • Account freeze compliance
  • Legal hold documentation
  • Financial crime prevention

Code Examplesโ€‹

C# Exampleโ€‹

Code Removed

Implementation details removed for security.

Contact support for implementation guidance.

JavaScript/TypeScript Exampleโ€‹

async function lockDepositAmount(
accountNumber: string,
amount: number,
reference: string,
reason: string
): Promise<ApiResponse> {
const response = await fetch('/api/bpm/cmd', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${accessToken}`
},
body: JSON.stringify({
commandName: 'LockDepositAmountCommand',
data: {
accountEncodedKey: accountNumber,
blockReference: reference,
amount: amount,
lockReason: reason,
allowNegativeBalance: false
}
})
});

return await response.json();
}

Python Exampleโ€‹

import requests

def lock_deposit_amount(account_number, amount, reference, reason):
url = "https://api.banklingo.com/api/bpm/cmd"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {access_token}"
}
payload = {
"commandName": "LockDepositAmountCommand",
"data": {
"accountEncodedKey": account_number,
"blockReference": reference,
"amount": amount,
"lockReason": reason,
"allowNegativeBalance": False
}
}

response = requests.post(url, json=payload, headers=headers)
return response.json()

Response Codesโ€‹

CodeDescriptionResolution
00SuccessLock created successfully
CBS_400Bad Request / Account LockedCheck account status, ensure account is not frozen
CBS_402Insufficient BalanceVerify available balance, consider allowNegativeBalance option
CBS_404Account Not FoundVerify account number/encoded key
CBS_409Duplicate Block ReferenceUse unique block reference or query existing locks

Business Rulesโ€‹

Validation Rulesโ€‹

  1. Account Encoded Key - Must correspond to an existing, active deposit account in the system
  2. Block Reference - Must be unique per account; duplicate references will be rejected with CBS_409 error
  3. Amount - Must be a positive decimal value with up to 2 decimal places; zero or negative amounts are not permitted
  4. Available Balance - Lock amount cannot exceed available balance unless allowNegativeBalance is set to true
  5. Account Status - Account must not be frozen, closed, or have operational restrictions
  6. Lock Reason - Maximum 500 characters; used for audit trail and reporting purposes

Operational Rulesโ€‹

  1. Locks reduce the available balance but do not affect the actual account balance
  2. Multiple locks can exist on the same account with different block references
  3. Locks remain active until explicitly released (DeleteDepositLockAmount) or seized (SeizeDepositLockAmount)
  4. Setting allowNegativeBalance to true bypasses the available balance check (use with caution)
  5. All lock operations are logged in the audit trail with timestamps and user information

Changelogโ€‹

Version 1.0.0 - December 17, 2025โ€‹

  • Initial documentation
  • Added comprehensive request/response examples
  • Included code samples in multiple languages
  • Added troubleshooting section

Last Updated: December 17, 2025

API Version: 1.0

Document Version: 1.0.0