Get an account's balance history
Retrieve an account transaction history report that provides an end-of-day balance history grouped by day. You need to use an account-specific token for the request in this endpoint.
Step-by-step
Given a new account that was created using the Create corporate account endpoint, list all transactions using the balance history API:
Request
curl -X GET 'https://api-sandbox.pismolabs.io/corporate/balance-history' \
-H 'Content-Type: application/json' -H 'x-tenant: <Org ID>'
Response
At this time, no transaction has yet been made:
{ "balance_history": [] } // Empty list
Example
The following example shows how you can use the corporate payment API (an extension of the core payments API). The following three requests perform API calls to build a transaction history:
Request 1 - Cash-in of 320 GBP at 2022-02-09
Currently, the maximum number of days supported for backdating is seven (7).
curl --location --request POST 'https://api-sandbox.pismolabs.io/corporate/payments' \
--header 'x-tenant: {tenantId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"descriptor": "P2P payment",
"from": [
{
"custom_info": {
"type": "CASHIN"
}
}
],
"to": [
{
"amount": 320,
"currency": "GBP",
"account": {
"id": {accountId}
}
}
],
"payment_datetime": "2022-02-09T10:00:00Z",
}'
Request 2 - Cash-in of 600 GBP on 2022-02-06
curl --location --request POST 'https://api-sandbox.pismolabs.io/corporate/payments' \
--header 'x-tenant: {tenantId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"descriptor": "P2P payment",
"from": [
{
"custom_info": {
"type": "CASHIN"
}
}
],
"to": [
{
"amount": 600,
"currency": "GBP",
"account": {
"id": {accountId}
}
}
],
"payment_datetime": "2022-02-06T10:00:00Z",
}'
Request 3 - Cash-out of 400 GBP on 2022-02-07
curl --location --request POST 'https://api-sandbox.pismolabs.io/corporate/payments' \
--header 'x-tenant: {tenantId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"descriptor": "P2P payment",
"from": [
{
"amount": 400,
"currency": "GBP",
"account": {
"id": {accountId}
}
}
],
"to": [
{
"custom_info": {
"type": "CASHOUT"
}
}
],
"payment_datetime": "2022-02-07T10:00:00Z",
}'
Now, retry the original request to list all transactions using the balance history API:
curl -X GET 'https://api-sandbox.pismolabs.io/corporate/balance-history' \
-H 'Content-Type: application/json' -H 'x-tenant: <Org ID>'
Response
{
"balance_history": [
{
"date": "2022-02-06",
"daily_movement": 600,
"balance": 600
},
{
"date": "2022-02-07",
"daily_movement": -400,
"balance": 200
},
{
"date": "2022-02-08",
"daily_movement": 0,
"balance": 200
},
{
"date": "2022-02-09",
"daily_movement": 320,
"balance": 520
}
]
}
Updated 12 months ago