Bitbucket Repositories API

A Git repository is a virtual storage of your project. It allows you to save versions of your code, which you can access when needed. The repo resource allows you to access public repos, or repos that belong to a specific workspace.

Operations 30

GET /repositories List public repositories
GET /repositories/{workspace} List repositories in a workspace
DELETE /repositories/{workspace}/{repo_slug} Delete a repository
GET /repositories/{workspace}/{repo_slug} Get a repository
POST /repositories/{workspace}/{repo_slug} Create a repository
PUT /repositories/{workspace}/{repo_slug} Update a repository
GET /repositories/{workspace}/{repo_slug}/filehistory/{commit}/{path} List commits that modified a file
GET /repositories/{workspace}/{repo_slug}/forks List repository forks
POST /repositories/{workspace}/{repo_slug}/forks Fork a repository
GET /repositories/{workspace}/{repo_slug}/hooks List webhooks for a repository
POST /repositories/{workspace}/{repo_slug}/hooks Create a webhook for a repository
DELETE /repositories/{workspace}/{repo_slug}/hooks/{uid} Delete a webhook for a repository
GET /repositories/{workspace}/{repo_slug}/hooks/{uid} Get a webhook for a repository
PUT /repositories/{workspace}/{repo_slug}/hooks/{uid} Update a webhook for a repository
GET /repositories/{workspace}/{repo_slug}/override-settings Retrieve the inheritance state for repository settings
PUT /repositories/{workspace}/{repo_slug}/override-settings Set the inheritance state for repository settings
GET /repositories/{workspace}/{repo_slug}/permissions-config/groups List explicit group permissions for a repository
DELETE /repositories/{workspace}/{repo_slug}/permissions-config/groups/{group_slug} Delete an explicit group permission for a repository
GET /repositories/{workspace}/{repo_slug}/permissions-config/groups/{group_slug} Get an explicit group permission for a repository
PUT /repositories/{workspace}/{repo_slug}/permissions-config/groups/{group_slug} Update an explicit group permission for a repository
GET /repositories/{workspace}/{repo_slug}/permissions-config/users List explicit user permissions for a repository
DELETE /repositories/{workspace}/{repo_slug}/permissions-config/users/{selected_user_id} Delete an explicit user permission for a repository
GET /repositories/{workspace}/{repo_slug}/permissions-config/users/{selected_user_id} Get an explicit user permission for a repository
PUT /repositories/{workspace}/{repo_slug}/permissions-config/users/{selected_user_id} Update an explicit user permission for a repository
GET /repositories/{workspace}/{repo_slug}/src Get the root directory of the main branch
POST /repositories/{workspace}/{repo_slug}/src Create a commit by uploading a file
GET /repositories/{workspace}/{repo_slug}/src/{commit}/{path} Get file or directory contents
GET /repositories/{workspace}/{repo_slug}/watchers List repositories watchers
GET /user/permissions/repositories List repository permissions for a user
GET /user/workspaces/{workspace}/permissions/repositories List repository permissions in a workspace for a user

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-repositories-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-repositories-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Bitbucket Addon Repositories 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: Repositories
  description: 'A Git repository is a virtual storage of your project. It

    allows you to save versions of your code, which you can access

    when needed. The repo resource allows you to access public repos,

    or repos that belong to a specific workspace.

    '
paths:
  /repositories:
    parameters: []
    get:
      tags:
      - Repositories
      description: '**This endpoint is deprecated. Please use the

        [workspace scoped alternative](/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-get).**


        Returns a paginated list of all public repositories.


        This endpoint also supports filtering and sorting of the results. See

        [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering) for more details.'
      summary: List public repositories
      responses:
        '200':
          description: All public repositories.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/paginated_repositories'
      parameters:
      - name: after
        in: query
        description: "Filter the results to include only repositories created on or\nafter this [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601)\n timestamp. Example: `YYYY-MM-DDTHH:mm:ss.sssZ`"
        required: false
        schema:
          type: string
      - name: role
        in: query
        description: 'Filters the result based on the authenticated user''s role on each repository.


          * **member**: returns repositories to which the user has explicit read access

          * **contributor**: returns repositories to which the user has explicit write access

          * **admin**: returns repositories to which the user has explicit administrator access

          * **owner**: returns all repositories owned by the current user

          '
        required: false
        schema:
          type: string
          enum:
          - admin
          - contributor
          - member
          - owner
      - name: q
        in: query
        description: 'Query string to narrow down the response as per [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering).

          `role` parameter must also be specified.

          '
        required: false
        schema:
          type: string
      - name: sort
        in: query
        description: 'Field by which the results should be sorted as per [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering).

          '
        required: false
        schema:
          type: string
      security:
      - oauth2:
        - repository
      - basic: []
      - api_key: []
      deprecated: true
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - read:repository:bitbucket
      x-atlassian-auth-types:
      - api-token
  /repositories/{workspace}:
    parameters:
    - name: workspace
      in: path
      description: 'This can either be the workspace ID (slug) or the workspace UUID

        surrounded by curly-braces, for example: `{workspace UUID}`.

        '
      required: true
      schema:
        type: string
    get:
      tags:
      - Repositories
      description: 'Returns a paginated list of all repositories owned by the specified

        workspace.


        The result can be narrowed down based on the authenticated user''s role.


        E.g. with `?role=contributor`, only those repositories that the

        authenticated user has write access to are returned (this includes any

        repo the user is an admin on, as that implies write access).


        This endpoint also supports filtering and sorting of the results. See

        [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering) for more details.'
      summary: List repositories in a workspace
      responses:
        '200':
          description: The repositories owned by the specified account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/paginated_repositories'
        '404':
          description: If the specified account does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '410':
          description: If the specified account marked as spam.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      parameters:
      - name: role
        in: query
        description: '

          Filters the result based on the authenticated user''s role on each repository.


          * **member**: returns repositories to which the user has explicit read access

          * **contributor**: returns repositories to which the user has explicit write access

          * **admin**: returns repositories to which the user has explicit administrator access

          * **owner**: returns all repositories owned by the current user

          '
        required: false
        schema:
          type: string
          enum:
          - admin
          - contributor
          - member
          - owner
      - name: q
        in: query
        description: '

          Query string to narrow down the response as per [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering).

          '
        required: false
        schema:
          type: string
      - name: sort
        in: query
        description: "\nField by which the results should be sorted as per [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering).\n        "
        required: false
        schema:
          type: string
      security:
      - oauth2:
        - repository
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - read:repository:bitbucket
      x-atlassian-auth-types:
      - forge-oauth2
      - api-token
  /repositories/{workspace}/{repo_slug}:
    parameters:
    - name: repo_slug
      in: path
      description: 'This can either be the repository slug or the UUID of the repository,

        surrounded by curly-braces, for example: `{repository UUID}`.

        '
      required: true
      schema:
        type: string
    - name: workspace
      in: path
      description: 'This can either be the workspace ID (slug) or the workspace UUID

        surrounded by curly-braces, for example: `{workspace UUID}`.

        '
      required: true
      schema:
        type: string
    delete:
      tags:
      - Repositories
      description: 'Deletes the repository. This is an irreversible operation.


        This does not affect its forks.'
      summary: Delete a repository
      responses:
        '204':
          description: Indicates successful deletion.
        '403':
          description: If the caller either does not have admin access to the repository, or the repository is set to read-only.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '404':
          description: If the repository does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      parameters:
      - name: redirect_to
        in: query
        description: 'If a repository has been moved to a new location, use this parameter to

          show users a friendly message in the Bitbucket UI that the repository

          has moved to a new location. However, a GET to this endpoint will still

          return a 404.

          '
        required: false
        schema:
          type: string
      security:
      - oauth2:
        - repository:delete
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - delete:repository:bitbucket
      x-atlassian-auth-types:
      - forge-oauth2
      - api-token
    get:
      tags:
      - Repositories
      description: Returns the object describing this repository.
      summary: Get a repository
      responses:
        '200':
          description: The repository object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/repository'
        '403':
          description: If the repository is private and the authenticated user does not have access to it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '404':
          description: If no repository exists at this location.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      security:
      - oauth2:
        - repository
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - read:repository:bitbucket
      x-atlassian-auth-types:
      - forge-oauth2
      - api-token
    post:
      tags:
      - Repositories
      description: "Creates a new repository.\n\nNote: In order to set the project for the newly created repository,\npass in either the project key or the project UUID as part of the\nrequest body as shown in the examples below:\n\n```\n$ curl -X POST -H \"Content-Type: application/json\" -d '{\n    \"scm\": \"git\",\n    \"project\": {\n        \"key\": \"MARS\"\n    }\n}' https://api.bitbucket.org/2.0/repositories/teamsinspace/hablanding\n```\n\nor\n\n```\n$ curl -X POST -H \"Content-Type: application/json\" -d '{\n    \"scm\": \"git\",\n    \"project\": {\n        \"key\": \"{ba516952-992a-4c2d-acbd-17d502922f96}\"\n    }\n}' https://api.bitbucket.org/2.0/repositories/teamsinspace/hablanding\n```\n\nThe project must be assigned for all repositories. If the project is not provided,\nthe repository is automatically assigned to the oldest project in the workspace.\n\nNote: In the examples above, the workspace ID `teamsinspace`,\nand/or the repository name `hablanding` can be replaced by UUIDs."
      summary: Create a repository
      responses:
        '200':
          description: The newly created repository.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/repository'
        '400':
          description: If the input document was invalid, or if the caller lacks the privilege to create repositories under the targeted account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '401':
          description: If the request was not authenticated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      security:
      - oauth2:
        - repository:admin
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - admin:repository:bitbucket
      x-atlassian-auth-types:
      - forge-oauth2
      - api-token
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/repository'
        description: The repository that is to be created. Note that most object elements are optional. Elements "owner" and "full_name" are ignored as the URL implies them.
    put:
      tags:
      - Repositories
      description: 'Since this endpoint can be used to both update and to create a

        repository, the request body depends on the intent.


        #### Creation


        See the POST documentation for the repository endpoint for an example

        of the request body.


        #### Update


        Note: Changing the `name` of the repository will cause the location to

        be changed. This is because the URL of the repo is derived from the

        name (a process called slugification). In such a scenario, it is

        possible for the request to fail if the newly created slug conflicts

        with an existing repository''s slug. But if there is no conflict,

        the new location will be returned in the `Location` header of the

        response.'
      summary: Update a repository
      responses:
        '200':
          description: The existing repository has been updated
          headers:
            Location:
              description: 'The location of the repository. This header is only

                provided when the repository''s name is changed.'
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/repository'
        '201':
          description: A new repository has been created
          headers:
            Location:
              description: The location of the newly created repository
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/repository'
        '400':
          description: If the input document was invalid, or if the caller lacks the privilege to create repositories under the targeted account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '401':
          description: If the request was not authenticated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      security:
      - oauth2:
        - repository:admin
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - admin:repository:bitbucket
      x-atlassian-auth-types:
      - forge-oauth2
      - api-token
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/repository'
        description: 'The repository that is to be updated.


          Note that the elements "owner" and "full_name" are ignored since the

          URL implies them.

          '
  /repositories/{workspace}/{repo_slug}/filehistory/{commit}/{path}:
    parameters:
    - name: commit
      in: path
      description: The commit's SHA1.
      required: true
      schema:
        type: string
    - name: path
      in: path
      description: Path to the file.
      required: true
      schema:
        type: string
    - name: repo_slug
      in: path
      description: 'This can either be the repository slug or the UUID of the repository,

        surrounded by curly-braces, for example: `{repository UUID}`.

        '
      required: true
      schema:
        type: string
    - name: workspace
      in: path
      description: 'This can either be the workspace ID (slug) or the workspace UUID

        surrounded by curly-braces, for example: `{workspace UUID}`.

        '
      required: true
      schema:
        type: string
    get:
      tags:
      - Repositories
      description: "Returns a paginated list of commits that modified the specified file.\n\nCommits are returned in reverse chronological order. This is roughly\nequivalent to the following commands:\n\n    $ git log --follow --date-order <sha> <path>\n\nBy default, Bitbucket will follow renames and the path name in the\nreturned entries reflects that. This can be turned off using the\n`?renames=false` query parameter.\n\nResults are returned in descending chronological order by default, and\nlike most endpoints you can\n[filter and sort](/cloud/bitbucket/rest/intro/#filtering) the response to\nonly provide exactly the data you want.\n\nThe example response returns commits made before 2011-05-18 against a file\nnamed `README.rst`. The results are filtered to only return the path and\ndate. This request can be made using:\n\n```\n$ curl 'https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/filehistory/master/README.rst'\\\n  '?fields=values.next,values.path,values.commit.date&q=commit.date<=2011-05-18'\n```\n\nIn the response you can see that the file was renamed to `README.rst`\nby the commit made on 2011-05-16, and was previously named `README.txt`."
      summary: List commits that modified a file
      responses:
        '200':
          description: A paginated list of commits that modified the specified file
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/paginated_files'
              example:
                values:
                - commit:
                    date: '2011-05-17T07:32:09+00:00'
                  path: README.rst
                - commit:
                    date: '2011-05-16T06:33:28+00:00'
                  path: README.txt
                - commit:
                    date: '2011-05-16T06:15:39+00:00'
                  path: README.txt
        '404':
          description: If the repository does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      parameters:
      - name: renames
        in: query
        description: '

          When `true`, Bitbucket will follow the history of the file across

          renames (this is the default behavior). This can be turned off by

          specifying `false`.'
        required: false
        schema:
          type: string
      - name: q
        in: query
        description: '

          Query string to narrow down the response as per

          [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering).'
        required: false
        schema:
          type: string
      - name: sort
        in: query
        description: '

          Name of a response property sort the result by as per

          [filtering and sorting](/cloud/bitbucket/rest/intro/#sorting-query-results).

          '
        required: false
        schema:
          type: string
      security:
      - oauth2:
        - repository
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - read:repository:bitbucket
      x-atlassian-auth-types:
      - forge-oauth2
      - api-token
  /repositories/{workspace}/{repo_slug}/forks:
    parameters:
    - name: repo_slug
      in: path
      description: 'This can either be the repository slug or the UUID of the repository,

        surrounded by curly-braces, for example: `{repository UUID}`.

        '
      required: true
      schema:
        type: string
    - name: workspace
      in: path
      description: 'This can either be the workspace ID (slug) or the workspace UUID

        surrounded by curly-braces, for example: `{workspace UUID}`.

        '
      required: true
      schema:
        type: string
    get:
      tags:
      - Repositories
      description: 'Returns a paginated list of all the forks of the specified

        repository.'
      summary: List repository forks
      responses:
        '200':
          description: All forks.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/paginated_repositories'
      parameters:
      - name: role
        in: query
        description: 'Filters the result based on the authenticated user''s role on each repository.


          * **member**: returns repositories to which the user has explicit read access

          * **contributor**: returns repositories to which the user has explicit write access

          * **admin**: returns repositories to which the user has explicit administrator access

          * **owner**: returns all repositories owned by the current user

          '
        required: false
        schema:
          type: string
          enum:
          - admin
          - contributor
          - member
          - owner
      - name: q
        in: query
        description: 'Query string to narrow down the response as per [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering).

          '
        required: false
        schema:
          type: string
      - name: sort
        in: query
        description: 'Field by which the results should be sorted as per [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering).

          '
        required: false
        schema:
          type: string
      security:
      - oauth2:
        - repository
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - read:repository:bitbucket
      x-atlassian-auth-types:
      - forge-oauth2
      - api-token
    post:
      tags:
      - Repositories
      description: "Creates a new fork of the specified repository.\n\n#### Forking a repository\n\nTo create a fork, specify the workspace explicitly as part of the\nrequest body:\n\n```\n$ curl -X POST -u jdoe https://api.bitbucket.org/2.0/repositories/atlassian/bbql/forks \\\n  -H 'Content-Type: application/json' -d '{\n    \"name\": \"bbql_fork\",\n    \"workspace\": {\n      \"slug\": \"atlassian\"\n    }\n}'\n```\n\nTo fork a repository into the same workspace, also specify a new `name`.\n\nWhen you specify a value for `name`, it will also affect the `slug`.\nThe `slug` is reflected in the repository URL of the new fork. It is\nderived from `name` by substituting non-ASCII characters, removes\nwhitespace, and changes characters to lower case. For example,\n`My repo` would turn into `my_repo`.\n\nYou need contributor access to create new forks within a workspace.\n\n\n#### Change the properties of a new fork\n\nBy default the fork inherits most of its properties from the parent.\nHowever, since the optional POST body document follows the normal\n`repository` JSON schema and you can override the new fork's\nproperties.\n\nProperties that can be overridden include:\n\n* description\n* fork_policy\n* language\n* mainbranch\n* is_private (note that a private repo's fork_policy might prohibit\n  the creation of public forks, in which `is_private=False` would fail)\n* has_issues (to initialize or disable the new repo's issue tracker --\n  note that the actual contents of the parent repository's issue\n  tracker are not copied during forking)\n* has_wiki (to initialize or disable the new repo's wiki --\n  note that the actual contents of the parent repository's wiki are not\n  copied during forking)\n* project (when forking into a private project, the fork's `is_private`\n  must be `true`)\n\nProperties that cannot be modified include:\n\n* scm\n* parent\n* full_name"
      summary: Fork a repository
      responses:
        '201':
          description: The newly created fork.
          headers:
            Location:
              description: The URL of the newly created fork
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/repository'
      security:
      - oauth2:
        - repository:write
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - read:repository:bitbucket
        - write:repository:bitbucket
      x-atlassian-auth-types:
      - forge-oauth2
      - api-token
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/repository'
        description: A repository object. This can be left blank.
  /repositories/{workspace}/{repo_slug}/hooks:
    parameters:
    - name: repo_slug
      in: path
      description: 'This can either be the repository slug or the UUID of the repository,

        surrounded by curly-braces, for example: `{repository UUID}`.

        '
      required: true
      schema:
        type: string
    - name: workspace
      in: path
      description: 'This can either be the workspace ID (slug) or the workspace UUID

        surrounded by curly-braces, for example: `{workspace UUID}`.

        '
      required: true
      schema:
        type: string
    get:
      tags:
      - Repositories
      description: Returns a paginated list of webhooks installed on this repository.
      summary: List webhooks for a repository
      responses:
        '200':
          description: The paginated list of installed webhooks.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/paginated_webhook_subscriptions'
        '403':
          description: If the authenticated user does not have permission to access the webhooks.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '404':
          description: If the repository does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      security:
      - oauth2:
        - webhook
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - read:webhook:bitbucket
      x-atlassian-auth-types:
      - api-token
    post:
      tags:
      - Repositories
      description: "Creates a new webhook on the specified repository.\n\nExample:\n\n```\n$ curl -X POST -u credentials -H 'Content-Type: application/json'\n  https://api.bitbucket.org/2.0/repositories/my-workspace/my-repo-slug/hooks\n  -d '\n    {\n      \"description\": \"Webhook Description\",\n      \"url\": \"https://example.com/\",\n      \"active\": true,\n      \"secret\": \"this is a really bad secret\",\n      \"events\": [\n        \"repo:push\",\n        \"issue:created\",\n        \"issue:updated\"\n      ]\n    }'\n```\n\nWhen the `secret` is provided it will be used as the key to generate a HMAC\ndigest value sent in the `X-Hub-Signature` header at delivery time. Passing\na `null` or empty `secret` or not passing a `secret` will leave the webhook's\nsecret unset. Bitbucket only generates the `X-Hub-Signature` when the webhook's\nsecret is set.\n\nNote that this call requires the webhook scope, as well as any scope\nthat applies to the events that the webhook subscribes to. In the\nexample above that means: `webhook`, `repository` and `issue`.\n\nAlso note that the `url` must properly resolve and cannot be an\ninternal, non-routed address."
      summary: Create a webhook for a repository
      responses:
        '201':
          description: If the webhook was registered successfully.
          headers:
            Location:
              description: The URL of new newly created webhook.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/webhook_subscription'
        '403':
          description: If the authenticated user does not have permission to install webhooks on the specified repository.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '404':
          description: If the repository does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      security:
      - oauth2:
        - webhook
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - read:webhook:bitbucket
        - write:webhook:bitbucket
      x-atlassian-auth-types:
      - api-token
  /repositories/{workspace}/{repo_slug}/hooks/{uid}:
    parameters:
    - name: repo_slug
      in: path
      description: 'This can either be the repository slug or the UUID of the repository,

        surrounded by curly-braces, for example: `{repository UUID}`.

        '
      required: true
      schema:
        type: string
    - name: uid
      in: path
      description: Installed webhook's ID
      required: true
      schema:
        type: string
    - name: workspace
      in: path
      description: 'This can either be the workspace ID (slug) or the workspace UUID

        surrounded by curly-braces, for example: `{workspace UUID}`.

        '
      required: true
      schema:
        type: string
    delete:
      tags:
      - Repositories
      description: 'Deletes the specified webhook subscription from the given

        repository.'
      summary: Delete a webhook for a repository
      responses:
        '204':
          description: When the webhook was deleted successfully
        '403':
          description: If the authenticated user does not have permission to delete the webhook.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '404':
          description: If the webhook or repository does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      security:
      - oauth2:
        - webhook
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - delete:webhook:bitbucket
      x-atlassian-auth-types:
      - api-token
    get:
      tags:
      - Repositories
      description: 'Returns the webhook with the specified id installed on the specified

        repository.'
      summary: Get a webhook for a repository
      responses:
        '200':
          description: The webhook subscription object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/webhook_subscription'
        '404':
          description: If the webhook or repository does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      security:
      - oauth2:
        - webhook
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - read:webhook:bitbucket
      x-atlassian-auth-types:
      - api-token
    put:
      tags:
      - Repositories
      description: 'Updates the specified webhook subscription.


        The following properties can be mutated:


        * `description`

        * `url`

        * `secret`

        * `active`

        * `events`


        The hook''s secret is used as a key to generate the HMAC hex digest sent in the

        `X-Hub-Signature` header at delivery time. This signature is only generated

        when the hook has a secret.


        Set the hook''s secret by passing the new value in the `secret` field. Passing a

        `null` value in the `secret` field will remove the secret from the hook. The

        hook''s secret can be left unchanged by not passing the `secret` field in the

        request.'
      summary: Update a webhook for a repository
      responses:
        '200':
          description: The webhook subscription object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/webhook_subscription'
        '403':
          description: If the authenticated user does not have permission to update the webhook.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '404':
          description: If the webhook or repository does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      security:
      - oauth2:
        - webhook
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - read:webhook:bitbucket
        - write:webhook:bitbucket
      x-atlassian-auth-

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