You can disconnect users from providers in your custom UI using Terra's API or by enabling disconnect functionality in the widget.
API Method (Recommended for Custom UI)
Use the DELETE /auth/deauthenticateUser endpoint:
- Endpoint:
/auth/deauthenticateUser
- Method: DELETE
- Required parameter:
user_id
(as query parameter)
- Purpose: Programmatically disconnect a user from their provider
Implementation Steps:
- Disconnect: Call the deauthenticate endpoint with the specific
user_id
you want to disconnect
- Handle Response: The API will return confirmation of disconnection
- Event Handling: You'll receive a
deauth
event via your webhook when disconnection is successful
Alternative Widget Method
If you prefer using the widget with disconnect functionality:
- Add
show_disconnect: true
as a body parameter when generating a widget session
- Users will see a "disconnect" button next to their connected devices
- This method links devices by
reference_id
(ensure you pass that parameter)
The API method gives you full control for building custom UI experiences, while the widget method provides a ready-made solution with disconnect capabilities.