get
https://api.kevel.co/v1/wallet//balance-history
Returns a wallet's Balance at the end of each day.
Returns the wallet's Balance at the end of each day, oldest first, as Reporting records it. Use it for closed days. It can differ from Get Wallet Balances, and the latest day can still be filling in.
API syntax
GET https://api.kevel.co/v1/wallet/{WalletID}/balance-history
Notes
- Days after today repeat the latest Balance.
- Read every page for a long period.
- Shortly after you create a wallet, the call returns
{"items": [], "totalCount": 0}instead of the usual page fields, then a502until the wallet reaches reporting. Retry after a short wait. Each day then returns0until spend or an adjustment arrives.
Reconcile spend
Work out a period's delivery spend after its last day has closed.
- Pull end-of-day balances with this call, starting the day before the period, so you have an opening Balance. If the wallet did not exist on that day, the opening Balance is 0.
- Pull the adjustments for the period's own dates with List Wallet Adjustments.
- Subtract. Delivery spend is the change in Balance minus the adjustments. With an opening Balance of 4,000, a closing Balance of 22,000 and one adjustment of -10,000, delivery spend is 22,000 - 4,000 - (-10,000) = 28,000.
If an adjustment you posted is missing from the list, it is also missing from the history. Contact Kevel with the wallet ID and the idempotency key.
Errors
| Status | Message | What to do |
|---|---|---|
400 | startDate is required when endDate is provided. | Add startDate. |
400 | startDate must be a valid YYYY-MM-DD date. / endDate must be a valid YYYY-MM-DD date. | Use YYYY-MM-DD. |
400 | endDate must be on or after startDate. | Fix the range. |
404 | Wallet {id} not found. | Use one of your wallet IDs. |
502 | Upstream reporting service returned an unexpected response. | Retry. If it continues, contact Kevel. |
