Relinking
Relinking is how an end user repairs a connection that has stopped working: you create a fresh link token for the same end user and open Merge Link again. Merge marks a Linked Account as needing a relink after an end user rotates a password, an admin revokes an OAuth grant or removes a permission Merge needs, or a multi-factor session expires.
Relinking reuses the existing Linked Account. Its id, its end_user_origin_id, its integration, and the account_token you already store all stay the same, so nothing in your database has to change. Merge also keeps serving the data it synced before the connection broke, so your reads carry on working while the account waits, against data that stops updating until the relink is done.
Detect an account that needs relinking
Three signals point at the same accounts, and you can act on any of them.
Send the end user back through Merge Link
Create a link token with the same end_user_origin_id and the same category as the existing Linked Account, then open Merge Link with it exactly as you do for a first-time connection. Passing the account’s integration slug as integration skips the integration picker and takes the end user straight to that integration’s authorization step.
- Reuse the stored
end_user_origin_idexactly. A different value belongs to a different end user, so Merge creates a new Linked Account instead of repairing the existing one, and you end up holding two account tokens for the same connection. - Create the token with the same kind of API key that created the account. A test key against a production Linked Account, or the reverse, is rejected.
You can also deliver a relink as a Magic Link rather than through the embedded component, which is useful when the person who has to re-authorize is an admin who does not use your product day to day.
What happens when the end user finishes
Merge Link takes an account that is in RELINK_NEEDED straight to authorization and skips the Selective Sync and picker screens, so the end user’s existing sync selections survive the relink.
Once the end user completes the flow:
- The Linked Account returns to
COMPLETEand its syncs resume - Every ongoing issue on the account moves to
RESOLVED, and you receive anIssue.resolvedwebhook for each one - The Linked Account linked webhook fires with
"is_relink": trueindata, and its payload still carries anaccount_token, which is the same token you already store
Any completed Linked Account that passes through Merge Link again reports is_relink as true, whether or not Merge had flagged it for relinking. Read the flag as “this is not a new connection” rather than as evidence that the connection had broken.
To learn more about the webhooks named here, see the Merge webhooks guide.