There is the payment stub endpoint: http://storagenode:14002/api/heldamount/paystubs/<START_DATE: YYYY-MM>/<END_DATE: YYYY-MM>
For example, on a storage node created on 2019-07, you can get historical payment data with
curl 'http://storagenode:14002/api/heldamount/paystubs/2019-07/2022-01'
And sum all payments amount:
curl 'http://storagenode:14002/api/heldamount/paystubs/2019-07/2022-01' 2>/dev/null \
| jq -r '.[].paid' \
| awk '{s+=$1} END {print s}' -
You’ll then have to divide the result by 10^6 to have value in dollars.