The Investec API enables you to query several details about an account. First, weβll explore how to retrieve an accountβs transaction history.
The API endpoint returns a list of transactions between two dates, as specified in your request.
Every account on your bank account has a unique ID that you use when transacting against it. So first, you must obtain the appropriate ID. Fortunately, the Investec API has an easy-to-use endpoint for this.
Using the community-contributed Postman Collection, make an API call to to your Private Bank account using https://openapi.investec.com/za/pb/v1/accounts. It does not take any special parameters and returns a JSON list of all your accounts and their IDs.
π§° If you have a CIB account use the following URL instead: https://openapi.investec.com/za/bb/v1/accounts
Run the Get Accounts request in the Postman collection, and remember to add the bearer token obtained earlier on as variable in your Postman environment.
Below is an example response . You want the value in the βaccountIdβ field.
Where {accountId} is the account ID you have just obtained, whereas fromDate and toDate can be any ISO 8601 formatted date [Example of formatted date: 1999-09-09]].
Letβs get transactions from the last month. Our request would be: http://api.investec.com/za/pb/v1/accounts/1234-5678/transactions?fromDate=2023-02-22&toDate=2023-01-22&page=1.
You can add these parameters to the Get Account Transactions Postman request, taking care to use the correct account ID.
Pro Tip: As you may have noticed, the endpoint accepts a pagination parameter for when you need to iterate through a longer transaction history.
If you have added the correct account ID, you will get a response with structure:
Now you know how to pull data from the Investec API. You can discover several other endpoints in the API reference, they all authenticate in the same fashion..
In the next step, we will explore how to push data to the Investec API and effect account changes.