Quickstart: part 2

Collect and retrieve financial data in 10 minutes.

 

STEP 4: Consent & Connect via the Consent UI




Before you can retrieve a users financial data, you first need to link to their financial institutions by creating a connection. This can only be done once a user has explicitly consented to share their data. This can be done via the Basiq Consent UI. While you are starting out in sandbox mode, use the institutions and credentials provided here.

// STEP 4: Consent & Create a connection 

window.location = `https://consent.basiq.io/home?token={{client_token_bound_to_userId}}`;
curl --location --request POST 'https://au-api.basiq.io/token' \
--header 'Authorization: Basic [YOUR-API-KEY]' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'basiq-version: 3.0' \
--data-urlencode 'scope=CLIENT_ACCESS' \
--data-urlencode 'userId=1234567-1234-1234-1234-123456781234'

STEP 5: Fetch your aggregated data




Once you have successfully created a connection, you can go ahead and retrieve the data belonging to it. Let’s retrieve a list of all the accounts this user has connected through Basiq.
// STEP 5: Fetch your aggregated data 

var axios = require('axios');

var config = {
  method: 'get',
  url: 'https://au-api.basiq.io/users/{user.id}/accounts',
  headers: { 
    'Authorization': 'Bearer $YOUR_ACCESS_TOKEN', 
    'Accept': 'application/json'
  }
};

axios(config)
.then(function (response) {
  console.log(response.data);
})
.catch(function (error) {
  console.log(error);
});
curl --location --request GET 'https://au-api.basiq.io/users/a920c00f-df79-4a12-b711-2ac461c8090b/accounts' \
--header 'Authorization: Bearer $YOUR_ACCESS_TOKEN' \
--header 'Accept: application/json'

The response will contain an array of Account objects, containing specific account details such as the account number, balance and available funds.

Congratulations! You have now created a user consent, connected a financial institution, and retrieved their financial data.

 

Feel free to deep dive into our full API reference to see what else is possible with Basiq.