Update a membership
You can update the permissions for an existing account membership, as well as the account member's personal information, with the API. Updating a membership requires consent from the account member, and you must use a user access token. If you use Swan's Web Banking interface, your users can also update account memberships from their Web Banking accounts.
Prerequisites
- You have the
canManageAccountMembershippermission. - The account membership status isn't
ConsentPendingorDisabled. - You're not updating the legal representative's membership (unless you're the legal representative).
- If you're granting a permission to another account member, you have that permission already. You can't grant permissions you don't have.
Guide​
- Call the
updateAccountMembershipmutation. - Add the account membership ID and your redirect URL.
- Add any information or permissions you'd like to update (lines 5-13).
- Add the success payload with the
consentUrl(line 19). - Add rejections (not shown).
- Get the
consentUrlfrom the payload and send it to the account member updating the membership. Their consent finalizes the update.
Mutation​
Open in API Explorermutation UpdateMembership {
updateAccountMembership(
input: {
accountMembershipId: "$MEMBERSHIP_ID"
canViewAccount: true
canManageAccountMembership: true
canManageBeneficiaries: true
canManageCards: true
canInitiatePayments: true
consentRedirectUrl: "$REDIRECT_URL"
email: "$MEMBER_EMAIL"
taxIdentificationNumber: "$MEMBER_TAX_ID"
language: en
}
) {
... on UpdateAccountMembershipSuccessPayload {
__typename
consent {
consentUrl
}
}
}
}
Payload​
The eligible account member updating the membership must consent to the operation with the consentUrl (line 6).
Payload
{
"data": {
"updateAccountMembership": {
"__typename": "UpdateAccountMembershipSuccessPayload",
"consent": {
"consentUrl": "https://identity.swan.io/consent?consentId=$YOUR_CONSENT_ID&env=Sandbox"
}
}
}
}