v1

latestOpenAPI 3.0.3Proprietary2026-07-26162247330.6 KB
Branch

List branches

Retrieves a list of branches for the specified project.

Each Neon project has a root branch named main. A branch_id value has a br- prefix. A project may contain child branches that were branched from main or from another branch. A parent branch is identified by the parent_id value, which is the id of the parent branch. For related information, see Manage branches.

get/projects/{project_id}/branches

Query parameters

searchstring

Search by branch name or id. You can specify partial name or id values to filter results.

sort_by'name' | 'created_at' | 'updated_at'

Sort the branches by sort_field. If not provided, branches will be sorted by updated_at descending order

cursorstring

A cursor to use in pagination. A cursor defines your place in the data list. Include response.pagination.next in subsequent API calls to fetch next page of the list.

sort_order'asc' | 'desc'

Defines the sorting order of entities.

limitinteger

The maximum number of records to be returned in the response

include_deletedboolean

If true, return recoverable deleted branches too (soft-deleted within the recovery window). If false or not provided, return only active (non-deleted) branches.

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

Response

Returned a list of branches for the specified project

annotationsobject required

Example response

{
  "branches": [
    {
      "id": "br-wispy-meadow-118737",
      "project_id": "spring-example-302709",
      "parent_id": "br-aged-salad-637688",
      "parent_lsn": "0/1DE2850",
      "name": "dev2",
      "protected": false,
      "current_state": "ready",
      "state_changed_at": "2022-11-30T20:09:48Z",
      "creation_source": "console",
      "created_at": "2022-11-30T19:09:48Z",
      "updated_at": "2022-12-01T19:53:05Z",
      "default": true,
      "init_source": "parent-data",
      "data_transfer_bytes": 72911987,
      "written_data_bytes": 542998300,
      "compute_time_seconds": 823880990,
      "active_time_seconds": 922200,
      "cpu_used_sec": 461100
    }
  ]
}