How are duplicate accounts created?
If a user returns to Link and user tokens are not utilized correctly, the API does not recognize the previously connected user and creates a new, duplicate user. This duplicate user is then able to connect their account(s) again, leading to account duplication. The data is identical in the duplicate accounts but they are treated as separate connected accounts, as Argyle treats all accounts agnostically.The user token is a necessary tool to prevent duplicate account connections. User tokens are temporary access keys that allow you to take users to the correct spot within the Argyle flow. Whenever you initialize Argyle Link, you must utilize user tokens in the Link configuration.
/duplicates endpoint will help you identify these duplicate accounts, enabling you to decide which user or account to delete.
Identify existing duplicate accounts
Use this request to discover duplicate user accounts based on an account ID: GEThttp://api.argyle.com/v1/accounts/{id}/duplicates
If duplicates are found, the endpoint returns the list of duplicate account IDs and the user IDs associated with them.
Call the duplicates endpoint
You can call this endpoint when theaccounts.added webhook is triggered to immediately discover whether the account that was added is a duplicate or not.
You can also use the /duplicates endpoint to check already existing accounts.
Delete duplicate accounts
To delete duplicate accounts:- Use the
onAccountCreatedcallback to notify your backend about a new account. - Call the GET
/accounts/{id}/duplicatesendpoint. This endpoint returns all the duplicate accounts. - Delete the duplicate account using one of the following endpoints:
- DELETE
/accounts/{id}to delete a specific account. - DELETE
/users/{id}to delete a user and its connected data.