Matrix


Matrix

Login as admin

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "type": "m.login.password",
    "user": "admin",
    "password": "admin_password"
  }' \
  https://matrix.doesnotexist.club/_matrix/client/v3/login
curl -X POST \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"new_password": "newpassword123", "logout_devices": true}' \
  https://your-matrix-server.com/_synapse/admin/v1/reset_password/@username:your-domain.com

Create user

register_new_matrix_user --config path/to/homeserver.yaml
register_new_matrix_user https://matrix.doesnotexist.club -c data/homeserver.yaml

Purge matrix media content

login as root into your element client to get your api token

# Calculate timestamp for 30 days ago (Linux/Mac)
TIMESTAMP=$(($(date +%s) * 1000 - 30 * 24 * 60 * 60 * 1000))

curl -X POST "https://myserver.club/_synapse/admin/v1/purge_media_cache?before_ts=$TIMESTAMP" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Also delete local media

curl -X POST "https://myserver.club/_synapse/admin/v1/media/myserver.club/delete?before_ts=$TIMESTAMP" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'