1. Generate Admin token#

curl -X POST \
  "https://SERVER/_matrix/client/v3/login" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "m.login.password",
    "user": "USER",
    "password": "PASSWORD"
  }'

Make sure to replace SERVER with the address of your homeserver, replace USER with your FULL username, e.g. @dontddos:matrix.dontddos.me and replace PASSWORD with your password.

This will return something similar to:

{"user_id":"@dontddos:matrix.dontddos.me","access_token":"XYZ","home_server":"matrix.dontddos.me","device_id":"XYZ"}%

Copy the access_token, it will be needed in the next step.

2. Delete the user#

curl -X POST \
  "https://SERVER/_synapse/admin/v1/deactivate/USER_TO_DELTE" \
  -H "Authorization: Bearer ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"erase": true}'

Be sure to replace SERVER, USER_TO_DELETE & ACCESS_TOKEN with the appropriate information.