Delete a branch
Data Model
Delete a branch
DELETE
Delete a branch
Deletes the branch and its git ref — the API-side counterpart of pruning a branch in Cube Cloud, for callers that create branches per run (a CI job syncing dbt on every pull request, say) and would otherwise accumulate them forever. Child branches are re-parented onto the deleted branch’s own parent, and anyone viewing the branch in dev mode is moved back to the default branch, so a branch that is currently open is deleted rather than refused. The deploy branch cannot be deleted (400) and an unknown branch is a 404.
removeOnUpstream=true additionally deletes the branch on the connected git provider (GitHub/GitLab). It defaults to false, so by default the branch is removed from Cube Cloud only and the ref on your own remote is left alone — a CI job cleaning up branches it created itself should opt in explicitly.
branchName is a query parameter rather than a path segment because branch names contain slashes (dbt-sync/main-20260817120000-a1b2c3d4).