---
title: "Cleanup Orphaned Media"
method: POST
path: "/v2/internal/cleanup-orphaned-media"
tags: ["v2 - Internal"]
---

# Cleanup Orphaned Media

`POST /v2/internal/cleanup-orphaned-media`

## Request

- Base URL: `https://api.jubjubapp.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.jubjubapp.com/v2/internal/cleanup-orphaned-media`
- Auth: HTTP bearer

Delete media records stuck in 'uploading' status for longer than threshold.

These are uploads that were started but never completed (user cancelled,
browser closed, network error, etc). The frontend only clears local state,
leaving orphaned records in Firestore and partial files in GCS.

Called by Cloud Scheduler (e.g. every hour) or manually.

## Query parameters

- `threshold_hours` integer
- `batch_size` integer

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/jubjubapp/apis/jubjub-api.md) - [All operations](https://skmtc.dev/jubjubapp/apis/jubjub-api/llms.txt) - [OpenAPI document](https://skmtc.dev/jubjubapp/apis/jubjub-api/revisions/353157b296f2?raw)
