Retrieve test bank data

Learn how to connect with our Data API and retrieve bank data in a few quick steps.

In this guide, you'll connect with our Data API and retrieve test bank data. To do this, you will need to:

  1. Generate an authentication link. This link provides a simple user interface for your users to connect their bank accounts.
  2. Log in to our Mock Bank account and obtain an access_token. You'll use this access_token to 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.

Before you start

Sign up to Console and create an app. If this is your first time using Console, follow our Create a Console account quick start guide to get up and running fast.

Configure Postman

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.

Authorise a test user

First, create an authentication link. This auth link provides an easy user interface to demo connecting to our Mock Bank. To do this:

  1. Go to Console > Data API > Auth Link Builder.
  2. In the Providers tab, select the Mock provider to test your integration with our Mock Bank.
  3. 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.
  4. Switch to the Redirect URIs tab to choose a Redirect URI. This is where the user will be redirected after authentication.
  5. Click the Preview icon to open the test authentication link. Click Allow.
  6. Select Mock Bank and use a set of our Mock Bank credentials, for example john/doe, to get a code.
  7. Store this code. You need it to get an access token.

Get an access token

To get a sandbox access token:

  1. In Postman, select the Truelayer Data Products Sandbox environment.
  2. Add values to the following variables within the environment:
    • client_id : Your sandbox client_id
    • client_secret : Your sandbox client_secret
    • redirect_uri : This variable already contains the default redirect URI from Console, but you can change it if you need to.
  3. Go to Exchange code for access token.
  4. In the Body tab, scroll down to the code parameter. Input the code you got from the test auth link.
  5. Send the request. If successful, the response contains an access_token. This saves automatically.

📘

A note on responses

If you have enabled the offline_access permission in Console, you will receive a refresh_token as well as an access_token in the response.

Access sample data

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.