How to use the AIS API

This API is used to access information about accounts. Lists of accounts with an ASPSP and the actual transactions for one account. A consent needs to be acquired in order to access this API. See the consent tutorial for how that is done.

Hosts

Available AUTH_HOST values

EnvironmentURL
Sandboxhttps://auth.sandbox.openbankingplatform.com
Productionhttps://auth.openbankingplatform.com

Available API_HOST values

EnvironmentURL
Sandboxhttps://api.sandbox.openbankingplatform.com
Productionhttps://api.openbankingplatform.com

Account Information Services (AIS) Flow

PlantUML model

Acquire an access token for Account Information

Get a token to use for subsequent calls to the API. The scope should be set to accountinformation private for access to private account information and accountinformation corporate for access to account information using corporate accounts. Transactions from Swedish Bankgirot can also be included by appending the bankgiroinformation scope.

curl -X POST
    [AUTH_HOST]/connect/token
    -H 'Content-Type: application/x-www-form-urlencoded'
    -d 'client_id=[CLIENT_ID]&client_secret=[CLIENT_SECRET]&scope=accountinformation private&grant_type=client_credentials'
javascript

This post will return a JSON object that looks like this:

{
    "access_token": "[ACCESS_TOKEN]",
    "expires_in": 3600,
    "token_type": "Bearer",
    "scope": "accountinformation private"
}
json

You'll need a valid consent for the ASPSP you want to interact with. Follow instructions in the Consent API.

Get Account List

curl -X GET
    [API_HOST]/psd2/accountinformation/v1/accounts
    -H 'Authorization: Bearer [ACCESS_TOKEN]'
    -H 'Content-Type: application/json'
    -H 'PSU-IP-Address: [PSU_IP_Address]'
    -H 'X-BicFi: [BICFI]'
    -H 'X-Request-ID: [GUID]'
    -H 'Consent-ID: [CONSENT_ID]'
javascript

Headers

  • PSU-IP-Address is the IP address of the end user.
  • X-BicFi the BICFI for the user's ASPSP. Find it in the ASPSP API.
  • X-Request-ID used to verify that the response matches the request.
  • Consent-ID identification of the corresponding consent as granted by the PSU.

Response

{
    "accounts": [
        {
            "resourceId": "[ACCOUNT_ID]",
            "iban": "[IBAN]",
            "bban": "[BBAN]",
            "currency": "SEK",
            "bic": "[BICFI]"
        }
    ]
}
json

Response headers

  • X-Request-ID

Get Account Details

Use one of the [ACCOUNT_ID]s to get more information about a specific account.

curl -X GET
    [API_HOST]/psd2/accountinformation/v1/accounts/[ACCOUNT_ID]
    -H 'Authorization: Bearer [ACCESS_TOKEN]'
    -H 'Content-Type: application/json'
    -H 'PSU-IP-Address: [PSU_IP_Address]'
    -H 'X-BicFi: [BICFI]'
    -H 'X-Request-ID: [GUID]'
    -H 'Consent-ID: [CONSENT_ID]'
javascript

Headers

See Get Account List.

Path parameter

Query parameters

  • withBalance Boolean, include balances in the response. Optional.

Response

{
    "resourceId": "[ACCOUNT_ID]",
    "iban": "[IBAN]",
    "bban": "[BBAN]",
    "currency": "SEK",
    "cashAccountType": "[CASH_ACCOUNT_TYPE]",
    "status": "enabled",
    "bic": "[BICFI]",
    "usage": "PRIV",
    "balances": [
        {
            "balanceAmount": {
                "currency": "SEK",
                "amount": "33633.25"
            },
            "balanceType": "closingBooked",
            "creditLimitIncluded": false
        },
        {
            "balanceAmount": {
                "currency": "SEK",
                "amount": "33528.25"
            },
            "balanceType": "interimAvailable",
            "creditLimitIncluded": false
        }
    ]
}
json

Response headers

  • X-Request-ID

Get Balances

Retreive balances for a given [ACCOUNT_ID].

curl -X GET
    [API_HOST]/psd2/accountinformation/v1/accounts/[ACCOUNT_ID]/balances
    -H 'Authorization: Bearer [ACCESS_TOKEN]'
    -H 'Content-Type: application/json'
    -H 'PSU-IP-Address: [PSU_IP_Address]'
    -H 'X-BicFi: [BICFI]'
    -H 'X-Request-ID: [GUID]'
    -H 'Consent-ID: [CONSENT_ID]'
javascript

Headers

See Get Account List.

Path parameter

Response

{
    "balances": [
        {
            "balanceAmount": {
                "currency": "SEK",
                "amount": "33633.25"
            },
            "balanceType": "closingBooked",
            "creditLimitIncluded": false
        },
        {
            "balanceAmount": {
                "currency": "SEK",
                "amount": "33528.25"
            },
            "balanceType": "interimAvailable",
            "creditLimitIncluded": false
        }
    ]
}
json

Response headers

  • X-Request-ID

Get Transaction List

Retrieve transactions for a given [ACCOUNT_ID].

curl -X GET
    [API_HOST]/psd2/accountinformation/v1/accounts/[ACCOUNT_ID]/transactions?bookingStatus=[BOOKING_STATUS]&dateFrom=[DATE_FROM]
    -H 'Authorization: Bearer [ACCESS_TOKEN]'
    -H 'Content-Type: application/json'
    -H 'PSU-IP-Address: [PSU_IP_Address]'
    -H 'X-BicFi: [BICFI]'
    -H 'X-Request-ID: [GUID]'
    -H 'Consent-ID: [CONSENT_ID]'
javascript

Headers

See Get Account List.

Path parameter

Query parameters

  • bookingStatus booked, pending, both.
  • dateFrom is a date in yyyy-MM-dd format.
  • dateTo is a date in yyyy-MM-dd format. Optional.

Response

{
    "transactions": {
        "booked": [
            {
                "transactionId": "[TRANSACTION_ID]",
                "transactionAmount": {
                    "currency": "SEK",
                    "amount": "4101.24"
                }
            }
        ],
        "pending": [
            {
                "transactionId": "[TRANSACTION_ID]",
                "transactionAmount": {
                    "currency": "SEK",
                    "amount": "105"
                }
            }
        ],
        "bankgiro": [
            {
                "aggregateId": 123,
                "aggregateAmount": "789",
                "debtorAddress": {
                    "street": "Main road 1",
                    "postalCode": "12345",
                    "city": "Stockholm"
                },
                "debtorOrganisationId": "5500001234",
                "transactionId": "e2609382-b743-4b53-9ed7-9d95ec2c9f22",
                "entryReference": "30",
                "bookingDate": "2022-04-25",
                "transactionAmount": {
                    "currency": "SEK",
                    "amount": "555.00"
                },
                "creditorAccount": {
                    "bban": "12345678910",
                    "bankgiroNumber": "1234567",
                    "currency": "SEK"
                },
                "debtorName": "Some company name",
                "debtorAccount": {
                    "bankgiroNumber": "9876543",
                    "currency": "SEK"
                }
            }
        ],
        "_links": {
            "account": "/psd2/accountinformation/v1/accounts/[ACCOUNT_ID]"
        }
    },
    "balances": []
}
json

Response headers

  • X-Request-ID

Get Transaction Details

Retreive transaction details for a given [ACCOUNT_ID] and [TRANSACTIONID].

curl -X GET
    [API_HOST]/psd2/accountinformation/v1/accounts/[ACCOUNT_ID]/transactions/[TRANSACTIONID]
    -H 'Authorization: Bearer [ACCESS_TOKEN]'
    -H 'Content-Type: application/json'
    -H 'PSU-IP-Address: [PSU_IP_Address]'
    -H 'X-BicFi: [BICFI]'
    -H 'X-Request-ID: [GUID]'
    -H 'Consent-ID: [CONSENT_ID]'
javascript

Headers

See Get Account List.

Path parameters

Response

{
    "transactionId": "[TRANSACTION_ID]",
    "transactionAmount": {
        "currency": "SEK",
        "amount": "4101.24"
    },
    "creditorAccount": {
        "iban": "[CREDITOR_IBAN]",
        "bban": "[CREDITOR_BBAN]"
    },
    "debtorAccount": {
        "iban": "[DEBTOR_IBAN]",
        "bban": "[DEBTOR_BBAN]"
    },
    "remittanceInformationUnstructured": "Short msg",
    "purposeCode": "OTHR"
}
json

Response headers

  • X-Request-ID

Schemas

Account status

status for an account can be one of the following values:

  • enabled
  • deleted
  • blocked

Account usage

usage for an account can be one of the following values:

  • PRIV
  • ORGA

Balance type

balanceType can be one of the following values:

  • closingBooked
  • expected
  • authorised
  • openingBooked
  • interimAvailable
  • interimBooked
  • forwardAvailable
  • nonInvoiced

Purpose code

purposeCode values for transactions can be found in the ISO 20022 External Code List ExternalCodeSets_1Q2018 June 2018.