Delete user permanently

I’m trying to delete user permanently:
https://www.cometchat.com/docs/chat-apis/ref#delete-user
but looks like it just deactivate it.

Moreover, I’m using the /users/${user.id} rest api but I’m getting deactivatedUids array in the response and not “success” as described in the docs

Hi @shem,

You would need to pass "permanent":true body parameter in the request to permanently delete the user. The sample response shown in the docs is permanent deletion of user.

If you don’t pass "permanent":true body parameter then that user would be deactivated.
That is why you’re getting the deactivatedUids array in the response.

Thanks

did this, it ignores the flag
see in the docs that even without the flag it shouldn’t return the “deactivatedUids” field

Hi @shem, The API is working as expected, If you pass "permanent":true in the body it will provide the response as mentioned in the docs and will permanently delete the user.

{
“data”: {
“success”: true,
“message”: “User with UID superhero1 has been deleted successfully.”
}
}

If that body parameter isn’t passed then it would simply deactivate that user and the response would have deactivatedUids array.
If you’re still facing difficulties, please share the cURL request with us.

Thanks

➜ playQuests git:(feat/CU-2hjqy80-automatic-test) ✗ curl --request DELETE \ --url https://2085398112bcca4d.api-eu.cometchat.io/v3/users/627250ceb06df43cdc61454b
–header “apiKey: *****”
–data ‘{
“permanent”: “true”
}’
{“data”:{“deactivatedUids”:[“627250ceb06df43cdc61454b”]}}%

ok, looks like the problem was that I’m missing --header "Content-Type: application/json" --header "Accept: application/json"

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.