Skip to main content
Branches

Branches are how you can test and version your API and business logic

Xano Support avatar
Written by Xano Support
Updated over a week ago

A Branch is a copy of a workspace's business logic (APIs, Functions, Addons, and Tasks). They are most useful for testing and developing new versions of your app without affecting your customers' primary experience. API Branches are available starting on the Scale plan.

You can create new Branches and select which Branch to make a copy of, choose which Branch to make edits to, and select which Branch you want to be live for your API.

Your initial Branch will be considered v1 of your business logic. Below your workspace name, you will be able to identify which Branch you are currently editing.

Automatically, you will start on v1.

Create a New Branch

Select the Branch identifier located underneath the workspace name.

This will allow you to see and change which Branch you are currently editing and which is live for your users, and allow you to add a new Branch.

View your different Branches, change their state, or add a new Branch.

When you select Add new Branch you will be able to choose a source Branch to make a copy from, the name of your new Branch, and a description.

Adding a new Branch, makes a copy of the source Branch at that given time. So for example, if you create v2 from source Branch v1, you will have all the same business logic (APIs, Functions, Addons, and Tasks). However, if v2 is already created and then you make changes to v1 then these changes will not be reflected in v2.

Change which Branch to Edit and Set Live

The Branch you are currently editing will be identified underneath the workspace name on the left menu column. To change this, click on the Branch nam to open up the menu of the different Branches in your workspace.

Here we can see v1 is being edited and is set live.

Select a Branch you wish to edit or set live and you will have the option to do so.

Edit or Set Live a Branch.

When a Branch is set live, it is the Branch or version of your API endpoints and business logic that will be live for your users.

If you wish to call an API endpoint from a Branch that is not live, you can do so by adding the branch name after the canonical, for example:

If the live branch is:

https://xb17-511e-40b9.xano.io/api:b4afb8/tutorial

You can access a different branch by adding :branch name after the canonical:

https://xb17-511e-40b9.xano.io/api:b4afb8:v2/tutorial

You can also use a Set Http Header function, to set the X-Branch header followed by the Branch name. For example:

X-Branch: v2

Setting this on an API endpoint would force that endpoint to call the v2 Branch version of the endpoint.

Know if the Branch you're editing is Live or not

While making changes in your workspace, you are able to differentiate if your Branch is live or not with the color of the Branch name in the left menu column.

When the Branch name is blue, the Branch is live:

v1 is Live.

If the Branch is yellow, it is not live:

v2 is not live

When editing a Branch that is not live, the Swagger documentation and API Endpoint URL buttons will provide the version of that Branch and not the live Branch.

To get the URL of the live Branch either remove the :branch name after the canonical or go to the live Branch.

Did this answer your question?