For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Resources
Get started
ReferenceGuidesExamplesChangelog
ReferenceGuidesExamplesChangelog
  • Designer API
    • Introduction
    • Getting Started
    • Webflow CLI
    • Error Handling
    • App Modes
  • Elements
    • Creating & Retrieving Elements
    • Element Properties & Methods
    • Element Types & Methods
  • Styles
    • Managing Style Properties
    • Managing Variable Modes
  • Components
  • Variables & Collections
    • Variable Collections
    • Variables
    • Variable Modes
  • Assets
  • Pages & Folders
      • Page information
      • Page settings
        • Get branch ID
        • Get parent page ID
        • List branches
  • Utilities
    • User Events & Notifications
    • App Intents & Connections
  • Additional Resources
    • API Playground
    • FAQs
LogoLogo
Resources
Get started
On this page
  • page.listBranches()
  • Syntax
  • Returns
  • Example
  • Designer Ability
Pages & FoldersManaging PagesPage branching

List branches

Was this page helpful?
Previous

Get search title

Next
Built with

page.listBranches()

List all branches that exist for a page.

Each entry in the returned array contains the branch’s page ID and branch ID. Use the page ID with webflow.switchPage() to navigate to a branch.

Syntax

1page.listBranches(): Promise<Array<{pageId: string, branchId: string}>>

Returns

Promise<Array<{pageId: string, branchId: string}>>

A Promise that resolves to an array of objects, one per branch. Each object contains:

PropertyTypeDescription
pageIdstringThe page ID of the branch. Pass this value to webflow.switchPage() to navigate to the branch.
branchIdstringThe branch identifier.

The array is empty when the page has no branches.

Example

1const currentPage = await webflow.getCurrentPage()
2
3const branches = await currentPage.listBranches()
4if (branches.length > 0) {
5 console.log(`Found ${branches.length} branch(es):`)
6 for (const branch of branches) {
7 console.log(` pageId: ${branch.pageId}, branchId: ${branch.branchId}`)
8 }
9
10 // Navigate to the first branch
11 const allPages = await webflow.getAllPagesAndFolders()
12 const branchPage = allPages.find(p => p.id === branches[0].pageId)
13 if (branchPage) {
14 await webflow.switchPage(branchPage)
15 }
16} else {
17 console.log('No branches found for this page.')
18}

Try this example

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny