---
title: "Cleanup unconfigured resolutions"
method: POST
path: "/library/{libraryId}/videos/{videoId}/resolutions/cleanup"
tags: ["Manage Videos"]
---

# Cleanup unconfigured resolutions

`POST /library/{libraryId}/videos/{videoId}/resolutions/cleanup`

## Request

- Base URL: `https://video.bunnycdn.com`
- URL: `https://video.bunnycdn.com/library/{libraryId}/videos/{videoId}/resolutions/cleanup`
- Auth: API key in header `AccessKey`
- TypeScript: <https://skmtc.dev/bunny/apis/stream-api/docs/library/:libraryId/videos/:videoId/resolutions/cleanup/post.ts> (a function with typed inputs; its response is checked against the schema)

Deletes stored resolution files that are no longer configured for the library, or the specific resolutions passed in resolutionsToDelete/allResolutions. This cannot be undone. If the library has 'keep original files' turned off, the original source file is also deleted as part of this cleanup even when deleteOriginal is not set.

## Path parameters

- `libraryId` integer, required
- `videoId` string, required

## Query parameters

- `resolutionsToDelete` string, nullable
- `deleteNonConfiguredResolutions` boolean
- `allResolutions` boolean
- `deleteOriginal` boolean
- `outputs` string, nullable
- `deleteMp4Files` boolean
- `dryRun` boolean

## Response `200`

The resolutions were successfully deleted

- StatusModelOfResolutionsCleanupModel
  - `success` boolean: Determines if the request was successful
  - `message` string, nullable: Human-readable message describing the result, typically populated with error details when Success is false.
  - `statusCode` integer: The HTTP status code corresponding to the result of the request.
  - `data` ResolutionsCleanupModel
    - `videoId` string, nullable: The GUID of the video.
    - `videoLibraryId` integer: The ID of the video library.
    - `resolutionsToDelete` string[], nullable: Resolutions selected for removal as part of this cleanup, across the HLS playlist, object storage, and MP4 fallback set. Populated even when dryRun is true or an individual deletion fails — see UpdatedAvailableResolutions/ModifiedPlaylist/DeletedStorageObjects for what was actually changed.
    - `resolutionsToDeleteFromPlaylist` string[], nullable: Resolutions selected for removal from the HLS master playlist. Populated even when dryRun is true.
    - `resolutionsToDeleteFromStorage` string[], nullable: Resolutions selected for removal from object storage. Populated even when dryRun is true or an individual deletion fails.
    - `resolutionsToDeleteFromMp4` string[], nullable: Resolutions selected for removal from the MP4 fallback set. Populated even when dryRun is true.
    - `storageObjectsToDelete` string[], nullable: Storage object paths selected for deletion as part of this cleanup. These are candidates, not confirmations: the list is populated even when dryRun is true or when an individual deletion fails — see DeletedStorageObjects for whether at least one deletion actually succeeded.
    - `availableResolutionsAfter` string[], nullable: The video's available resolutions after this cleanup.
    - `updatedAvailableResolutions` boolean: Whether the video's AvailableResolutions field was rewritten as part of this cleanup.
    - `modifiedPlaylist` boolean: Whether the HLS master playlist was rewritten to remove the deleted resolutions.
    - `deletedStorageObjects` boolean: Whether at least one of the storage objects in StorageObjectsToDelete was actually deleted (always false when dryRun is true). Individual objects can still have failed to delete — their failures are logged and do not clear this flag — so this confirms the cleanup did something, not that it removed everything listed.
    - `deletedOriginal` boolean: Whether the original uploaded source file was deleted from storage as part of this operation.

## Other responses

- `400`: The cleanup was rejected, for example because it would leave the video with no available resolution. Data carries the plan as evaluated up to that point.
- `401`: The request authentication failed
- `403`: The request authorization failed
- `404`: The requested video was not found
- `500`: Internal Server Error

## Changes

- **2026-11-12** `83116184952f`: 1 breaking, 3 warning, 4 info
  - the response's body type changed from `object` to no type for status `200`
  - removed the optional property `message` from the response with the `200` status
  - removed the optional property `statusCode` from the response with the `200` status
  - removed the optional property `success` from the response with the `200` status
  - …4 more

[Operation history](https://skmtc.dev/bunny/apis/stream-api/changes/library/:libraryId/videos/:videoId/resolutions/cleanup/post.md)

---

[API](https://skmtc.dev/bunny/apis/stream-api.md) - [All operations](https://skmtc.dev/bunny/apis/stream-api/llms.txt) - [OpenAPI document](https://skmtc.dev/bunny/apis/stream-api/revisions/83116184952f?raw)
