Skip to main content

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

  1. Call the closeAccount mutation with the legal representative's user access token.
  2. The API returns a consentUrl.
  3. Send the consentUrl to the account's legal representative so they can complete Strong Customer Authentication.
  4. 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 Explorer
mutation 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"
}
}
}
}