Skip to main content
The Maintenance API exposes three housekeeping operations for ErsatzTV Legacy. These endpoints can be called manually or integrated into a scheduled task to keep memory usage low, remove deleted media permanently, and clean up orphaned artwork files that accumulate over time.

GET /api/maintenance/gc

Triggers the .NET garbage collector to release unused memory. Under normal operation ErsatzTV manages its own memory lifecycle, but this endpoint is useful when you need to reclaim memory immediately — for example, after ingesting a large batch of new media.
boolean
default:"false"
When true, issues a more aggressive, compacting garbage collection pass. When false (default), performs a standard generational collection.

Responses

The forced GC (force=true) invokes a blocking, compacting collection that frees the most memory but also briefly pauses the process. Use it sparingly and prefer the default unless you have a specific reason to compact the heap.

POST /api/maintenance/empty_trash

Permanently deletes all media items that have been placed in the ErsatzTV trash. Items in the trash are media that ErsatzTV has detected as missing from disk and marked for removal. This operation is irreversible — trashed items are removed from the database permanently. This endpoint accepts no parameters.

Responses

Emptying the trash is permanent and cannot be undone. If media files later become accessible again (e.g. a drive is remounted), ErsatzTV will re-discover them on the next library scan, but any custom schedule associations with deleted items will be lost.

POST /api/maintenance/clean_artwork

Queues a background job to delete orphaned artwork files from the artwork cache. Artwork becomes orphaned when the media item it was associated with is removed or when its artwork URL changes. Over time this can consume significant disk space.
integer
default:"100000"
The maximum number of orphaned artwork records to delete in this operation. Reduce this value to rate-limit the cleanup job on systems with limited I/O resources.

Responses

Like library scans, the artwork cleanup runs asynchronously in the background worker. The 200 OK response confirms the job was queued, not that cleanup is complete.