Ability to delete a single file from Bitbucket via REST API

XMLWordPrintable

    • Type: Suggestion
    • Resolution: Unresolved
    • None
    • Component/s: API - REST
    • None

      Currently, the Bitbucket REST API provides endpoints for retrieving and updating repository files, but it lacks a straightforward method to delete a file from a repository. This limitation requires developers to use workarounds such as local cloning or pushing commits manually, which is inefficient for automation and integration use cases.

      Automated workflows like large scale changes rely on programmatic repository maintenance, including creating, updating, and removing files as part of CI/CD and deployment cleanup processes. Without an API method for file deletion, these operations cannot be fully automated within a managed service or script environment.

       

      Component:
      Bitbucket Cloud REST API

      Proposed Solution:
      Introduce a REST API endpoint that supports file deletion by specifying:

      • Repository identifier (project_key, repo_slug, branch)
      • File path within the repository
      • Target branch or commit reference
      • Commit message

      Example:
      DELETE /rest/api/2.0/projects/{project_key}/repos/{repository_slug}/{branch}/files/{filepath}"

       

      Expected Behavior:

      • The API should remove the specified file from the target branch.
      • Optional parameters may include commit message, author, and branch reference for traceability and audit compliance.
      • The response should return a standard confirmation (e.g., 204 No Content or JSON response with commit information).

      Benefits:

      • Enables complete repository automation workflows.
      • Reduces dependence on manual Git operations.
      • Aligns API capabilities more closely with common Git actions.

            Assignee:
            Unassigned
            Reporter:
            Lenin Vladimir
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: