Bitbucket Source API

Browse the source code in the repository and create new commits by uploading.

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

bitbucket-source-api-openapi.yml Raw ↑
swagger: '2.0'
info:
  title: Bitbucket Addon Source 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
host: api.bitbucket.org
basePath: /2.0
schemes:
- https
consumes:
- application/json
produces:
- application/json
tags:
- name: Source
  description: "Browse the source code in the repository and\n                              create new commits by uploading."
paths:
  /repositories/{workspace}/{repo_slug}/filehistory/{commit}/{path}:
    parameters:
    - name: commit
      in: path
      description: The commit's SHA1.
      required: true
      type: string
    - name: path
      in: path
      description: Path to the file.
      required: true
      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
      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
      type: string
    get:
      tags:
      - Source
      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
          schema:
            $ref: '#/definitions/paginated_files'
          examples:
            application/json:
              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.
          schema:
            $ref: '#/definitions/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
        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
        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
        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}/src:
    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
      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
      type: string
    get:
      tags:
      - Source
      description: 'This endpoint redirects the client to the directory listing of the

        root directory on the main branch.


        This is equivalent to directly hitting

        [/2.0/repositories/{username}/{repo_slug}/src/{commit}/{path}](src/%7Bcommit%7D/%7Bpath%7D)

        without having to know the name or SHA1 of the repo''s main branch.


        To create new commits, [POST to this endpoint](#post)'
      summary: Get the root directory of the main branch
      responses:
        '200':
          description: 'If the path matches a file, then the raw contents of the file are

            returned (unless the `format=meta` query parameter was provided,

            in which case a json document containing the file''s meta data is

            returned). If the path matches a directory, then a paginated

            list of file and directory entries is returned (if the

            `format=meta` query parameter was provided, then the json document

            containing the directory''s meta data is returned).

            '
          schema:
            $ref: '#/definitions/paginated_treeentries'
        '404':
          description: If the path or commit in the URL does not exist.
          schema:
            $ref: '#/definitions/error'
      parameters:
      - name: format
        in: query
        description: Instead of returning the file's contents, return the (json) meta data for it.
        required: false
        type: string
        enum:
        - meta
      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:
      - Source
      description: "This endpoint is used to create new commits in the repository by\nuploading files.\n\nTo add a new file to a repository:\n\n```\n$ curl https://api.bitbucket.org/2.0/repositories/username/slug/src \\\n  -F /repo/path/to/image.png=@image.png\n```\n\nThis will create a new commit on top of the main branch, inheriting the\ncontents of the main branch, but adding (or overwriting) the\n`image.png` file to the repository in the `/repo/path/to` directory.\n\nTo create a commit that deletes files, use the `files` parameter:\n\n```\n$ curl https://api.bitbucket.org/2.0/repositories/username/slug/src \\\n  -F files=/file/to/delete/1.txt \\\n  -F files=/file/to/delete/2.txt\n```\n\nYou can add/modify/delete multiple files in a request. Rename/move a\nfile by deleting the old path and adding the content at the new path.\n\nThis endpoint accepts `multipart/form-data` (as in the examples above),\nas well as `application/x-www-form-urlencoded`.\n\nNote: `multipart/form-data` is currently not supported by Forge apps\nfor this API.\n\n#### multipart/form-data\n\nA `multipart/form-data` post contains a series of \"form fields\" that\nidentify both the individual files that are being uploaded, as well as\nadditional, optional meta data.\n\nFiles are uploaded in file form fields (those that have a\n`Content-Disposition` parameter) whose field names point to the remote\npath in the repository where the file should be stored. Path field\nnames are always interpreted to be absolute from the root of the\nrepository, regardless whether the client uses a leading slash (as the\nabove `curl` example did).\n\nFile contents are treated as bytes and are not decoded as text.\n\nThe commit message, as well as other non-file meta data for the\nrequest, is sent along as normal form field elements. Meta data fields\nshare the same namespace as the file objects. For `multipart/form-data`\nbodies that should not lead to any ambiguity, as the\n`Content-Disposition` header will contain the `filename` parameter to\ndistinguish between a file named \"message\" and the commit message field.\n\n#### application/x-www-form-urlencoded\n\nIt is also possible to upload new files using a simple\n`application/x-www-form-urlencoded` POST. This can be convenient when\nuploading pure text files:\n\n```\n$ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src \\\n  --data-urlencode \"/path/to/me.txt=Lorem ipsum.\" \\\n  --data-urlencode \"message=Initial commit\" \\\n  --data-urlencode \"author=Erik van Zijst <erik.van.zijst@gmail.com>\"\n```\n\nThere could be a field name clash if a client were to upload a file\nnamed \"message\", as this filename clashes with the meta data property\nfor the commit message. To avoid this and to upload files whose names\nclash with the meta data properties, use a leading slash for the files,\ne.g. `curl --data-urlencode \"/message=file contents\"`.\n\nWhen an explicit slash is omitted for a file whose path matches that of\na meta data parameter, then it is interpreted as meta data, not as a\nfile.\n\n#### Executables and links\n\nWhile this API aims to facilitate the most common use cases, it is\npossible to perform some more advanced operations like creating a new\nsymlink in the repository, or creating an executable file.\n\nFiles can be supplied with a `x-attributes` value in the\n`Content-Disposition` header. For example, to upload an executable\nfile, as well as create a symlink from `README.txt` to `README`:\n\n```\n--===============1438169132528273974==\nContent-Type: text/plain; charset=\"us-ascii\"\nMIME-Version: 1.0\nContent-Transfer-Encoding: 7bit\nContent-ID: \"bin/shutdown.sh\"\nContent-Disposition: attachment; filename=\"shutdown.sh\"; x-attributes:\"executable\"\n\n#!/bin/sh\nhalt\n\n--===============1438169132528273974==\nContent-Type: text/plain; charset=\"us-ascii\"\nMIME-Version: 1.0\nContent-Transfer-Encoding: 7bit\nContent-ID: \"/README.txt\"\nContent-Disposition: attachment; filename=\"README.txt\"; x-attributes:\"link\"\n\nREADME\n--===============1438169132528273974==--\n```\n\nLinks are files that contain the target path and have\n`x-attributes:\"link\"` set.\n\nWhen overwriting links with files, or vice versa, the newly uploaded\nfile determines both the new contents, as well as the attributes. That\nmeans uploading a file without specifying `x-attributes=\"link\"` will\ncreate a regular file, even if the parent commit hosted a symlink at\nthe same path.\n\nThe same applies to executables. When modifying an existing executable\nfile, the form-data file element must include\n`x-attributes=\"executable\"` in order to preserve the executable status\nof the file.\n\nNote that this API does not support the creation or manipulation of\nsubrepos / submodules."
      summary: Create a commit by uploading a file
      responses:
        '201':
          description: '

            '
        '403':
          description: If the authenticated user does not have write or admin access
          schema:
            $ref: '#/definitions/error'
        '404':
          description: If the repository does not exist.
          schema:
            $ref: '#/definitions/error'
      parameters:
      - name: message
        in: query
        description: The commit message. When omitted, Bitbucket uses a canned string.
        required: false
        type: string
      - name: author
        in: query
        description: '

          The raw string to be used as the new commit''s author.

          This string follows the format

          `Erik van Zijst <evzijst@atlassian.com>`.


          When omitted, Bitbucket uses the authenticated user''s

          full/display name and primary email address. Commits cannot

          be created anonymously.'
        required: false
        type: string
      - name: parents
        in: query
        description: '

          #### Deprecation Notice:

          Support for specifying multiple parent

          commits is deprecated and will be removed in a future release.

          Only a single SHA1 is accepted.


          A SHA1 of the commit that should be the parent of the newly created

          commit. When omitted, the new commit will inherit from and

          become a child of the main branch''s tip/HEAD commit.'
        required: false
        type: string
      - name: files
        in: query
        description: '

          Optional field that declares the files that the request is

          manipulating. When adding a new file to a repo, or when

          overwriting an existing file, the client can just upload

          the full contents of the file in a normal form field and

          the use of this `files` meta data field is redundant.

          However, when the `files` field contains a file path that

          does not have a corresponding, identically-named form

          field, then Bitbucket interprets that as the client wanting

          to replace the named file with the null set and the file is

          deleted instead.


          Paths in the repo that are referenced in neither files nor

          an individual file field, remain unchanged and carry over

          from the parent to the new commit.


          This API does not support renaming as an explicit feature.

          To rename a file, simply delete it and recreate it under

          the new name in the same commit.

          '
        required: false
        type: string
      - name: branch
        in: query
        description: '

          The name of the branch that the new commit should be

          created on. When omitted, the commit will be created on top

          of the main branch and will become the main branch''s new

          head.


          When a branch name is provided that already exists in the

          repo, then the commit will be created on top of that

          branch. In this case, *if* a parent SHA1 was also provided,

          then it is asserted that the parent is the branch''s

          tip/HEAD at the time the request is made. When this is not

          the case, a 409 is returned.


          When a new branch name is specified (that does not already

          exist in the repo), and no parent SHA1s are provided, then

          the new commit will inherit from the current main branch''s

          tip/HEAD commit, but not advance the main branch. The new

          commit will be the new branch. When the request *also*

          specifies a parent SHA1, then the new commit and branch

          are created directly on top of the parent commit,

          regardless of the state of the main branch.


          When a branch name is not specified, but a parent SHA1 is

          provided, then Bitbucket asserts that it represents the

          main branch''s current HEAD/tip, or a 409 is returned.


          When a branch name is not specified and the repo is empty,

          the new commit will become the repo''s root commit and will

          be on the main branch.


          When a branch name is specified and the repo is empty, the

          new commit will become the repo''s root commit and also

          define the repo''s main branch going forward.


          This API cannot be used to create additional root commits

          in non-empty repos.


          The branch field cannot be repeated.


          As a side effect, this API can be used to create a new

          branch without modifying any files, by specifying a new

          branch name in this field, together with `parents`, but

          omitting the `files` fields, while not sending any files.

          This will create a new commit and branch with the same

          contents as the first parent. The diff of this commit

          against its first parent will be empty.

          '
        required: false
        type: string
      security:
      - oauth2:
        - repository:write
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - write:repository:bitbucket
      x-atlassian-auth-types:
      - forge-oauth2
      - api-token
  /repositories/{workspace}/{repo_slug}/src/{commit}/{path}:
    parameters:
    - name: commit
      in: path
      description: The commit's SHA1.
      required: true
      type: string
    - name: path
      in: path
      description: Path to the file.
      required: true
      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
      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
      type: string
    get:
      tags:
      - Source
      description: "This endpoints is used to retrieve the contents of a single file,\nor the contents of a directory at a specified revision.\n\n#### Raw file contents\n\nWhen `path` points to a file, this endpoint returns the raw contents.\nThe response's Content-Type is derived from the filename\nextension (not from the contents). The file contents are not processed\nand no character encoding/recoding is performed and as a result no\ncharacter encoding is included as part of the Content-Type.\n\nThe `Content-Disposition` header will be \"attachment\" to prevent\nbrowsers from running executable files.\n\nIf the file is managed by LFS, then a 301 redirect pointing to\nAtlassian's media services platform is returned.\n\nThe response includes an ETag that is based on the contents of the file\nand its attributes. This means that an empty `__init__.py` always\nreturns the same ETag, regardless on the directory it lives in, or the\ncommit it is on.\n\n#### File meta data\n\nWhen the request for a file path includes the query parameter\n`?format=meta`, instead of returning the file's raw contents, Bitbucket\ninstead returns the JSON object describing the file's properties:\n\n```javascript\n$ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef/tests/__init__.py?format=meta\n{\n  \"links\": {\n    \"self\": {\n      \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py\"\n    },\n    \"meta\": {\n      \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py?format=meta\"\n    }\n  },\n  \"path\": \"tests/__init__.py\",\n  \"commit\": {\n    \"type\": \"commit\",\n    \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\",\n    \"links\": {\n      \"self\": {\n        \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\"\n      },\n      \"html\": {\n        \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\"\n      }\n    }\n  },\n  \"attributes\": [],\n  \"type\": \"commit_file\",\n  \"size\": 0\n}\n```\n\nFile objects contain an `attributes` element that contains a list of\npossible modifiers. Currently defined values are:\n\n* `link` -- indicates that the entry is a symbolic link. The contents\n    of the file represent the path the link points to.\n* `executable` -- indicates that the file has the executable bit set.\n* `subrepository` -- indicates that the entry points to a submodule or\n    subrepo. The contents of the file is the SHA1 of the repository\n    pointed to.\n* `binary` -- indicates whether Bitbucket thinks the file is binary.\n\nThis endpoint can provide an alternative to how a HEAD request can be\nused to check for the existence of a file, or a file's size without\nincurring the overhead of receiving its full contents.\n\n\n#### Directory listings\n\nWhen `path` points to a directory instead of a file, the response is a\npaginated list of directory and file objects in the same order as the\nunderlying SCM system would return them.\n\nFor example:\n\n```javascript\n$ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef/tests\n{\n  \"pagelen\": 10,\n  \"values\": [\n    {\n      \"path\": \"tests/test_project\",\n      \"type\": \"commit_directory\",\n      \"links\": {\n        \"self\": {\n          \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/\"\n        },\n        \"meta\": {\n          \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/?format=meta\"\n        }\n      },\n      \"commit\": {\n        \"type\": \"commit\",\n        \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\",\n        \"links\": {\n          \"self\": {\n            \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\"\n          },\n          \"html\": {\n            \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\"\n          }\n        }\n      }\n    },\n    {\n      \"links\": {\n        \"self\": {\n          \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py\"\n        },\n        \"meta\": {\n          \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py?format=meta\"\n        }\n      },\n      \"path\": \"tests/__init__.py\",\n      \"commit\": {\n        \"type\": \"commit\",\n        \"hash\": \"eefd5ef5d3df01aed629f650959d6706d54cd335\",\n        \"links\": {\n          \"self\": {\n            \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335\"\n          },\n          \"html\": {\n            \"href\": \"https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335\"\n          }\n        }\n      },\n      \"attributes\": [],\n      \"type\": \"commit_file\",\n      \"size\": 0\n    }\n  ],\n  \"page\": 1,\n  \"size\": 2\n}\n```\n\nWhen listing the contents of the repo's root directory, the use of a\ntrailing slash at the end of the URL is required.\n\nThe response by default is not recursive, meaning that only the direct contents of\na path are returned. The response does not recurse down into\nsubdirectories. In order to \"walk\" the entire directory tree, the\nclient can either parse each response and follow the `self` links of each\n`commit_directory` object, or can specify a `max_depth` to recurse to.\n\nThe max_depth parameter will do a breadth-first search to return the contents of the subdirectories\nup to the depth specified. Breadth-first search was chosen as it leads to the least amount of\nfile system operations for git. If the `max_depth` parameter is specified to be too\nlarge, the call will time out and return a 555.\n\nEach returned object is either a `commit_file`, or a `commit_directory`,\nboth of which contain a `path` element. This path is the absolute path\nfrom the root of the repository. Each object also contains a `commit`\nobject which embeds the commit the file is on. Note that this is merely\nthe commit that was used in the URL. It is *not* the commit that last\nmodified the file.\n\nDirectory objects have 2 representations. Their `self` link returns the\npaginated contents of the directory. The `meta` link on the other hand\nreturns the actual `directory` object itself, e.g.:\n\n```javascript\n{\n  \"path\": \"tests/test_project\",\n  \"type\": \"commit_directory\",\n  \"links\": {\n    \"self\": {\n      \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/\"\n    },\n    \"meta\": {\n      \"href\": \"https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/?format=meta\"\n    }\n  },\n  \"commit\": { ... }\n}\n```\n\n#### Querying, filtering and sorting\n\nLike most API endpoints, this API supports the Bitbucket\nquerying/filtering syntax and so you could filter a directory listing\nto only include entries that match certain criteria. For instance, to\nlist all binary files over 1kb use the expression:\n\n`size > 1024 and attributes = \"binary\"`\n\nwhich after urlencoding yields the query string:\n\n`?q=size%3E1024+and+attributes%3D%22binary%22`\n\nTo change the ordering of the response, use the `?sort` parameter:\n\n`.../src/eefd5ef/?sort=-size`\n\nSee [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering) for more\ndetails."
      summary: Get file or directory contents
      responses:
        '200':
          description: 'If the path matches a file, then the raw contents of the file are

            returned.  If the `format=meta` query parameter is provided,

            a json document containing the file''s meta data is

            returned.  If the `format=rendered` query parameter is provided,

            the contents of the file in HTML-formated rendered markup is returned.

            If the path matches a directory, then a paginated

            list of file and directory entries is returned (if the

            `format=meta` query parameter was provided, then the json document

            containing the directory''s meta data is returned.)

            '
          schema:
            $ref: '#/definitions/paginated_treeentries'
        '404':
          description: If the path or commit in the URL does not exist.
          schema:
            $ref: '#/definitions/error'
        '555':
          description: If the call times out, possibly because the specified recursion depth is too large.
          schema:
            $ref: '#/definitions/error'
      parameters:
      - name: format
        in: query
        description: 'If ''meta'' is provided, returns the (json) meta data for the contents of the file.  If ''rendered'' is provided, returns the contents of a non-binary file in HTML-formatted rendered markup. The ''rendered'' option only supports these filetypes: `.md`, `.markdown`, `.mkd`, `.mkdn`, `.mdown`, `.text`, `.rst`, and `.textile`. Since Git does not generally track what text encoding scheme is used, this endpoint attempts to detect the most appropriate character encoding. While usually correct, determining the character encoding can be ambiguous which in exceptional cases can lead to misinterpretation of the characters. As such, the raw element in the response object should not be treated as equivalent to the file''s actual contents.'
        required: false
        type: string
        enum:
        - meta
        - rendered
      - name: q
        in: query
        description: Optional filter expression as per [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering).
        required: false
        type: string
      - name: sort
        in: query
        description: Optional sorting parameter as per [filtering and sorting](/cloud/bitbucket/rest/intro/#sorting-query-results).
        required: false
        type: string
      - name: max_depth
        in: query
        description: If provided, returns the contents of the repository and its subdirectories recursively until the specified max_depth of nested directories. When omitted, this defaults to 1.
        required: false
        type: integer
      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
definitions:
  base_commit:
    allOf:
    - $ref: '#/definitions/object'
    - type: object
      title: Base Commit
      description: The common base type for both repository and snippet commits.
      properties:
        hash:
          type: string
          pattern: '[0-9a-f]{7,}?'
        date:
          type: string
          format: date-time
        author:
          $ref: '#/definitions/author'
        committer:
          $ref: '#/definitions/committer'
        message:
          type: string
        summary:
          type: object
          properties:
            raw:
              type: string
              description: The text as it was typed by a user.
            markup:
              type: string
              description: The type of markup language the raw content is to be interpreted in.
              enum:
              - markdown
              - creole
              - plaintext
            html:
              type: string
              description: The user's content rendered as HTML.
          additionalProperties: false
        parents:
          type: array
          items:
            $ref: '#/definitions/base_commit'
          minItems: 0
      additionalProperties: true
  paginated_treeentries:
    type: object
    title: Paginated Tree Entry
    description: A paginated list of commit_file and/or commit_directory objects.
    properties:
      size:
        type: integer
        description: Total number of objects in the response. This is an optional element that is not provided in all responses, as it can be expensive to compute.
        minimum: 0
      page:
        type: integer
        description: Page number of the current results. This is an optional element that is not provided in all responses.
        minimum: 1
      pagelen:
        type: integer
        description: Current number of objects on the existing page. The default value is 10 with 100 being the maximum allowed value. Individual APIs may enforce different values.
        minimum: 1
      next:
        type: string
        description: Link to the next page if it exists. The last page of a collection does not have this value. Use this link to navigate the result set and refrain from constructing your own URLs.
        format: uri
      previous:
        type: string
        description: Link to previous page if it exists. A collections first page does not have this value. This is an optional element that is not provided in all responses. Some result sets strictly support forward navigation and never provide previous links. Clients must anticipate that backwards navigation is not always available. Use this link to navigate the result set and refrain from constructing your own URLs.
        format: uri
      values:
        type: array
        items:
          $ref: '#/definitions/treeentry'
        minItems: 0
        uniqueItems: true
    additionalProperties: false
  repository:
    allOf:
    - $ref: '#/definitions/object'
    - type: object
      title: Repository
      description: A Bitbucket repository.
      properties:
        links:
          type: object
          properties:
            self:
              type: object
              title: Link
              description: A link to a resource related to this object.
              properties:
                href:
                  type: string
                  format: uri
                name:
                  type: string
              additionalProperties: false
            html:
              type: object
              title: Link
              description: A link to a resource related to this object.
              properties:
                href:
        

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