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
branch: str. Branch to delete.mainis rejected.entity_types: optional str. Only drop pointers for these types (scoped delete — the branch itself survives).ids: optional str. Only drop pointers for these entity ids (scoped delete).dry_run: optional bool. True (default) previews without writing.confirm: optional bool. Required for an unscoped real delete.
Returns
DeleteBranchResponse
branch: optional str or null. The branch.dry_run: optional bool. True when nothing was written; the response is a preview.deleted: optional int. Entities removed from the branch (or that would be).entities: optional List[dict]. The entities removed or previewed: entity_type, entity_id.hidden_count: optional int. Entities removed (or that would be) that you cannot read; counted in deleted, not listed.branch_metadata_removed: optional bool. True when the branch itself is gone (unscoped delete only).code_heads_removed: optional int. Repository heads removed from the branch (or that would be); unscoped delete only.
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 '{}'