Using PSD2 APIs

by Temenos Developers in Guides May 8, 2019

PSD2 APIs represent the Banking Standard for publishing API specifications. This set of rules is a defined standard that allows providers (like Temenos) and consumers (anyone who wants to connect to our application) a standard definition of the data that is sent and received between the consumer and provider.

You can read our PSD2 API Spec in the API Catalog , but this brief guide will help you get a basic understanding of where PSD2 APIs can be useful and how to explore the responses for application to more complex use cases.

The code below is written in Python and uses a simple API call to return all the information provided by the PSD2 accounts API. This is one of 3 APIs that Temenos publishes to match the open banking PSD2 standard.

import requests
import json
account_number = input("Enter the account number to request:")
url = 'https://api.temenos.com/api/v1.0.0/holdings/PSD2/accounts/' + account_number
headers = {'Accept': 'application/json', 'apikey': 'YOUR_KEY_HERE'}
response = requests.get(url, headers=headers)
jData = json.loads(response.content)
if '404' in str(jData):
    print(jData) 
else:
    print(json.dumps(jData, sort_keys=True, indent=4, separators=(',', ': ')))

If you execute this code against the Temenos sandbox for example (or your own Transact instance) you would get something similar to the below:

Chriss-MBP-3:Pi-Projects charrold303$ python3 tcf_apicall_psd2.py 
Enter the account number to request:10995
d{
    "body": [
        {
            "BIC": "DEMOGBPX",
            "accountIBAN": "GB61DEMO60161300010995",
            "accountId": "10995",
            "accountStatus": "Active",
            "availableBalance": 13589692.01,
            "currency": "USD",
            "displayName": "COCA-COLA",
            "ledgerBalance": 13591299.78,
            "productId": "Current Account"
        }
    ],
    "header": {
        "audit": {
            "T24_time": 22478,
            "parse_time": 0
        },
        "page_size": 99,
        "page_start": 1,
        "page_token": "201904171988563516.01,99",
        "total_size": 1
    }
}

Now I can see quickly and easily the data contained in the PSD2 API specification from Temenos Transact, and I can start to build logic to handle the returned data. For example, I have manually entered the account number in this code example, but I could add the ability to collect it from the user via a web form.

Perhaps most importantly I can begin to see the data returned and can plan how to handle things like formatting and data normalization for integration into my planned applications.