Transactions
The transactions flow can be used to acquire a list of transactions of a specific account of the consumer.
NOTE: The consent-usage is not available for all accounts. Please check the capabitilies of the account to see if it's available. The latest account_id and capabilities can be fetched via the consent accounts endpoint.
If a timeframe is defined in the consent_scope.transactions
then the transactions request can only fetch transactions from dates within the defined frame.
NOTE: There is a new functionality added. When adding a preferred_pagination_size
to your request you can now activate pagination for your transactions when it is available. For more information regarding this see Paginate Transactions.
Request
POST /xs2a/v1/consents/{consent-id}/transactions/get HTTP/1.1
Content-Type: application/json; charset=utf-8
Authorization: Token <Token>
Host: <Host>
{
"consent_token": String,
"account_id": String,
"from_date": Date,
"to_date": Date,
"preferred_pagination_size": ?Integer,
"psu": ?{
"user_agent": String,
"ip_address": String
}
}
The account identifier provided in the result from an accounts request (from either the XS2A API or the Consent API) has to be passed in the payload of the request. The id of an account can change and it is recommended to request an updated list of accounts in order to use the latest ids.
The from_date
property (in combination with the to_date
property) is used to determine the inclusive start date of the transactions search range.
The to_date
property (in combination with the from_date
property) is used to determine the inclusive end date of the transactions search range.
The psu
object is optional, however, if the consumer is present, it is recommended to provide it. Some banks soften their daily consent usage restrictions if the PSU data is available.
The user_agent
property holds the user agent string of the consumer's client application, e.g. the web browser.
The ip_address
property holds the IP address of the consumer. Both IPv4 and IPv6 are accepted formats.
The preferred_pagination_size
property when defined enables pagination of transactions. The set value for the preferred_pagination_size
will be used as the basis for a page size. It is not possible to ensure this page size because not every bank is compatible with every value. We will try to match the closest possible value here.
Response
{
"data": {
"result": ?{
"transactions": Array<Transaction>,
"from_date": String,
"to_date": String,
"pagination": ?Pagination
},
"consent_token": String
}
}
An array that contains the extracted transactions.
The start date of the timeframe for which the transactions were extracted.
The end date of the timeframe for which the transactions were extracted.
The pagination
object indicates whether or not a pagination is available. This object will not be present if there are no available pages. See Transactions Next for more information on this use case.
The response contains a new consent_token
that has to be used in the following request.
NOTE: The returned information can differ depending on the selected bank, as some banks provide more information than others.
Example
Request
POST /xs2a/v1/consents/gp4cb0g6d9r3qf4d68fkrlb7ejo8mqqk/transactions/get
{
"consent_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbiI6IjEyMzQ1Njc4OTAifQ.na71ipK8ASvggoM6C5vMjBKgJlZLxV-m6ElgHBrNtlU",
"account_id": "fdff8f6f-d923-4489-90b3-43d11c021e1b",
"from_date": "2018-10-05",
"to_date": "2018-10-25",
"preferred_pagination_size": 4000,
"psu": {
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.162 Safari/537.36",
"ip_address": "192.168.2.1"
}
}
Response
200 OK
{
"data": {
"result": {
"transactions": [
{
"reference": "Flight 123",
"amount": {
"amount": 1200,
"currency": "EUR"
},
"original_amount": {
"amount": 12345,
"currency": "SEK"
},
"counter_party": {
"id": "123e4567-e89b-12d3-a456-426655440000",
"alias": "Girokonto",
"account_number": "123456789",
"iban": "DE44500105175407324931",
"holder_name": "Max Mustermann",
"holder_address": {
"street_address": "Konrad-Adenauer-Straße 21",
"street_address2": "Backside of the House, Floor 2",
"postalcode": "35440",
"city": "Linden",
"region": "Hesse",
"country": "DE"
},
"bank_code": "51091700",
"bic": "VRBUDE51XXX",
"bank_name": "VR Bank Untertaunus eG",
"bank_address": {
"street_address": "Konrad-Adenauer-Straße 21",
"street_address2": "Backside of the House, Floor 2",
"postalcode": "35440",
"city": "Linden",
"region": "Hesse",
"country": "DE"
},
"transfer_type": "NONE",
"account_type": "DEFAULT"
},
"bank_transaction_code": {
"code": "CCRD",
"sub_code": "CreditCardPayment",
"description": "Transaction is related to a payment of credit card."
},
"merchant_category_code": "5967",
"date": "2018-10-23",
"booking_date": "2018-10-23",
"value_date": "2018-10-25",
"state": "PROCESSED",
"type": "DEBIT",
"method": "TRANSFER"
}
],
"from_date": "2018-10-05",
"to_date": "2018-10-25",
"pagination": {
"count": 4000,
"url": "https://api.openbanking.playground.klarna.com/xs2a/v1/consents/gp4cb0g6d9r3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