Delete branch

Deletes the specified branch from a project, and places all compute endpoints into an idle state, breaking existing client connections. You can obtain a project_id by listing the projects for your Neon account. You can obtain a branch_id by listing the project's branches. For related information, see Manage branches.

When a successful response status is received, the compute endpoints are still active, and the branch is not yet deleted from storage. The deletion occurs after all operations finish. You cannot delete a project's root or default branch, and you cannot delete a branch that has a child branch. A project must have at least one branch.

By default, deleted branches can be recovered within a 7-day grace period. Use the hard_delete parameter to permanently delete the branch immediately without a recovery window.

Soft delete and branch recovery are in preview and not available to all users.

Path Params
string
required

The Neon project ID

string
required

The branch ID

Query Params
boolean
Defaults to false

If true, the branch is permanently deleted immediately without a recovery window. If false (default), the branch can be recovered within 7 days via the recover endpoint.

This parameter is part of the Branch Recovery feature, which is in preview and not available to all users.

Responses

204

Returned if the branch doesn't exist or has already been deleted

Language
Credentials
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json