> ## Documentation Index
> Fetch the complete documentation index at: https://code.storage/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# listBranches()

> List all branches in the repository with pagination support.

<CodeGroup>
  ```typescript TypeScript theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
  // List all branches
  const branches = await repo.listBranches();
  console.log(branches.branches); // Array of branch info

  // With pagination
  const page = await repo.listBranches({
    limit: 10,
    cursor: branches.nextCursor,
  });

  // List branches in the ephemeral namespace
  const previews = await repo.listBranches({ ephemeral: true });
  ```

  ```python Python theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
  branches = await repo.list_branches(limit=10)
  print(branches["branches"])

  # Use pagination cursor for the next page
  next_page = await repo.list_branches(
      limit=10,
      cursor=branches.get("next_cursor"),
  )

  # List branches in the ephemeral namespace
  previews = await repo.list_branches(ephemeral=True)
  ```

  ```go Go theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
  // List branches with pagination
  branches, err := repo.ListBranches(context.Background(), storage.ListBranchesOptions{Limit: 10})
  fmt.Println(branches.Branches)

  nextPage, err := repo.ListBranches(context.Background(), storage.ListBranchesOptions{
  	Limit:  10,
  	Cursor: branches.NextCursor,
  })

  // List branches in the ephemeral namespace
  ephemeral := true
  previews, err := repo.ListBranches(context.Background(), storage.ListBranchesOptions{
  	Ephemeral: &ephemeral,
  })
  ```
</CodeGroup>

## Options

<ParamField path="limit" type="string">
  Maximum branches per page
</ParamField>

<ParamField path="cursor" type="string">
  Pagination cursor from a previous response
</ParamField>

<ParamField path="ephemeral" type="boolean">
  List branches from the ephemeral namespace instead of the persistent one (default: `false`)
</ParamField>

## Response

<ResponseField name="branches" type="array">
  List of branch info objects
</ResponseField>

<ResponseField name="nextCursor" type="string">
  Cursor for the next page (absent when no more results)
</ResponseField>
