Real-Time Data
Last updated July 5th, 2024
Overview
This feature allows you to retrieve the most recent financial data from your customer's linked account. We silently fetch data from the bank if persistence access is available; otherwise, re-authorization is requested from the user.
How It Works
- Partners add
x-realtime
in their API header for endpoints like balance and transactions. - We silently fetch data from the bank if persistence access is available for the linked account; otherwise, re-authorization is requested from the user.
Authentication
Requests to the API for real time data must include the following in the header:
- Mono Security Key:
mono-sec-key: live_sk_example
- x-realtime:
true
API Response Headers
The responses in the endpoints below will include the following header:
x-has-new-data: true | false
- Indicates if the use has new data and it was fetched.
API Endpoints
Real Time can be retrieved using the following endpoints:
Account Balance
get
https://api.withmono.com/v2/accounts/{id}/balanceResponse
Request
{
"status": "successful",
"message": "Request was succesfully completed",
"timestamp": "2024-07-05T12:20:59.336Z",
"data": {
"id": "666b166ce06be73",
"name": "Samuel Olamide",
"account_number": "0200000043",
"balance": 53769,
"currency": "NGN"
}
}
Other Responses
Kindly take note of the following scenarios:
- Long processing time
- When reauthorization is required
Long Processing Time
In cases where real-time data cannot be fetched within 30 seconds, we return the following message in the response
Request
{
"status": "successful",
"message": "Account transaction sync is enqueued, please try again once notified via webhook",
"timestamp": "2024-07-05T09:34:54.565Z",
"data": null
}
Webook Response
Request
"event": "mono.events.account_updated",
"data": {
"account": {
"_id": "6683fc303e1418f0",
"name": "SAMUEL OLAMIDE NOMO",
"accountNumber": "0200000042",
"currency": "NGN",
"balance": 38051141,
"type": "SAVINGS_ACCOUNT",
"bvn": "00000000053",
"authMethod": "internet_banking",
"institution": {
"name": "GTBank",
"bankCode": "000013",
"type": "PERSONAL_BANKING"
},
"created_at": "2024-07-02T13:10:08.581Z",
"updated_at": "2024-07-03T11:28:56.250Z"
},
"meta": {
"data_status": "AVAILABLE",
"auth_method": "internet_banking",
"sync_status": "SUCCESSFUL" | "FAILED"
}
}
If the sync_status
is successful
in the webhook response, you can proceed to call the transactions or balance endpoint to retrieve the updated data. This means that the x-realtime
field in the headers should be set to false
once the API call is successful to avoid creating a new realtime session for the customer’s account.
Rate Limit
Real-time sessions for each account can only be performed at 5-minute intervals (5-minute rate limit). If you attempt to call the endpoint again within this interval and the real-time session is still in queue, you'll receive the following message:
Request
{
"status": "successful",
"message": "Account transactions sync is in progress for this account, please try again in 274 seconds",
"timestamp": "2024-07-04T09:35:10.554Z",
"data": null
}