Delete a branch

POST /Platform/entities/delete-branch

Delete a branch. This deletes a BRANCH, not an entity. Dry-run by default.

This is the cleanup path for abandoned branches. It is deliberately named apart from delete, which soft-deletes entities — confusing the two against live data is destructive.

What it removes: the branch's entity_branches pointers, plus the branch_metadata row when the delete is unscoped (no entity_types/ids). Both are needed for the branch to actually disappear from branch listings. Commits themselves are NOT deleted — they stay in the entity tables like unreferenced git objects — so nothing reachable from main can be lost here.

Safety: dry_run defaults to True, so a bare call only ever previews. An unscoped real delete additionally requires confirm=true. main can never be deleted. Requires org admin, except for your own draft: a branch named <handle>/..., where the handle is your email's local part in lowercase with every run of other characters turned into -. A branch that is the source or target of an unresolved changeset is refused: abandon or merge the changeset first.

An unscoped delete removes the whole branch, including entities you cannot read. Those are counted in hidden_count (and in deleted) but never listed.

Body parameters

Returns

DeleteBranchResponse

Example request

curl -X POST "https://api.hilus.ai/Platform/entities/delete-branch" \
  -H "Authorization: Bearer $HILUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'