> ## Documentation Index
> Fetch the complete documentation index at: https://bunnynet-cb9733c2-add-address-verification-note.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Cleanup unconfigured resolutions

> 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.



## OpenAPI

````yaml https://video.bunnycdn.com/openapi/bunnynet-video-api.public.json post /library/{libraryId}/videos/{videoId}/resolutions/cleanup
openapi: 3.0.0
info:
  title: Stream API
  termsOfService: https://bunny.net/tos
  contact:
    name: bunny.net
    url: https://docs.bunny.net
    email: support@bunny.net
  version: 1.6.1
servers:
  - url: https://video.bunnycdn.com
security: []
tags:
  - name: Manage Collections
  - name: Manage Videos
paths:
  /library/{libraryId}/videos/{videoId}/resolutions/cleanup:
    post:
      tags:
        - Manage Videos
      summary: Cleanup unconfigured resolutions
      description: >-
        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.
      operationId: Video_DeleteResolutions
      parameters:
        - name: libraryId
          in: path
          required: true
          description: The ID of the video library.
          schema:
            type: integer
            format: int64
          x-position: 1
        - name: videoId
          in: path
          required: true
          description: The GUID of the video.
          schema:
            type: string
          x-position: 2
        - name: resolutionsToDelete
          in: query
          description: >-
            Comma-separated list of specific resolutions to delete (e.g.
            "720p,480p"), instead of relying on
            deleteNonConfiguredResolutions/allResolutions.
          schema:
            type: string
            nullable: true
          x-position: 3
        - name: deleteNonConfiguredResolutions
          in: query
          description: >-
            If set to true, all resolutions not currently configured for the
            library will be deleted.
          schema:
            type: boolean
            default: false
          x-position: 4
        - name: allResolutions
          in: query
          description: >-
            If set to true, all resolutions for the video will be deleted,
            regardless of library configuration. When targeting HLS resolutions
            (the default, or outputs=all), at least one resolution must remain
            after cleanup or the request is rejected — scope outputs to mp4 to
            remove every rendition.
          schema:
            type: boolean
            default: false
          x-position: 5
        - name: deleteOriginal
          in: query
          description: >-
            If set to true, the original source file is deleted as well. Note:
            the original is also deleted when the library has 'keep original
            files' disabled, regardless of this flag.
          schema:
            type: boolean
            default: false
          x-position: 6
        - name: outputs
          in: query
          description: 'Outputs to clean. Supported values: hls, mp4, all'
          schema:
            type: string
            nullable: true
          x-position: 7
        - name: deleteMp4Files
          in: query
          description: >-
            If set to true, MP4 fallback files for the deleted resolutions are
            removed too.
          schema:
            type: boolean
            default: false
          x-position: 8
        - name: dryRun
          in: query
          description: >-
            If set to true, no actual file manipulation will happen, only
            informational data will be returned
          schema:
            type: boolean
            default: false
          x-position: 9
      responses:
        '200':
          description: The resolutions were successfully deleted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusModelOfResolutionsCleanupModel'
        '400':
          description: >-
            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.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusModelOfResolutionsCleanupModel'
        '401':
          description: The request authentication failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusModel'
        '403':
          description: The request authorization failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusModel'
        '404':
          description: The requested video was not found
        '500':
          description: Internal Server Error
      security:
        - AccessKey: []
components:
  schemas:
    StatusModelOfResolutionsCleanupModel:
      allOf:
        - $ref: '#/components/schemas/StatusModel'
        - type: object
          additionalProperties: false
          properties:
            data:
              description: >-
                The response payload. Some endpoints also populate this with
                error details when Success is false — see the endpoint's own
                response documentation.
              nullable: true
              oneOf:
                - $ref: '#/components/schemas/ResolutionsCleanupModel'
    StatusModel:
      type: object
      additionalProperties: false
      properties:
        success:
          type: boolean
          description: Determines if the request was successful
        message:
          type: string
          description: >-
            Human-readable message describing the result, typically populated
            with error details when Success is false.
          nullable: true
        statusCode:
          type: integer
          description: The HTTP status code corresponding to the result of the request.
          format: int32
    ResolutionsCleanupModel:
      type: object
      additionalProperties: false
      properties:
        videoId:
          type: string
          description: The GUID of the video.
          nullable: true
        videoLibraryId:
          type: integer
          description: The ID of the video library.
          format: int64
        resolutionsToDelete:
          type: array
          description: >-
            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.
          nullable: true
          items:
            type: string
        resolutionsToDeleteFromPlaylist:
          type: array
          description: >-
            Resolutions selected for removal from the HLS master playlist.
            Populated even when dryRun is true.
          nullable: true
          items:
            type: string
        resolutionsToDeleteFromStorage:
          type: array
          description: >-
            Resolutions selected for removal from object storage. Populated even
            when dryRun is true or an individual deletion fails.
          nullable: true
          items:
            type: string
        resolutionsToDeleteFromMp4:
          type: array
          description: >-
            Resolutions selected for removal from the MP4 fallback set.
            Populated even when dryRun is true.
          nullable: true
          items:
            type: string
        storageObjectsToDelete:
          type: array
          description: >-
            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.
          nullable: true
          items:
            type: string
        availableResolutionsAfter:
          type: array
          description: The video's available resolutions after this cleanup.
          nullable: true
          items:
            type: string
        updatedAvailableResolutions:
          type: boolean
          description: >-
            Whether the video's AvailableResolutions field was rewritten as part
            of this cleanup.
        modifiedPlaylist:
          type: boolean
          description: >-
            Whether the HLS master playlist was rewritten to remove the deleted
            resolutions.
        deletedStorageObjects:
          type: boolean
          description: >-
            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:
          type: boolean
          description: >-
            Whether the original uploaded source file was deleted from storage
            as part of this operation.
  securitySchemes:
    AccessKey:
      type: apiKey
      description: AccessKey based authentication
      name: AccessKey
      in: header

````