Skip to content
FeedbackDashboard

List project branches

projects.branches.list(BranchListParams**kwargs) -> SyncPage[BranchListResponse]
get/v0/projects/{project}/branches

Retrieve a project branch by name.

ParametersExpand Collapse
project: Optional[str]
cursor: Optional[str]

Pagination cursor from a previous response

limit: Optional[float]

Maximum number of items to return, defaults to 10 (maximum: 100).

exclusiveMinimum0
maximum100
ReturnsExpand Collapse
class BranchListResponse:

A project branch names a line of development for a project. Like a Git branch, it points to a Git commit with a set of config files. In addition, a project branch also points to a set of custom code changes, corresponding to Git branches in the staging repos.

branch: str

Branch name

config_commit: ConfigCommit

A Git commit that points to the latest set of config files on a given branch.

repo: ConfigCommitRepo
branch: str
name: str
owner: str
sha: str
latest_build_id: str
object: Literal["project_branch"]
org: str
project: str

Project name

List project branches
import os
from stainless_v0 import Stainless

client = Stainless(
    api_key=os.environ.get("STAINLESS_API_KEY"),  # This is the default and can be omitted
)
page = client.projects.branches.list(
    project="project",
)
page = page.data[0]
print(page.latest_build_id)
{
  "data": [
    {
      "branch": "branch",
      "config_commit": {
        "repo": {
          "branch": "branch",
          "name": "name",
          "owner": "owner"
        },
        "sha": "sha"
      },
      "latest_build_id": "latest_build_id",
      "object": "project_branch",
      "org": "org",
      "project": "project"
    }
  ],
  "has_more": true,
  "next_cursor": "next_cursor"
}
Returns Examples
{
  "data": [
    {
      "branch": "branch",
      "config_commit": {
        "repo": {
          "branch": "branch",
          "name": "name",
          "owner": "owner"
        },
        "sha": "sha"
      },
      "latest_build_id": "latest_build_id",
      "object": "project_branch",
      "org": "org",
      "project": "project"
    }
  ],
  "has_more": true,
  "next_cursor": "next_cursor"
}