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.
Synapse generates 24 character media IDs for content uploaded by local users.
These media IDs consist of upper and lowercase letters and are case-sensitive.
Other homeserver implementations may generate media IDs differently.
Local media is recorded in the local_media_repository table, which includes
metadata such as MIME types, upload times and file sizes.
Note that this table is shared by the URL cache, which has a different media ID
scheme.
When media from a remote homeserver is requested from Synapse, it is assigned
a local filesystem_id, with the same format as locally-generated media IDs,
as described above.
A record of remote media is stored in the remote_media_cache table, which
can be used to map remote MXC URIs (server names and media IDs) to local
filesystem_ids.
When generating previews for URLs, Synapse may download and cache various
resources, including images. These resources are assigned temporary media IDs
of the form yyyy-mm-dd_aaaaaaaaaaaaaaaa, where yyyy-mm-dd is the current
date and aaaaaaaaaaaaaaaa is a random sequence of 16 case-sensitive letters.
The metadata for these cached resources is stored in the
local_media_repository and local_media_repository_url_cache tables.
Resources for URL previews are deleted after a few days.