Files
matrix_synapse/commands.md

2.7 KiB

After issuing this command you will be prompted for the password and if the user should be admin:
register_new_matrix_user http://localhost:8008 -c /data/homeserver.yaml -u <USERNAME>

Query user information:
curl -X GET -H "Authorization: Bearer <ADMINTOKEN>" http://localhost:8008/_synapse/admin/v1/whois/@<USERNAME>:<HOMESERVER>

Query user account information:
curl -X GET -H "Authorization: Bearer <ADMINTOKEN>" http://localhost:8008/_synapse/admin/v2/users/@<USERNAME>:<HOMESERVER>

Reset password (don't forget to escape \ with \\ and " with \" in the password string):
curl -X PUT -H "Authorization: Bearer <ADMINTOKEN>" -H "Content-Type: application/json" -d '{ "password": "<NEWPASSWORD>", "logout_devices": true }' http://localhost:8008/_synapse/admin/v2/users/@<USERNAME>:<HOMESERVER>

Deactivate a user:
curl -X PUT -H "Authorization: Bearer <ADMINTOKEN>" -H "Content-Type: application/json" -d '{ "deactivated": "true" }' http://localhost:8008/_synapse/admin/v2/users/@<USERNAME>:<HOMESERVER>

Erase a user:
curl -X POST -H "Authorization: Bearer <ADMINTOKEN>" -H "Content-Type: application/json" -d '{ "erase": true }' http://localhost:8008/_synapse/admin/v1/deactivate/@<USERNAME>:<HOMESERVER>

Reactivate user: curl --header "Authorization: Bearer " -XPUT -d '{"deactivated": false, "password": ""}' http://localhost:8008/_synapse/admin/v2/users/@:`

Query uploaded media from user:
curl -X GET -H "Authorization: Bearer <ADMINTOKEN>" http://localhost:8008/_synapse/admin/v1/users/@<USERNAME>:<HOMESERVER>/media

Delete uploaded media from user:
curl -X DELETE -H "Authorization: Bearer <ADMINTOKEN>" http://localhost:8008/_synapse/admin/v1/users/@<USERNAME>:<HOMESERVER>/media

OICD migration:

Get user account information from existing user (save it):
curl -X GET -H "Authorization: Bearer <ADMINTOKEN>" http://localhost:8008/_synapse/admin/v2/users/@<USERNAME>:<HOMESERVER>

Login with OICD and get information from newly created user (save the external_ids block):
curl -X GET -H "Authorization: Bearer <ADMINTOKEN>" http://localhost:8008/_synapse/admin/v2/users/@<USERNAME>:<HOMESERVER>

Erase OICD user with:
curl -X POST -H "Authorization: Bearer <ADMINTOKEN>" -H "Content-Type: application/json" -d '{ "erase": true }' http://localhost:8008/_synapse/admin/v1/deactivate/@<USERNAME>:<HOMESERVER>

Insert the external_ids from the OICD into the account infromation from the existing user:
curl -X PUT -H "Authorization: Bearer <ADMINTOKEN>" -H "Content-Type: application/json" -d '<MODIFIED_ACCOUNT_INFORMATION>' http://localhost:8008/_synapse/admin/v2/users/@<USERNAME>:<HOMESERVER>