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. You can also update the membership to fix user binding errors.
If you use Swan's Web Banking interface, your users can also update account memberships from their Web Banking accounts.
Prerequisites
- You have the
canManageAccountMembership
permission. - The account membership status isn't
ConsentPending
orDisabled
. - You're not updating the legal representative's membership (unless you are 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.
Update a membership​
- Call the
updateAccountMembership
mutation. - 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
consentUrl
from the payload and send it to the user updating the account membership. Their consent finalizes the update.
🔎 Open the mutation in API Explorer
mutation 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
{
"data": {
"updateAccountMembership": {
"__typename": "UpdateAccountMembershipSuccessPayload",
"consent": {
"consentUrl": "https://identity.swan.io/consent?consentId=$YOUR_CONSENT_ID&env=Sandbox"
}
}
}
}
Fix a user binding error​
- Call the
updateAccountMembership
mutation. - Add the
accountMembershipId
and your redirect URL. - Add only the information that caused the user binding error (lines 7-10, 12). Refer to the causes dropdown for precise information.
- Add the success payload with the
consentUrl
. - Add any rejections you'd like (not shown).
- Get the
consentUrl
from the payload and send it to the invited account member. They must consent to finalize the update.
Causes of a user binding error
At least one of the following booleans must be true for an account membership to have a user binding error:
Error | If true | Update |
---|---|---|
firstNameMatchError | There's a mismatch with the first or given name. | Update restrictedTo > firstName . |
lastNameMatchError | There's a mismatch with the last or family name. | Update restrictedTo > lastName . |
birthDateMatchError | There's a mismatch with the birth date. | Update restrictedTo > birthDate . |
mobilePhoneMatchError | There's a mismatch with the phone number. | Update restrictedTo > phoneNumber . |
emailVerifiedMatchError | There's a mismatch with the email, or the user didn't verify their email. | Update email . |
idVerifiedMatchError | The user wasn't assigned the right identification level. | The user needs to complete another identification process. |
🔎 Open the mutation in API Explorer
mutation FixBindingError {
updateAccountMembership(
input: {
accountMembershipId: "$ACCOUNT_MEMBERSHIP_ID"
consentRedirectUrl: "$YOUR_CONSENT_REDIRECT_URL"
restrictedTo: {
birthDate: "$CORRECT_BIRTH_DATE"
firstName: "$CORRECT_FIRST_NAME"
lastName: "$CORRECT_LAST_NAME"
phoneNumber: "$CORRECT_PHONE_NUMBER"
}
email: "$CORRECT_EMAIL"
}
) {
... on UpdateAccountMembershipSuccessPayload {
__typename
consent {
consentUrl
}
}
}
}