In this guide, you'll connect with our Data API and retrieve test bank data. To do this, you will need to:
- Generate an authentication link. This link provides a simple user interface for your users to connect their bank accounts.
- Log in to our Mock Bank account and obtain an
access_token. You'll use this
access_tokento get sample data including accounts, transactions and balances.
See it in action
Try our demo application Piggy Bank to see a working example of a TrueLayer integration.
First, download and configure the sandbox Data API Postman collection and environment.
This collection contains preconfigured requests to retrieve sample data and generate code snippets in various languages.
You can also download the live Postman collection and environment.
First, create an authentication link. This auth link provides an easy user interface to demo connecting to our Mock Bank. To do this:
- Go to Console > Data API > Auth Link Builder.
- In the Providers tab, select the Mock provider to test your integration with our Mock Bank.
- Switch to the Permissions tab to select the set of permissions that you want to include in the Authentication link. These permissions control which Data API endpoints your application can access.
- Switch to the Redirect URIs tab to choose a Redirect URI. This is where the user will be redirected after authentication.
- Click the Preview icon to open the test authentication link. Click Allow.
- Select Mock Bank and use a set of our Mock Bank credentials, for example john/doe, to get a
- Store this code. You need it to get an access token.
To get a sandbox access token:
- In Postman, select the Truelayer Data Products Sandbox environment.
- Add values to the following variables within the environment:
- client_id : Your sandbox
- client_secret : Your sandbox
- redirect_uri : This variable already contains the default redirect URI from Console, but you can change it if you need to.
- client_id : Your sandbox
- Go to Exchange code for access token.
- In the Body tab, scroll down to the
codeparameter. Input the code you got from the test auth link.
- Send the request. If successful, the response contains an
access_token. This saves automatically.
A note on responses
If you have enabled the
offline_accesspermission in Console, you will receive a
refresh_tokenas well as an
access_tokenin the response.
Now you have your access token, run any of the Data API requests to retrieve sample account numbers, transaction data or personal information.
For example: the List all accounts request within the Data > Accounts folder retrieves all account information for the given set of credentials.
Updated about 1 month ago