Bitbucket Pipelines API

Bitbucket Pipelines brings continuous delivery to Bitbucket Cloud, empowering teams with full branching to deployment visibility and faster feedback loops.

Operations 68

GET /repositories/{workspace}/{repo_slug}/deployments_config/environments/{environment_uuid}/variables List variables for an environment #
POST /repositories/{workspace}/{repo_slug}/deployments_config/environments/{environment_uuid}/variables Create a variable for an environment #
PUT /repositories/{workspace}/{repo_slug}/deployments_config/environments/{environment_uuid}/variables/{variable_uuid} Update a variable for an environment #
DELETE /repositories/{workspace}/{repo_slug}/deployments_config/environments/{environment_uuid}/variables/{variable_uuid} Delete a variable for an environment #
GET /repositories/{workspace}/{repo_slug}/pipelines List pipelines #
POST /repositories/{workspace}/{repo_slug}/pipelines Run a pipeline #
GET /repositories/{workspace}/{repo_slug}/pipelines-config/caches List caches #
DELETE /repositories/{workspace}/{repo_slug}/pipelines-config/caches Delete caches #
DELETE /repositories/{workspace}/{repo_slug}/pipelines-config/caches/{cache_uuid} Delete a cache #
GET /repositories/{workspace}/{repo_slug}/pipelines-config/caches/{cache_uuid}/content-uri Get cache content URI #
GET /repositories/{workspace}/{repo_slug}/pipelines-config/runners Get repository runners #
POST /repositories/{workspace}/{repo_slug}/pipelines-config/runners Create repository runner #
GET /repositories/{workspace}/{repo_slug}/pipelines-config/runners/{runner_uuid} Get repository runner #
PUT /repositories/{workspace}/{repo_slug}/pipelines-config/runners/{runner_uuid} Update repository runner #
DELETE /repositories/{workspace}/{repo_slug}/pipelines-config/runners/{runner_uuid} Delete repository runner #
GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid} Get a pipeline #
GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps List steps for a pipeline #
GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid} Get a step of a pipeline #
GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/log Get log file for a step #
GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/logs/{log_uuid} Get the logs for the build container or a service container for a given step of a pipeline. #
GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/test_reports Get a summary of test reports for a given step of a pipeline. #
GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/test_reports/test_cases Get test cases for a given step of a pipeline. #
GET /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/test_reports/test_cases/{test_case_uuid}/test_case_reasons Get test case reasons (output) for a given test case in a step of a pipeline. #
POST /repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/stopPipeline Stop a pipeline #
GET /repositories/{workspace}/{repo_slug}/pipelines_config Get configuration #
PUT /repositories/{workspace}/{repo_slug}/pipelines_config Update configuration #
PUT /repositories/{workspace}/{repo_slug}/pipelines_config/build_number Update the next build number #
POST /repositories/{workspace}/{repo_slug}/pipelines_config/schedules Create a schedule #
GET /repositories/{workspace}/{repo_slug}/pipelines_config/schedules List schedules #
GET /repositories/{workspace}/{repo_slug}/pipelines_config/schedules/{schedule_uuid} Get a schedule #
PUT /repositories/{workspace}/{repo_slug}/pipelines_config/schedules/{schedule_uuid} Update a schedule #
DELETE /repositories/{workspace}/{repo_slug}/pipelines_config/schedules/{schedule_uuid} Delete a schedule #
GET /repositories/{workspace}/{repo_slug}/pipelines_config/schedules/{schedule_uuid}/executions List executions of a schedule #
GET /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/key_pair Get SSH key pair #
PUT /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/key_pair Update SSH key pair #
DELETE /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/key_pair Delete SSH key pair #
GET /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/known_hosts List known hosts #
POST /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/known_hosts Create a known host #
GET /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/known_hosts/{known_host_uuid} Get a known host #
PUT /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/known_hosts/{known_host_uuid} Update a known host #
DELETE /repositories/{workspace}/{repo_slug}/pipelines_config/ssh/known_hosts/{known_host_uuid} Delete a known host #
GET /repositories/{workspace}/{repo_slug}/pipelines_config/variables List variables for a repository #
POST /repositories/{workspace}/{repo_slug}/pipelines_config/variables Create a variable for a repository #
GET /repositories/{workspace}/{repo_slug}/pipelines_config/variables/{variable_uuid} Get a variable for a repository #
PUT /repositories/{workspace}/{repo_slug}/pipelines_config/variables/{variable_uuid} Update a variable for a repository #
DELETE /repositories/{workspace}/{repo_slug}/pipelines_config/variables/{variable_uuid} Delete a variable for a repository #
GET /teams/{username}/pipelines_config/variables List variables for an account #
POST /teams/{username}/pipelines_config/variables Create a variable for a user #
GET /teams/{username}/pipelines_config/variables/{variable_uuid} Get a variable for a team #
PUT /teams/{username}/pipelines_config/variables/{variable_uuid} Update a variable for a team #
DELETE /teams/{username}/pipelines_config/variables/{variable_uuid} Delete a variable for a team #
GET /users/{selected_user}/pipelines_config/variables List variables for a user #
POST /users/{selected_user}/pipelines_config/variables Create a variable for a user #
GET /users/{selected_user}/pipelines_config/variables/{variable_uuid} Get a variable for a user #
PUT /users/{selected_user}/pipelines_config/variables/{variable_uuid} Update a variable for a user #
DELETE /users/{selected_user}/pipelines_config/variables/{variable_uuid} Delete a variable for a user #
GET /workspaces/{workspace}/pipelines-config/identity/oidc/.well-known/openid-configuration Get OpenID configuration for OIDC in Pipelines #
GET /workspaces/{workspace}/pipelines-config/identity/oidc/keys.json Get keys for OIDC in Pipelines #
GET /workspaces/{workspace}/pipelines-config/runners Get workspace runners #
POST /workspaces/{workspace}/pipelines-config/runners Create workspace runner #
GET /workspaces/{workspace}/pipelines-config/runners/{runner_uuid} Get workspace runner #
PUT /workspaces/{workspace}/pipelines-config/runners/{runner_uuid} Update workspace runner #
DELETE /workspaces/{workspace}/pipelines-config/runners/{runner_uuid} Delete workspace runner #
GET /workspaces/{workspace}/pipelines-config/variables List variables for a workspace #
POST /workspaces/{workspace}/pipelines-config/variables Create a variable for a workspace #
GET /workspaces/{workspace}/pipelines-config/variables/{variable_uuid} Get variable for a workspace #
PUT /workspaces/{workspace}/pipelines-config/variables/{variable_uuid} Update variable for a workspace #
DELETE /workspaces/{workspace}/pipelines-config/variables/{variable_uuid} Delete a variable for a workspace #

Documentation

Specifications

Schemas & Data

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/bitbucket-pipelines-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

bitbucket-pipelines-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Bitbucket Addon Pipelines API
  description: Code against the Bitbucket API to automate simple tasks, embed Bitbucket data into your own site, build mobile or desktop apps, or even add custom UI add-ons into Bitbucket itself using the Connect framework.
  version: '2.0'
  termsOfService: https://www.atlassian.com/legal/customer-agreement
  contact:
    name: Bitbucket Support
    url: https://support.atlassian.com/bitbucket-cloud/
    email: support@bitbucket.org
servers:
- url: https://api.bitbucket.org/2.0
tags:
- name: Pipelines
  description: 'Bitbucket Pipelines brings continuous delivery to Bitbucket

    Cloud, empowering teams with full branching to deployment

    visibility and faster feedback loops.

    '
paths:
  /repositories/{workspace}/{repo_slug}/deployments_config/environments/{environment_uuid}/variables:
    get:
      tags:
      - Pipelines
      description: Find deployment environment level variables.
      summary: List variables for an environment
      operationId: getDeploymentVariables
      parameters:
      - name: workspace
        description: This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example `{workspace UUID}`.
        required: true
        in: path
        schema:
          type: string
      - name: repo_slug
        description: The repository.
        required: true
        in: path
        schema:
          type: string
      - name: environment_uuid
        description: The environment.
        required: true
        in: path
        schema:
          type: string
      responses:
        '200':
          description: The retrieved deployment variables.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/paginated_deployment_variable'
      security:
      - oauth2:
        - pipeline
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - read:pipeline:bitbucket
      x-atlassian-auth-types:
      - forge-oauth2
      - api-token
    post:
      tags:
      - Pipelines
      description: Create a deployment environment level variable.
      summary: Create a variable for an environment
      operationId: createDeploymentVariable
      parameters:
      - name: workspace
        description: This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example `{workspace UUID}`.
        required: true
        in: path
        schema:
          type: string
      - name: repo_slug
        description: The repository.
        required: true
        in: path
        schema:
          type: string
      - name: environment_uuid
        description: The environment.
        required: true
        in: path
        schema:
          type: string
      responses:
        '201':
          description: The variable was created.
          headers:
            Location:
              description: The URL of the newly created variable.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/deployment_variable'
        '404':
          description: The account, repository, environment or variable with the given UUID was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '409':
          description: A variable with the provided key already exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      security:
      - oauth2:
        - pipeline:variable
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - admin:pipeline:bitbucket
      x-atlassian-auth-types:
      - forge-oauth2
      - api-token
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/deployment_variable'
        description: The variable to create
        required: true
  /repositories/{workspace}/{repo_slug}/deployments_config/environments/{environment_uuid}/variables/{variable_uuid}:
    put:
      tags:
      - Pipelines
      description: Update a deployment environment level variable.
      summary: Update a variable for an environment
      operationId: updateDeploymentVariable
      parameters:
      - name: workspace
        description: This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example `{workspace UUID}`.
        required: true
        in: path
        schema:
          type: string
      - name: repo_slug
        description: The repository.
        required: true
        in: path
        schema:
          type: string
      - name: environment_uuid
        description: The environment.
        required: true
        in: path
        schema:
          type: string
      - name: variable_uuid
        description: The UUID of the variable to update.
        required: true
        in: path
        schema:
          type: string
      responses:
        '200':
          description: The deployment variable was updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/deployment_variable'
        '404':
          description: The account, repository, environment or variable with the given UUID was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      security:
      - oauth2:
        - pipeline:variable
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - admin:pipeline:bitbucket
      x-atlassian-auth-types:
      - forge-oauth2
      - api-token
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/deployment_variable'
        description: The updated deployment variable.
        required: true
    delete:
      tags:
      - Pipelines
      description: Delete a deployment environment level variable.
      summary: Delete a variable for an environment
      operationId: deleteDeploymentVariable
      parameters:
      - name: workspace
        description: This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example `{workspace UUID}`.
        required: true
        in: path
        schema:
          type: string
      - name: repo_slug
        description: The repository.
        required: true
        in: path
        schema:
          type: string
      - name: environment_uuid
        description: The environment.
        required: true
        in: path
        schema:
          type: string
      - name: variable_uuid
        description: The UUID of the variable to delete.
        required: true
        in: path
        schema:
          type: string
      responses:
        '204':
          description: The variable was deleted.
        '404':
          description: The account, repository, environment or variable with given UUID was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      security:
      - oauth2:
        - pipeline:variable
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - admin:pipeline:bitbucket
      x-atlassian-auth-types:
      - forge-oauth2
      - api-token
  /repositories/{workspace}/{repo_slug}/pipelines:
    get:
      tags:
      - Pipelines
      summary: List pipelines
      description: 'Find pipelines in a repository.


        Note that unlike other endpoints in the Bitbucket API, this endpoint utilizes query parameters to allow filtering

        and sorting of returned results. See [query parameters](#api-repositories-workspace-repo-slug-pipelines-get-request-Query%20parameters)

        for specific details.

        '
      operationId: getPipelinesForRepository
      parameters:
      - name: workspace
        description: This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example `{workspace UUID}`.
        required: true
        in: path
        schema:
          type: string
      - name: repo_slug
        description: The repository.
        required: true
        in: path
        schema:
          type: string
      - name: creator.uuid
        description: The UUID of the creator of the pipeline to filter by.
        required: false
        in: query
        schema:
          type: string
          format: uuid
      - name: target.ref_type
        description: The type of the reference to filter by.
        required: false
        in: query
        schema:
          type: string
          enum:
          - BRANCH
          - TAG
          - ANNOTATED_TAG
      - name: target.ref_name
        description: The reference name to filter by.
        required: false
        in: query
        schema:
          type: string
      - name: target.branch
        description: The name of the branch to filter by.
        required: false
        in: query
        schema:
          type: string
      - name: target.commit.hash
        description: The revision to filter by.
        required: false
        in: query
        schema:
          type: string
      - name: target.selector.pattern
        description: The pipeline pattern to filter by.
        required: false
        in: query
        schema:
          type: string
      - name: target.selector.type
        description: The type of pipeline to filter by.
        required: false
        in: query
        schema:
          type: string
          enum:
          - BRANCH
          - TAG
          - CUSTOM
          - PULLREQUESTS
          - DEFAULT
      - name: created_on
        description: The creation date to filter by.
        required: false
        in: query
        schema:
          type: string
          format: date-time
      - name: trigger_type
        description: The trigger type to filter by.
        required: false
        in: query
        schema:
          type: string
          enum:
          - PUSH
          - MANUAL
          - SCHEDULED
          - PARENT_STEP
      - name: status
        description: The pipeline status to filter by.
        required: false
        in: query
        schema:
          type: string
          enum:
          - PARSING
          - PENDING
          - PAUSED
          - HALTED
          - BUILDING
          - ERROR
          - PASSED
          - FAILED
          - STOPPED
          - UNKNOWN
      - name: sort
        description: The attribute name to sort on.
        required: false
        in: query
        schema:
          type: string
          enum:
          - creator.uuid
          - created_on
          - run_creation_date
      - name: page
        description: The page number of elements to retrieve.
        required: false
        in: query
        schema:
          type: integer
          format: int32
          default: 1
          minimum: 1
      - name: pagelen
        description: The maximum number of results to return.
        required: false
        in: query
        schema:
          type: integer
          format: int32
          default: 10
          maximum: 100
          minimum: 1
      responses:
        '200':
          description: The matching pipelines.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/paginated_pipelines'
      security:
      - oauth2:
        - pipeline
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - read:pipeline:bitbucket
      x-atlassian-auth-types:
      - forge-oauth2
      - api-token
    post:
      tags:
      - Pipelines
      summary: Run a pipeline
      description: "Endpoint to create and initiate a pipeline.\nThere are a number of different options to initiate a pipeline, where the payload of the request will determine which type of pipeline will be instantiated.\n\n## Trigger a pipeline for a branch\n\nOne way to trigger pipelines is by specifying the branch for which you want to trigger a pipeline.\nThe specified branch will be used to determine which pipeline definition from the `bitbucket-pipelines.yml` file will be applied to initiate the pipeline. The pipeline will then do a clone of the repository and checkout the latest revision of the specified branch.\n\n### Example\n\n```\n$ curl -X POST -is -u '{atlassian_account_email}:{api_token}' \\\n      -H 'Content-Type: application/json' \\\n      https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines/ \\\n      -d '\n      {\n        \"target\": {\n          \"ref_type\": \"branch\",\n          \"type\": \"pipeline_ref_target\",\n          \"ref_name\": \"master\"\n        }\n      }'\n```\n\n## Trigger a pipeline for a commit on a branch or tag\n\nYou can initiate a pipeline for a specific commit and in the context of a specified reference (e.g. a branch, tag or bookmark).\nThe specified reference will be used to determine which pipeline definition from the bitbucket-pipelines.yml file will be applied to initiate the pipeline. The pipeline will clone the repository and then do a checkout the specified reference.\n\nThe following reference types are supported:\n\n* `branch`\n* `named_branch`\n* `bookmark`\n * `tag`\n\n### Example\n\n```\n$ curl -X POST -is -u '{atlassian_account_email}:{api_token}' \\\n      -H 'Content-Type: application/json' \\\n      https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines/ \\\n      -d '\n      {\n        \"target\": {\n          \"commit\": {\n            \"type\": \"commit\",\n            \"hash\": \"ce5b7431602f7cbba007062eeb55225c6e18e956\"\n          },\n          \"ref_type\": \"branch\",\n          \"type\": \"pipeline_ref_target\",\n          \"ref_name\": \"master\"\n        }\n      }'\n```\n\n## Trigger a specific pipeline definition for a commit\n\nYou can trigger a specific pipeline that is defined in your `bitbucket-pipelines.yml` file for a specific commit.\nIn addition to the commit revision, you specify the type and pattern of the selector that identifies the pipeline definition. The resulting pipeline will then clone the repository and checkout the specified revision.\n\n### Example\n\n```\n$ curl -X POST -is -u '{atlassian_account_email}:{api_token}' \\\n      -H 'Content-Type: application/json' \\\n      https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines/ \\\n      -d '\n      {\n        \"target\": {\n          \"commit\": {\n            \"hash\":\"a3c4e02c9a3755eccdc3764e6ea13facdf30f923\",\n            \"type\":\"commit\"\n          },\n          \"selector\": {\n            \"type\":\"custom\",\n            \"pattern\":\"Deploy to production\"\n          },\n          \"type\":\"pipeline_commit_target\"\n        }\n      }'\n```\n\n## Trigger a specific pipeline definition for a commit on a branch or tag\n\nYou can trigger a specific pipeline that is defined in your `bitbucket-pipelines.yml` file for a specific commit in the context of a specified reference.\nIn addition to the commit revision, you specify the type and pattern of the selector that identifies the pipeline definition, as well as the reference information. The resulting pipeline will then clone the repository a checkout the specified reference.\n\n### Example\n\n```\n$ curl -X POST -is -u '{atlassian_account_email}:{api_token}' \\\n      -H 'Content-Type: application/json' \\\n      https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines/ \\\n      -d '\n      {\n        \"target\": {\n          \"commit\": {\n            \"hash\":\"a3c4e02c9a3755eccdc3764e6ea13facdf30f923\",\n            \"type\":\"commit\"\n          },\n          \"selector\": {\n            \"type\": \"custom\",\n            \"pattern\": \"Deploy to production\"\n          },\n          \"type\": \"pipeline_ref_target\",\n          \"ref_name\": \"master\",\n          \"ref_type\": \"branch\"\n        }\n      }'\n```\n\n## Trigger a custom pipeline with variables\n\nIn addition to triggering a custom pipeline that is defined in your `bitbucket-pipelines.yml` file as shown in the examples above, you can specify variables that will be available for your build. In the request, provide a list of variables, specifying the following for each variable: key, value, and whether it should be secured or not (this field is optional and defaults to not secured).\n\n### Example\n\n```\n$ curl -X POST -is -u '{atlassian_account_email}:{api_token}' \\\n      -H 'Content-Type: application/json' \\\n      https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines/ \\\n      -d '\n      {\n        \"target\": {\n          \"type\": \"pipeline_ref_target\",\n          \"ref_type\": \"branch\",\n          \"ref_name\": \"master\",\n          \"selector\": {\n            \"type\": \"custom\",\n            \"pattern\": \"Deploy to production\"\n          }\n        },\n        \"variables\": [\n          {\n            \"key\": \"var1key\",\n            \"value\": \"var1value\",\n            \"secured\": true\n          },\n          {\n            \"key\": \"var2key\",\n            \"value\": \"var2value\"\n          }\n        ]\n      }'\n```\n\n## Trigger a pull request pipeline\n\nYou can also initiate a pipeline for a specific pull request.\n\n### Example\n\n```\n$ curl -X POST -is -u '{atlassian_account_email}:{api_token}' \\\n      -H 'Content-Type: application/json' \\\n      https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines/ \\\n      -d '\n      {\n        \"target\": {\n          \"type\": \"pipeline_pullrequest_target\",\n          \"source\": \"pull-request-branch\",\n          \"destination\": \"master\",\n          \"destination_commit\": {\n            \"hash\": \"9f848b7\"\n          },\n          \"commit\": {\n            \"hash\": \"1a372fc\"\n          },\n          \"pullrequest\": {\n            \"id\": \"3\"\n          },\n          \"selector\": {\n            \"type\": \"pull-requests\",\n            \"pattern\": \"**\"\n          }\n        }\n      }'\n```\n\n# On-demand pipeline\n\nBy default, pipelines run using the YAML in the repository’s `bitbucket-pipelines.yml` configuration file.\nWith an _on-demand_ pipeline, you include the pipeline’s YAML in the request body. That YAML applies only\nto that run and overrides the YAML in `bitbucket-pipelines.yml`.\n\nJust like with regular pipelines, there is a number of different options to initiate an on-demand pipeline.\nHowever, since the payload contains YAML configuration in this case, _query parameters_ are used to supply\nthe necessary metadata to determine which type of pipeline will be instantiated. These query parameters\nare derived from the JSON equivalent by turning each property into a key-value pair with the JSON path\nof the property as the new key.\n\n## Trigger on-demand pipeline for a branch\n\nYou can initiate an on-demand pipeline for a specific branch. This branch will be used to determine\nwhich pipeline definition from the supplied YAML configuration will be applied to initiate the pipeline.\nThe pipeline will then do a clone of the repository and check out the latest revision of the specified branch.\n\nTo trigger an on-demand pipeline for a _branch_ the requesting user must have **write permission** for\nthat branch (which can be limited by [branch restrictions](https://support.atlassian.com/bitbucket-cloud/docs/use-branch-permissions/)).\n\n### Example\n\n```\n$ curl -X POST -is -u '{atlassian_account_email}:{api_token}' \\\n      -H 'Content-Type: application/yaml' \\\n      https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines?target.type=pipeline_ref_target&target.ref_type=branch&target.ref_name=master \\\n      -d '\npipelines:\n  default:\n    - step:\n        script:\n          - echo This is an on-demand pipeline'\n```\n\n## Trigger on-demand pipeline for a commit on a branch or tag\n\nYou can initiate an on-demand pipeline for a specific commit and in the context of a specified reference\n(branch or tag). The specified reference will be used to determine which pipeline definition from the supplied\nYAML configuration will be applied to initiate the pipeline. The pipeline will clone the repository and\ncheck out the specified reference.\n\nTo trigger an on-demand pipeline for a _branch_ the requesting user must have **write permission** for\nthat branch (which can be limited by [branch restrictions](https://support.atlassian.com/bitbucket-cloud/docs/use-branch-permissions/)).\n\n### Example\n\n```\n$ curl -X POST -is -u '{atlassian_account_email}:{api_token}' \\\n      -H 'Content-Type: application/yaml' \\\n      https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines?target.type=pipeline_ref_target&target.ref_type=branch&target.ref_name=master&target.commit.hash=ce5b7431602f7cbba007062eeb55225c6e18e956 \\\n      -d '\npipelines:\n  default:\n    - step:\n        script:\n          - echo This is an on-demand pipeline'\n```\n\n## Trigger a specific on-demand pipeline definition for a commit\n\nYou can trigger a specific pipeline that is defined in the supplied YAML configuration for a specific commit.\nIn addition to the commit revision, you specify the type and pattern of the selector that identifies\nthe pipeline definition. The resulting pipeline will then clone the repository and checkout the specified revision.\n\n### Example\n\n```\n$ curl -X POST -is -u '{atlassian_account_email}:{api_token}' \\\n      -H 'Content-Type: application/yaml' \\\n      https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines?target.type=pipeline_commit_target&target.commit.hash=a3c4e02c9a3755eccdc3764e6ea13facdf30f923&target.selector.type=custom&target.selector.pattern=security-scan \\\n      -d '\npipelines:\n  custom:\n    security-scan:\n      - step:\n          script:\n            - echo Run on-demand security scan\n```\n\n## Trigger a custom on-demand pipeline with variables\n\nIn addition to triggering a custom on-demand pipeline that is defined in the supplied YAML configuration\nas shown in the examples above, you can specify variables that will be available for your build.\nIn the request, provide each variable as an indexed set of query parameters representing its key, value,\nand whether it should be secured or not (this field is optional and defaults to not secured).\n\n### Example\n\n```\n$ curl -X POST -is -u '{atlassian_account_email}:{api_token}' \\\n      -H 'Content-Type: application/yaml' \\\n      https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines?target.type=pipeline_ref_target&target.ref_type=branch&target.ref_name=master&target.selector.type=custom&target.selector.pattern=security-scan&variables[0].key=var1key&variables[0].value=var1value&variables[0].secured=true&variables[1].key=var2key&variables[1].value=var2value \\\n      -d '\npipelines:\n  custom:\n    security-scan:\n      - variables:\n          - name: var1key\n          - name: var2key\n      - step:\n          script:\n            - echo Run on-demand security scan'\n```\n\n## Trigger a pull request pipeline\n\nYou can also initiate an on-demand pipeline for a specific pull request.\n\n### Example\n\n```\n$ curl -X POST -is -u '{atlassian_account_email}:{api_token}' \\\n      -H 'Content-Type: application/yaml' \\\n      https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines?target.type=pipeline_pullrequest_target&target.source=pull-request-branch&target.destination=destination&target.destination_commit.hash=9f848b7&target.commit.hash=1a372fc&target.pullrequest.id=3&target.selector.type=pull-requests&target.selector.pattern=** \\\n      -d '\npipelines:\n  pull-requests:\n    \"**\":\n      - step:\n          script:\n            - echo This is an on-demand pipeline'\n```\n"
      operationId: createPipelineForRepository
      parameters:
      - name: workspace
        description: This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example `{workspace UUID}`.
        required: true
        in: path
        schema:
          type: string
      - name: repo_slug
        description: The repository.
        required: true
        in: path
        schema:
          type: string
      responses:
        '201':
          description: The initiated pipeline.
          headers:
            Location:
              description: The URL of the newly created pipeline.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pipeline'
        '400':
          description: The account or repository is not enabled, the yml file does not exist in the repository for the given revision, or the request body contained invalid properties.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '404':
          description: The account or repository was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      security:
      - oauth2:
        - pipeline
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - read:pipeline:bitbucket
        - write:pipeline:bitbucket
      x-atlassian-auth-types:
      - forge-oauth2
      - api-token
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/pipeline'
        description: The pipeline to initiate.
        required: true
  /repositories/{workspace}/{repo_slug}/pipelines-config/caches:
    get:
      tags:
      - Pipelines
      summary: List caches
      description: Retrieve the repository pipelines caches.
      operationId: getRepositoryPipelineCaches
      parameters:
      - name: workspace
        description: The account.
        required: true
        in: path
        schema:
          type: string
      - name: repo_slug
        description: The repository.
        required: true
        in: path
        schema:
          type: string
      responses:
        '200':
          description: The list of caches for the given repository.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/paginated_pipeline_caches'
        '404':
          description: The account or repository was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      security:
      - oauth2:
        - pipeline
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - read:pipeline:bitbucket
      x-atlassian-auth-types:
      - forge-oauth2
      - api-token
    delete:
      tags:
      - Pipelines
      summary: Delete caches
      description: Delete repository cache versions by name.
      operationId: deleteRepositoryPipelineCaches
      parameters:
      - name: workspace
        description: The account.
        required: true
        in: path
        schema:
          type: string
      - name: repo_slug
        description: The repository.
        required: true
        in: path
        schema:
          type: string
      - name: name
        description: The cache name.
        required: true
        in: query
        schema:
          type: string
      responses:
        '204':
          description: The caches were deleted.
        '404':
          description: The workspace, repository or cache name was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      security:
      - oauth2:
        - pipeline:write
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - write:pipeline:bitbucket
      x-atlassian-auth-types:
      - forge-oauth2
      - api-token
  /repositories/{workspace}/{repo_slug}/pipelines-config/caches/{cache_uuid}:
    delete:
      tags:
      - Pipelines
      summary: Delete a cache
      description: Delete a repository cache.
      operationId: deleteRepositoryPipelineCache
      parameters:
      - name: workspace
        description: The account.
        required: true
        in: path
        schema:
          type: string
      - name: repo_slug
        description: The repository.
        required: true
        in: path
        schema:
          type: string
      - name: cache_uuid
        description: The UUID of the cache to delete.
        required: true
        in: path
        schema:
          type: string
      responses:
        '204':
          description: The cache was deleted.
        '404':
          description: The workspace, repository or cache_uuid with given UUID was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      security:
      - oauth2:
        - pipeline:write
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - write:pipeline:bitbucket
      x-atlassian-auth-types:
      - forge-oauth2
      - api-token
  /repositories/{workspace}/{repo_slug}/pipelines-config/caches/{cache_uuid}/content-uri:
    get:
      tags:
      - Pipelines
      summary: Get cache content URI
      description: Retrieve the URI of the content of the specified cache.
      operationId: getRepositoryPipelineCacheContentURI
      parameters:
      - name: workspace
        description: The account.
        required: true
        in: path
        schema:
          type: string
      - name: repo_slug
        description: The repository.
        required: true
        in: path
        schema:
          type: string
      - name: cache_uuid
        description: The UUID of the cache.
        required: true
        in: path
        schema:
          type: string
      responses:
        '200':
          description: The cache content uri.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pipeline_cache_content_uri'
        '404':
          description: The workspace, repository or cache_uuid with given UUID was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      security:
      - oauth2:
        - pipeline
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - read:pipeline:bitbucket
      x-atlassian-auth-types:
      - forge-oauth2
      - api-token
  /repositories/{workspace}/{repo_slug}/pipelines-config/runners:
    get:
      tags:
      - Pipelines
      summary: Get repository runners
      description: Retrieve repository runners.
      operationId: getRepositoryRunners
      parameters:
      - name: workspace
        description: This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example `{workspace UUID}`.
        required: true
        in: path
        schema:
          type: string
      - name: repo_slug
        description: The repository.
        required: true
        in: path
        schema:
          type: string
      responses:
        '200':
          description: The repository runners.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/paginated_pipeline_runners'
      security:
      - oauth2:
        - runner
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - read:runner:bitbucket
      x-atlassian-auth-types:
      - forge-oauth2
      - api-token
    post:
      tags:


# --- truncated at 32 KB (279 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/bitbucket/refs/heads/main/openapi/bitbucket-pipelines-api-openapi.yml