Skip to main content

Managing users and accounts

Best practices#

it is strongly advised to delete all objects that no longer need to be, so as to be able to free resources. Deleting a user for example will make his email available again and all associated resources will also be deleted.

Delete a user#

You can delete a user by calling the corresponding endpoint '/users/me'. It also removes all connections, accounts and transactions. No data will be kept and cannot be retrieved.

It is also possible to call the endpoint with the user identifier: '/users/{id}'

curl -sk \
https://sandbox-api.oxlin.io/v2.1/admin/users/me] \
-H 'authorization: Bearer ${client_access_token}
# Response
HTTP/1.1 204 User successfully deleted

Delete a connection#

The endpoint delete '/connection/id' allows you to delete a connection and the list of all the accounts associated with this connection. Transactions and information are emptied, all deleted data cannot be retrieved.

curl -sk \
https://sandbox-api.oxlin.io/v2.1/connections/{connection_id}] \
-H 'authorization: Bearer ${client_access_token}
# Response
HTTP/1.1 204 connection successfully deleted

Delete an account#

The first time you create a provider connection for a user, the list of all accounts is added.

In his use of your application, it is possible that the user wishes to remove one of his accounts. When an account is deleted, all associated data is also deleted. In future synchronizations, this account will no longer be updated.

You can delete an account by calling the corresponding endpoint '/accounts/{id}' with the account identifier..

Note that

  • when the last account of a channel is deleted, the channel (and so, the associated credentials) is also deleted (it will appear with status EMPTY in the connection returned by the API).
  • If the channel was the last channel of the connection, the connection is also deleted. This is motivated by GDPR: we don't want to store credentials we don't need to offer the service.
curl -sk \
https://sandbox-api.oxlin.io/v2.1/accounts/{account_id}] \
-H 'authorization: Bearer ${client_access_token}
# Response
HTTP/1.1 204 Account successfully deleted

Restauring a deleted account#

A synchronization allowing to recover the list of accounts available at a provider is not different from a classic synchronization. It is possible to add a deleted account by running a synchronization of type LIST_ACCOUNTS on the connection. Synchronization is done on a particular connection.

The parameter Type=LIST_ACCOUNTS allows you to retrieve the list of financial products linked to this connection. With a synchronization of type LIST_ACCOUNTS, any new account and all the accounts previously deleted will be added automatically. A synchronization of type ALL is started automatically when the LIST_ACCOUNTS synchronization finishes. The final event of the LIST_ACCOUNTS synchronization still contains the account list.

When we're triggering synchronization, an asynchronous job will emit events in the queue. The list of accounts will be available in the LIST_ACCOUNTS_SUCCESS event. A list_accounts_success property will be available with the list of accounts.

These accounts can have 3 different status:

  • MISSING: The account no longer exists on the establishment
  • PRESENT: The account is already associated
  • NEW: The account is not associated with your application and you can therefore add it

Example :

# Trigger the synchronization in LIST_ACCOUNTS mode
curl -X POST \
'https://sandbox-api.oxlin.io/v2.1/connections/{connection_id}/synchronize?type=LIST_ACCOUNTS' \
-H 'authorization: Bearer {access_token}'
# The job will start soon
HTTP/1.1 204 No-Content
# Read the queue to get events until an event has an event_type=LIST_ACCOUNTS_SUCCESS
{
"id": "26",
"event_type": "LIST_ACCOUNTS_SUCCESS",
"resource_type": "CONNECTION",
"channel_definition_id":"embedded1",
"creation_date": 1528106885,
"resource": {
"id": "{connection_id}",
"provider_id": "119",
"name": "HSBC",
"status": "SUCCESS",
"creation_date": 0,
"channels": [
{
"id": "redirect1",
"expires": 1528106353
"status": "SUCCESS",
"last_success_date": 1528105353,
"last_end_date": 1528105353
},
{
"id": "embedded1",
"status": "SUCCESS",
"last_success_date": 1528105353,
"last_end_date": 1528105353
}
]
},
"list_accounts_success": {
"accounts": [
{
"reference": "01518 123456789",
"name": "Compte Bancaire (x6789)",
"currency": "EUR",
"payment_destination": false,
"payment_source": false,
"balance": 1234.56,
"balance_date": 1528106871,
"status": "PRESENT",
"type": "CHECKINGS",
"account_number": "01518 123456789",
"connection_id": "{connection_id}"
},
{
"reference": "01242 987654321",
"name": "Livret Dévelop. Durable (x4321)",
"currency": "EUR",
"payment_destination": false,
"payment_source": false,
"balance": 24.61,
"balance_date": 1528106871,
"status": "NEW",
"type": "SAVINGS",
"account_number": "01242 987654321",
"savings": {
"type": "OTHER"
},
"connection_id": "{connection_id}"
}
]
}
}