Skip to content

Matrix Integration

Endpoints for Matrix chat system integration and management.

Fetch Matrix Credentials

Retrieve Matrix credentials for the authenticated user.

Endpoint

POST /api/auth/matrix/fetch

Response

json
{
  "data": {
    "matrix_user_id": "@user123:matrix.server",
    "matrix_access_token": "syt_dXNlcjEyMw...",
    "matrix_device_id": "DEVICE123",
    "homeserver": "https://matrix.server"
  }
}

Update Matrix Credentials

Update Matrix registration status after successful Matrix setup.

Endpoint

POST /api/auth/matrix/update-credentials

Request

json
{
  "matrix_registered": true,
  "matrix_device_id": "DEVICE123"
}

Response

json
{
  "message": "Matrix credentials updated successfully"
}

Check Matrix Encryption Status

Check the encryption status of the Matrix account.

Endpoint

GET /api/auth/matrix/encryption-status

Response

json
{
  "data": {
    "encryption_enabled": true,
    "cross_signing_ready": true,
    "backup_enabled": false,
    "device_verified": true
  }
}

Update Matrix Profile

Update the user's Matrix profile information.

Endpoint

POST /api/auth/matrix/update-profile

Request

json
{
  "displayname": "John Doe",
  "avatar_url": "mxc://matrix.server/avatar123"
}

Response

json
{
  "message": "Matrix profile updated successfully"
}

Refresh Matrix Session

Refresh the Matrix session token.

Endpoint

POST /api/auth/matrix/refresh-session

Response

json
{
  "data": {
    "matrix_access_token": "syt_new_token...",
    "expires_in": 3600
  }
}

Logout Matrix Device

Logout a specific Matrix device.

Endpoint

POST /api/auth/matrix/logout-device

Request

json
{
  "device_id": "DEVICE123"
}

Response

json
{
  "message": "Device logged out successfully"
}

Force Cleanup Keys

Force cleanup of Matrix encryption keys.

Endpoint

POST /api/auth/matrix/force-cleanup-keys

Response

json
{
  "message": "Keys cleaned up successfully",
  "data": {
    "keys_removed": 5
  }
}

Force Cleanup and Re-login

Force cleanup and re-establish Matrix session.

Endpoint

POST /api/auth/matrix/force-cleanup-and-relogin

Response

json
{
  "message": "Matrix session re-established",
  "data": {
    "matrix_user_id": "@user123:matrix.server",
    "matrix_access_token": "syt_new_token...",
    "matrix_device_id": "NEW_DEVICE123"
  }
}