Use the API to close an account
If the account's legal representative requests account closure, start the process with the API.
Only Swan can act on Suspended accounts.
If the status is Suspended, you can't use the API to close the account.
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.
Refer to the account statuses section for an overview of what happens while an account is Closing.
Mutation​
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"
}
}
}
}