Data Sessions

Retrieve different kinds of bank account data with data sessions

A Data Session is the secure way to programmatically launch the client-side Ivy Data Session Flow that lets your users authenticate access to their their bank accounts.

Create a Data Session with the Ivy API

To create a data session using the Ivy API, call the POST /data/session/create endpoint. At a minimum, you can create a checkout with the following data:

FieldTyperequiredDescription
referenceIdstringtrueA unique reference ID, usually your internal transfer ID.
permissionsstring[]trueThe type of data, you want to retrieve from your user. Options: balances, transactions and identity
returnUrlstringtrueThe user will be redirected to this URL when they return to your app.
marketstringfalseThe market of the user will be preselected when passing this field.
customerobjectfalseYou can pass the customer identifier of the Ivy returning customer network, either email or customerId here to increase returning customer conversion.

Example Payload

This is an example request payload to retrieve identity data of a user:

{
    "referenceId": "123456789",
    "permissions": ["identity"],
    "returnUrl": "https://example.com/callback/result",
}

The response is the data session object with the additional redirectUrl field:

FieldTypeDescription
idstringThe unique Ivy id for this data session.
referenceIdstringA unique reference ID, usually your internal Id.
permissionsstring[]The type of data, you want to retrieve from your user. Options: balances, transactions and identity
returnUrlstringThe user will be redirected to this URL when they return to your app.
marketstringThe market of the user will be preselected when passing this field.
customerobjectYou can pass the customer identifier of the Ivy returning customer network, either email or customerId here to increase returning customer conversion.
statusstringThe status of the data session. Possible values are started, pending, failedor complete. The data is available as soon as the status equals complete.
dataobjectAn object containing the requested data.
redirectUrlstringThe URL to which you need to redirect the user.

Redirect the User to the Data Session URL

After you receive the response from the Ivy API, you need to redirect the user to the redirectUrl that you received in the response.

ParameterTypeDescription
idStringA unique identifier for the created data session.
redirectUrlStringSend the user here to start the data session.

Retrieve Bank Data

After a user successfully finished authentication with their bank, Ivy adds the status pending which then results in either a complete or failed terminal status.

The user will be redirected to the returnUrl when the flow is done or cancelled. The following data is attached as query parameters to the return URLs.

FieldTypeDescription
referenceIdstringThe referenceId that you provided when creating the data session
data-session-idstringThe data session id.
successbooleantrue when the flow was successfully finished. Else, false.

In order to retrieve bank data, you can either poll the GET /data/session/retrieve endpoint or you can set up Webhooks to receive data session events.

Result for Identity

The identity object contains the following parameters:

ParameterTypeDescription
namestringThe name of the account holder.
dateOfBirthstringOptional. The date of birth of the account holder.
Accounts

The accounts array contains the following parameters:

ParameterTypeDescription
namestringThe name of the account.
financialAddressobjectAn object containing the identifier of the account.
accountTypestringThe type of the account. Possible values are checking, savings, credit, card, loan, investment, insurance, other, unknown.
Financial Address

The financialAddress object contains the following parameters:

ParameterTypeDescription
typestringThe type of the financial address. Possible values are iban, bank_code.
ibanobjectAn object containing the IBAN and the account holder name.
bankCodeobjectAn object containing the bank code, the accountNumber and the account holder name.

Example

The result will be sent as a webhook of type data_session_completed. An example result payload for an identity request might look like this:

{
  "type": "data_session_completed",
  "payload": {
    "id": "abcdef1234567890",
    "referenceId": "123456789",
    "status": "complete",
    "data": {
      "bankName": "Example Bank",
      "identity": {
        "name": "John Doe",
        "dateOfBirth": "1980-01-01"
      },
      "accounts": [
        {
          "financialAddress": {
            "type": "iban",
            "iban": {
              "iban": "DE12345678901234567890",
              "accountHolderName": "John Doe"
            }
          },
          "accountType": "checking",
          "name": "Example Account"
        },
        {
          "financialAddress": {
            "type": "bankCode",
            "bankCode": {
              "accountNumber": "1234567890",
              "bankCode": "123456",
              "accountHolderName": "Dohn Joe"
            }
          },
          "accountType": "checking",
          "name": "Example Account"
        }
      ]
    }
  },
  "date": "2023-04-29T11:50:13.176Z"
}