This documentation site is for the versions of Synapse maintained by the Matrix.org Foundation (github.com/matrix-org/synapse), available under the Apache 2.0 licence.
This API quarantines all local and remote media in a room.
Request:
POST /_synapse/admin/v1/room/<room_id>/media/quarantine
{}
Where room_id is in the form of !roomid12345:example.org.
Response:
{
"num_quarantined": 10
}
The following fields are returned in the JSON response body:
num_quarantined: integer - The number of media items successfully quarantined
Note that there is a legacy endpoint, POST /_synapse/admin/v1/quarantine_media/<room_id>, that operates the same.
However, it is deprecated and may be removed in a future release.
This API quarantines all local media that a local user has uploaded. That is to say, if
you would like to quarantine media uploaded by a user on a remote homeserver, you should
instead use one of the other APIs.
Request:
POST /_synapse/admin/v1/user/<user_id>/media/quarantine
{}
URL Parameters
user_id: string - User ID in the form of @bob:example.org
Response:
{
"num_quarantined": 10
}
The following fields are returned in the JSON response body:
num_quarantined: integer - The number of media items successfully quarantined
This API protects a single piece of local media from being quarantined using the
above APIs. This is useful for sticker packs and other shared media which you do
not want to get quarantined, especially when
quarantining media in a room.
Request:
POST /_synapse/admin/v1/media/protect/<media_id>
{}
This API deletes the local media from the disk of your own server.
This includes any local thumbnails and copies of media downloaded from
remote homeservers.
This API will not affect media that has been uploaded to external
media repositories (e.g https://github.com/turt2live/matrix-media-repo/).
See also Purge Remote Media API.
POST /_synapse/admin/v1/media/delete?before_ts=<before_ts>
{}
Deprecated in Synapse v1.78.0: This API is available at the deprecated endpoint:
POST /_synapse/admin/v1/media/<server_name>/delete?before_ts=<before_ts>
{}
URL Parameters
server_name: string - The name of your local server (e.g matrix.org). Deprecated in Synapse v1.78.0.
before_ts: string representing a positive integer - Unix timestamp in milliseconds.
Files that were last used before this timestamp will be deleted. It is the timestamp of
last access, not the timestamp when the file was created.
size_gt: Optional - string representing a positive integer - Size of the media in bytes.
Files that are larger will be deleted. Defaults to 0.
keep_profiles: Optional - string representing a boolean - Switch to also delete files
that are still used in image data (e.g user profile, room avatar).
If false these files will be deleted. Defaults to true.
The purge remote media API allows server admins to purge old cached remote media.
The API is:
POST /_synapse/admin/v1/purge_media_cache?before_ts=<unix_timestamp_in_ms>
{}
URL Parameters
before_ts: string representing a positive integer - Unix timestamp in milliseconds.
All cached media that was last accessed before this timestamp will be removed.
Response:
{
"deleted": 10
}
The following fields are returned in the JSON response body:
deleted: integer - The number of media items successfully deleted
If the user re-requests purged remote media, synapse will re-request the media
from the originating server.