Skip to content
Projects

Branch previews

Spin up an isolated preview environment per git branch or pull request, then tear it down when the PR merges.

A branch preview is a throwaway instance of a project tied to a git branch or PR number — useful for reviewing a change against real infrastructure before it reaches production.

Terminal window
curl -X POST https://cloud.backlex.com/api/org/<org>/projects/<project>/branches \
-H "Authorization: Bearer pak_..." \
-H "Content-Type: application/json" \
-d '{"name":"feat-checkout","prNumber":42}'

Creating a branch provisions a preview deployment and writes a deploy record (trigger branch) so it shows up in the project’s deploy history. prNumber is optional — pass it to link the preview to a pull request.

The preview gets its own hostname of the form br-<branch>-<id>.backlex.com, returned as url on the branch record. Read it from the response rather than composing it — the trailing id keeps every preview distinct from other instances. Branch previews are available on Pro and above.

The project’s Branches tab lists active previews. Delete one when its PR merges or closes:

Terminal window
curl -X DELETE \
https://cloud.backlex.com/api/org/<org>/projects/<project>/branches/<id> \
-H "Authorization: Bearer pak_..."

Creating and deleting branch previews requires at least the developer role.