REST: Admin, media
Management endpoints. Each operation names the permission it needs: Owner only, a permission such as Manage members, Ban members or Manage channels, or the Administrator permission. Generated from mnema-talk v3.3.13 (cca4f0fdb723).
List all media, newest first
GET /api/admin/media
Owner only (403 otherwise).
Authentication: Session cookie
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
limit | query | integer | no | Page size. Values below 1 or non-numeric fall back to the default; larger values are clamped to 100. |
offset | query | integer | no | Number of items to skip. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | Media page. | DashboardItem[] |
| 401 | No valid session (UNAUTHORIZED): missing, expired or revoked cookie, or the account was disabled. | ErrorResponse |
| 403 | FORBIDDEN: only the Owner may do this. | ErrorResponse |
| 429 | RATE_LIMITED: too many requests. | ErrorResponse |
| 500 | INTERNAL_ERROR: sanitized server failure. | ErrorResponse |
Count orphaned media objects
GET /api/admin/media/orphans
Objects in storage (uploads/, avatars/, banners/, covers/, exports/) that no row refers to (a media row, or for exports/ the row of a data export), older than 24 hours: left behind by a failed delete or a crash during an upload or an export. Nothing shows them; they only take space. Lists the whole bucket prefix, so it may take a while. Owner only (403 otherwise).
Authentication: Session cookie
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | Orphaned objects (deleted is 0). | Orphans |
| 401 | No valid session (UNAUTHORIZED): missing, expired or revoked cookie, or the account was disabled. | ErrorResponse |
| 403 | FORBIDDEN: only the Owner may do this. | ErrorResponse |
| 429 | RATE_LIMITED: too many requests. | ErrorResponse |
| 500 | INTERNAL_ERROR: sanitized server failure. | ErrorResponse |
| 503 | UNAVAILABLE: a dependency (database, file storage) is not available. | ErrorResponse |
Orphans
| Field | Type | Description |
|---|---|---|
bytes (required) | integer | |
count (required) | integer | |
deleted (required) | integer | Deleted is how many were removed (cleanup only). |
Delete orphaned media objects
POST /api/admin/media/orphans/cleanup
Deletes the objects GET /api/admin/media/orphans counts. Never touches an object a media row or the row of a data export refers to, nor one younger than 24 hours. Owner only (403 otherwise).
Authentication: Session cookie
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | Orphaned objects found and deleted. | Orphans |
| 401 | No valid session (UNAUTHORIZED): missing, expired or revoked cookie, or the account was disabled. | ErrorResponse |
| 403 | FORBIDDEN: only the Owner may do this, or cross-origin request rejected. | ErrorResponse |
| 409 | CONFLICT: an online backup is running; nothing was deleted. | ErrorResponse |
| 429 | RATE_LIMITED: too many requests. | ErrorResponse |
| 500 | INTERNAL_ERROR: sanitized server failure. | ErrorResponse |
| 503 | UNAVAILABLE: a dependency (database, file storage) is not available. | ErrorResponse |
Orphans
| Field | Type | Description |
|---|---|---|
bytes (required) | integer | |
count (required) | integer | |
deleted (required) | integer | Deleted is how many were removed (cleanup only). |
Delete old chat attachments
POST /api/admin/media/prune
Avatars are never pruned. Without days, uses MEDIA_RETENTION_DAYS; 400 when that is disabled. When storage refuses some objects the run still succeeds and skipped counts them. Owner only (403 otherwise).
Authentication: Session cookie
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
days | query | integer | no | Delete attachments older than this many days; defaults to MEDIA_RETENTION_DAYS. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | Prune result. skipped counts old objects that storage refused to delete. | PruneResult |
| 400 | Invalid input (INVALID_INPUT): malformed JSON, unknown JSON fields, bad IDs or failed validation. | ErrorResponse |
| 401 | No valid session (UNAUTHORIZED): missing, expired or revoked cookie, or the account was disabled. | ErrorResponse |
| 403 | FORBIDDEN: only the Owner may do this, or cross-origin request rejected. | ErrorResponse |
| 429 | RATE_LIMITED: too many requests. | ErrorResponse |
| 500 | INTERNAL_ERROR: sanitized server failure. | ErrorResponse |
| 503 | UNAVAILABLE: a dependency (database, file storage) is not available. | ErrorResponse |
PruneResult
| Field | Type | Description |
|---|---|---|
cutoff_days (required) | integer | |
pruned_count (required) | integer | |
skipped | integer | Skipped counts the old objects storage refused to delete; they stay. |
Storage totals
GET /api/admin/media/stats
Owner only (403 otherwise).
Authentication: Session cookie
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | Totals. | Stats |
| 401 | No valid session (UNAUTHORIZED): missing, expired or revoked cookie, or the account was disabled. | ErrorResponse |
| 403 | FORBIDDEN: only the Owner may do this. | ErrorResponse |
| 429 | RATE_LIMITED: too many requests. | ErrorResponse |
| 500 | INTERNAL_ERROR: sanitized server failure. | ErrorResponse |
Stats
| Field | Type | Description |
|---|---|---|
deleted_files (required) | integer | |
total_files (required) | integer | |
total_size_bytes (required) | integer |
Delete a media object
DELETE /api/admin/media/{id}
Removes the object from storage and marks it deleted; chat shows a placeholder. Broadcasts message_update for the message the file was attached to. Idempotent. Owner only (403 otherwise).
Authentication: Session cookie
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string (uuid) | yes | Resource ID. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 204 | Success, no content. | |
| 400 | Invalid input (INVALID_INPUT): malformed JSON, unknown JSON fields, bad IDs or failed validation. | ErrorResponse |
| 401 | No valid session (UNAUTHORIZED): missing, expired or revoked cookie, or the account was disabled. | ErrorResponse |
| 403 | FORBIDDEN: only the Owner may do this, or cross-origin request rejected. | ErrorResponse |
| 404 | NOT_FOUND: the resource, or the route, does not exist. | ErrorResponse |
| 429 | RATE_LIMITED: too many requests. | ErrorResponse |
| 500 | INTERNAL_ERROR: sanitized server failure. | ErrorResponse |
| 503 | UNAVAILABLE: a dependency (database, file storage) is not available. | ErrorResponse |