Audience:
Developers
Send a link to close an account using the API
Generate a closure consent link with the API and send it to the account's legal representative.
Prerequisites
You need the legal representative's user access token.
Suspended accounts
Only Swan can act on Suspended accounts. If the account status is Suspended, you can't initiate closure.
Guide
- Call the
closeAccountmutation with the legal representative's user access token. - The API returns a
consentUrl. - Send the
consentUrlto the account's legal representative so they can complete Strong Customer Authentication. - As soon as the legal representative consents, the account status changes to
Closing.
Account statuses
Refer to the account statuses section for an overview of what happens while an account is Closing.
Consider subscribing to the Account.Closing and Account.Closed webhooks to be notified when the account status changes.
Mutation
The example below shows the success payload only; the Explorer link also includes the rejection fragments.
Open in API Explorermutation closeAccount {
closeAccount(
input: {
accountId: "$YOUR_ACCOUNT_ID"
reason: { type: ClosingRequested }
consentRedirectUrl: "$YOUR_REDIRECT_URL"
}
) {
... on CloseAccountSuccessPayload {
__typename
consent {
consentUrl
}
}
}
}
Payload
{
"data": {
"closeAccount": {
"__typename": "CloseAccountSuccessPayload",
"consent": {
"consentUrl": "https://identity.swan.io/consent?consentId=$YOUR_CONSENT_ID&env=Sandbox"
}
}
}
}
Also available
Send a link to close an accountFrom the Dashboard