---
title: How can I use Bitbucket Pipelines with Vercel?
description: Learn how to use Bitbucket Pipelines to deploy to Vercel including support for Bitbucket Data Center.
url: /kb/guide/how-can-i-use-bitbucket-pipelines-with-vercel
canonical_url: "https://vercel.com/kb/guide/how-can-i-use-bitbucket-pipelines-with-vercel"
published: 2025-11-03
last_updated: 2025-11-10
authors: Lee Robinson
related:
  - /docs/deployments/git/vercel-for-bitbucket
  - /docs/concepts/deployments/preview-deployments
  - /docs/concepts/projects/custom-domains
  - /docs/concepts/git/vercel-for-bitbucket
  - /docs/build-output-api/v3
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---
<!-- docsgraph:related -->
## Related pages

> **For AI agents:** Follow these links to understand how this page connects to the rest of the Vercel ecosystem. For the full cross-link map (inbound, outbound, prerequisites, and semantic neighbors), see the .graph.md link below.

- [Git Integrations](https://vercel.com/docs/git?from=related) — Vercel allows for automatic deployments on every branch push and merges onto the production branch of your GitHub, GitLa
- [Bitbucket](https://vercel.com/docs/git/vercel-for-bitbucket?from=related) — ​Vercel for Bitbucket automatically deploys your Bitbucket projects with Vercel, providing Preview Deployment URLs, and
- [GitLab](https://vercel.com/docs/git/vercel-for-gitlab?from=related) — ​Vercel for GitLab automatically deploys your GitLab projects with Vercel, providing Preview Deployment URLs, and automa
- [Deploy from CLI](https://vercel.com/docs/projects/deploy-from-cli?from=related) — Set up and deploy a Vercel project using the CLI, from linking to production.
- [Deployments](https://vercel.com/docs/deployments?from=related) — Learn how to create and manage deployments on Vercel.
- [How can I use GitLab Pipelines with Vercel?](https://vercel.com/kb/guide/how-can-i-use-gitlab-pipelines-with-vercel?from=related) — Learn how to use GitLab Pipelines to deploy to Vercel including support for self-managed GitLab.
- [How can I use CircleCI with Vercel?](https://vercel.com/kb/guide/how-can-i-use-circleci-with-vercel?from=related) — Learn how to use CircleCI to deploy to Vercel with custom CI/CD.
- [Can I use Bitbucket Data Center with Vercel?](https://vercel.com/kb/guide/can-i-use-bitbucket-data-center-with-vercel?from=related) — You can use Bitbucket Data Center and Bitbucket Pipelines to deploy your application to Vercel.
- [How can I use the Vercel CLI for custom workflows?](https://vercel.com/kb/guide/using-vercel-cli-for-custom-workflows?from=related) — You can use the Vercel CLI to deploy any application, including custom git providers and restricted source code.
- [Can you deploy based on tags/releases on Vercel?](https://vercel.com/kb/guide/can-you-deploy-based-on-tags-releases-on-vercel?from=related) — Learn how to deploy based on tags/releases on Vercel.

Full cross-link map for this page: [/kb/guide/how-can-i-use-bitbucket-pipelines-with-vercel.graph.md](/kb/guide/how-can-i-use-bitbucket-pipelines-with-vercel.graph.md)
<!-- /docsgraph:related -->


​[Vercel for Bitbucket](https://vercel.com/docs/deployments/git/vercel-for-bitbucket) automatically deploys your Bitbucket projects with [Vercel](https://vercel.com/), providing [Preview Deployment URLs](https://vercel.com/docs/concepts/deployments/preview-deployments#preview-urls), and automatic [Custom Domain](https://vercel.com/docs/concepts/projects/custom-domains) updates.

For advanced use-cases, you can use Vercel with Bitbucket Pipelines as your CI/CD provider to generate Preview Deployments for every `git` push and deploy to Production when code is merged into the `main` branch.

This approach is useful for developers who want full control over their CI/CD pipeline, as well as Bitbucket Data Center users, who can’t leverage Vercel’s built-in [git integration](https://vercel.com/docs/concepts/git/vercel-for-bitbucket).

You can [view the completed example here](https://github.com/vercel/examples/tree/main/ci-cd/bitbucket-pipelines) or follow this guide to get started.

## Building Your Application

You can build your application locally (or in a Pipeline) without giving Vercel access to the source code through `vercel build`. Vercel automatically detects your frontend framework and generates a `.vercel/output` folder conforming to the [Build Output API specification](https://vercel.com/docs/build-output-api/v3).

`vercel build` allows you to build your project within your own CI setup, whether it be Bitbucket Pipelines or your own in-house CI, and upload _only_ those build artifacts (and not the source code) to Vercel to create a deployment.

## Configuring Bitbucket Pipelines for Vercel

`vercel deploy --prebuilt` skips the build step on Vercel and uploads the previously generated `.vercel/output` folder from the Bitbucket Pipeline.

Let’s create our Pipeline by creating a new file `bitbucket-pipelines.yml`:

```text
image: node:16.16.0
pipelines:
  branches:
    feature/*:
      - step:
          name: Install Vercel CLI, Pull Vercel Environment Information, Build Project Artifacts and Deploy Project Artifacts to Vercel
          script:
            - npm install --global vercel
            - vercel pull --yes --environment=preview --token=$VERCEL_TOKEN
            - vercel build --token=$VERCEL_TOKEN
            - vercel deploy --prebuilt  --token=$VERCEL_TOKEN
    main:
      - step:
          name: Install Vercel CLI, Pull Vercel Environment Information, Build Project Artifacts and Deploy Project Artifacts to Vercel
          script:
            - npm install --global vercel
            - vercel pull --yes --environment=production --token=$VERCEL_TOKEN
            - vercel build --prod --token=$VERCEL_TOKEN
            - vercel deploy --prebuilt --prod --token=$VERCEL_TOKEN
```

This pipeline has two triggers:

- One that creates preview environments on commits to branches prefixed with `feature/`
  
- Another that creates production environments on commits to the `main` branch
  

Finally, let’s add the required values from Vercel as secured environment variables in Bitbucket:

1. Retrieve your [Vercel Access Token](https://vercel.com/guides/how-do-i-use-a-vercel-api-access-token)
   
2. Install the [Vercel CLI](https://vercel.com/cli) and run `vercel login`
   
3. Inside your folder, run `vercel link` to create a new Vercel project
   
4. Inside the generated `.vercel` folder, save the `projectId` and `orgId` from the `project.json`
   
5. Inside Bitbucket, add `VERCEL_TOKEN`, `VERCEL_ORG_ID`, and `VERCEL_PROJECT_ID` as [secured environment variables](https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/).
   

## Deploying Your Vercel Application with Bitbucket Pipelines

Now that your Vercel application is configured with Bitbucket Pipelines, you can try out the workflow:

- Create a new pull request to your Bitbucket repository
  
- Bitbucket Pipelines will recognize the change and use the Vercel CLI to build your application
  
- The Action uploads the build output to Vercel and creates a Preview Deployment
  
- When the pull request is merged, a Production build is created and deployed
  

Every pull request will now automatically have a Preview Deployment attached. If the pull request needs to be rolled back, you can revert and merge the PR and Vercel will start a new Production build back to the old git state.