Overview
You are looking for instructions on how to delete accounts using the GraphQL API.
Solution
In order to make the requests through the API, the information below is required. For further details on the API refer to Using the CCAB GraphQL API.
- The Provider ID.
- An Access Token using the credentials from a user with one of the following groups: Account Query, Account Admin, Data Admin
To delete an account, use the deleteAccount operation with the appropriate ID for the account (see Create an Account using the API for further details).
Below is an example payload using API version 10.1:
mutation deleteAccount {
deleteAccount(input: {providerId: "<providerId>", accountId: "<accountId>"}) {
... on DeleteAccountPayload {
deletedAccountId
parentAccount {
id
providerId
}
}
... on AccountNotFound {
providerId
accountId
errorCode
errorMessage
}
... on AccountHasReferences {
providerId
accountId
errorCode
errorMessage
}
... on InvalidProviderLifecycleStage {
providerLifecycleStage
errorCode
errorMessage
}
... on RateLimitExceeded {
retryAfter
errorCode
errorMessage
}
... on InternalServerError {
errorCode
errorMessage
}
}
}
If the account was deleted successfully, a confirmation message will be displayed.
Otherwise, the response will contain details about the error that occurred. Note that accounts can only be deleted if there are no devices underneath them (see Delete Devices using the API for further details on deleting devices).