Atlassian Source - Repositories API

The Source - Repositories API from Atlassian — 3 operation(s) for source - repositories.

Operations 4

GET /repositories/{workspace}/{repo_slug}/filehistory/{commit}/{path} Atlassian List Commits That Modified A File #
GET /repositories/{workspace}/{repo_slug}/src Atlassian Get The Root Directory Of The Main Branch #
POST /repositories/{workspace}/{repo_slug}/src Atlassian Create A Commit By Uploading A File #
GET /repositories/{workspace}/{repo_slug}/src/{commit}/{path} Atlassian Get File Or Directory Contents #

Documentation

📖
Documentation
https://developer.atlassian.com/cloud/bitbucket/rest/api-group-addon/
📖
Documentation
https://developer.atlassian.com/cloud/bitbucket/rest/api-group-webhooks/
📖
Documentation
https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pullrequests/
📖
Documentation
https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/
📖
Documentation
https://developer.atlassian.com/cloud/bitbucket/rest/api-group-snippets/
📖
Documentation
https://developer.atlassian.com/cloud/bitbucket/rest/api-group-workspaces/
📖
Documentation
https://developer.atlassian.com/cloud/bitbucket/rest/api-group-users/
📖
Documentation
https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-analytics/
📖
Documentation
https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-audit/
📖
Documentation
https://developer.atlassian.com/cloud/confluence/connect-modules/
📖
Documentation
https://developer.atlassian.com/cloud/confluence/rest/v2/intro/
📖
Documentation
https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-content-body/
📖
Documentation
https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-content-states/
📖
Documentation
https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-group/
📖
Documentation
https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-inline-tasks
📖
Documentation
https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-content-labels/
📖
Documentation
https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-long-running-task/
📖
Documentation
https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-relation/
📖
Documentation
https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-search/
📖
Documentation
https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-settings/
📖
Documentation
https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-space/
📖
Documentation
https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-template/
📖
Documentation
https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-user/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-announcement-banner/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-custom-field-values--apps-/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-app-openapi
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-application-roles/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/
📖
Documentation
https://developer.atlassian.com/server/framework/atlassian-sdk/audit/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-avatars/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-classification-levels/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-components/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-jira-settings/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/getting-started-with-connect/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/connect-api-migration/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-service-registry/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-custom-field-options/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-dashboards/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/data-security-policy-developer-guide/
📖
Documentation
https://developer.atlassian.com/platform/forge/events-reference/jira/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-jira-expressions/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-fields/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-field-configurations/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-filters/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/forge/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-groups/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-group-and-user-picker/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-groups/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-links/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-security-schemes/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-types/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-type-schemes/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-type-screen-schemes/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-labels/
📖
Documentation
https://developer.atlassian.com/platform/marketplace/license-api-for-cloud-apps/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-license-metrics/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-permissions/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-myself/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-notification-schemes/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-permission-schemes/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-priorities/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-categories/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-key-and-name-validation/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-resolutions/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-project-roles/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-screens/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-screen-schemes/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-security-level/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-server-info/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-workflow-statuses/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-workflow-status-categories/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-tasks/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-ui-modifications--apps-/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-avatars/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-users/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-versions/
📖
Documentation
https://developer.atlassian.com/server/jira/platform/webhooks/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-workflows/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-workflow-schemes/
📖
Documentation
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-worklogs/
📖
Documentation
https://developer.atlassian.com/cloud/admin/organization/rest/
📖
Documentation
https://developer.atlassian.com/cloud/admin/user-management/rest/
📖
Documentation
https://developer.atlassian.com/cloud/admin/user-provisioning/rest/

Specifications

Schemas & Data

📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-schema/atlassian-bitbucket-hook-events-paginated_hook_events-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-schema/atlassian-bitbucket-pull-requests-a_pullrequest_comment_task-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-schema/atlassian-bitbucket-repositories-account-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-schema/atlassian-bitbucket-snippets-account-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-schema/atlassian-bitbucket-teams-account-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-schema/atlassian-bitbucket-user-account-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-schema/atlassian-bitbucket-workspaces-account-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-schema/atlassian-confluence-content-body-async-content-body-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-schema/atlassian-confluence-content-states-async-id-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-schema/atlassian-confluence-group-group-array-with-links-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-schema/atlassian-confluence-inline-tasks-task-page-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-schema/atlassian-confluence-longtask-long-task-status-with-links-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-schema/atlassian-confluence-search-search-page-response-search-result-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-schema/atlassian-confluence-space-content-state-settings-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-schema/atlassian-confluence-template-blueprint-template-array-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-schema/atlassian-confluence-user-account-id-email-record-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-schema/atlassian-admin-domain-page-schema.json

Other Resources

🔗
GraphQL
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/graphql/atlassian-graphql.md
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-bitbucket-hook-events-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-bitbucket-pull-requests-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-bitbucket-repositories-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-bitbucket-snippets-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-bitbucket-teams-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-bitbucket-user-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-bitbucket-workspaces-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-confluence-audit-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-confluence-content-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-confluence-content-body-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-confluence-content-states-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-confluence-group-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-confluence-inline-tasks-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-confluence-longtask-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-confluence-relation-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-confluence-search-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-confluence-settings-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-confluence-space-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-confluence-template-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-confluence-user-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/atlassian/refs/heads/main/json-ld/atlassian-admin-context.jsonld

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/atlassian-source-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

atlassian-source-repositories-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Atlassian Bitbucket Source - 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: Source - Repositories
paths:
  /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:
      - Source - Repositories
      description: Returns a paginated list of commits that modified the specified file.<br><br>Commits are returned in reverse chronological order. This is roughly<br>equivalent to the following commands:<br><br>    $ git log --follow --date-order  <br><br>By default, Bitbucket will follow renames and the path name in the<br>returned entries reflects that. This can be turned off using the<br>`?renames=false` query parameter.<br><br>Results are returned in descending chronological order by default, and<br>like most endpoints you can<br>[filter and sort](/cloud/bitbucket/rest/intro/#filtering) the response to<br>only provide exactly the data you want.<br><br>The example response returns commits made before 2011-05-18 against a file<br>named `README.rst`. The results are filtered to only return the path and<br>date. This request can be made using:<br><br>```<br>$ curl 'https://api.bitbucket.org/2.0/repositories/evzijst/dogslow/filehistory/master/README.rst'\<br>  '?fields=values.next,values.path,values.commit.date&q=commit.date
      summary: Atlassian 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'
              examples:
                response:
                  value:
                    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
      operationId: atlassianListCommitsThatModifiedAFile
  /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
      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:
      - Source - Repositories
      description: This endpoint redirects the client to the directory listing of the<br>root directory on the main branch.<br><br>This is equivalent to directly hitting<br>[/2.0/repositories/{username}/{repo_slug}/src/{commit}/{path}](src/%7Bcommit%7D/%7Bpath%7D)<br>without having to know the name or SHA1 of the repo's main branch.<br><br>To create new commits, [POST to this endpoint](#post)
      summary: Atlassian 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).

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/paginated_treeentries'
        '404':
          description: If the path or commit in the URL does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      parameters:
      - name: format
        in: query
        description: Instead of returning the file's contents, return the (json) meta data for it.
        required: false
        schema:
          type: string
          enum:
          - meta
      security:
      - oauth2:
        - repository
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - read:repository:bitbucket
      operationId: atlassianGetTheRootDirectoryOfTheMainBranch
    post:
      tags:
      - Source - Repositories
      description: 'This endpoint is used to create new commits in the repository by<br>uploading files.<br><br>To add a new file to a repository:<br><br>```<br>$ curl https://api.bitbucket.org/2.0/repositories/username/slug/src \<br>  -F /repo/path/to/image.png=@image.png<br>```<br><br>This will create a new commit on top of the main branch, inheriting the<br>contents of the main branch, but adding (or overwriting) the<br>`image.png` file to the repository in the `/repo/path/to` directory.<br><br>To create a commit that deletes files, use the `files` parameter:<br><br>```<br>$ curl https://api.bitbucket.org/2.0/repositories/username/slug/src \<br>  -F files=/file/to/delete/1.txt \<br>  -F files=/file/to/delete/2.txt<br>```<br><br>You can add/modify/delete multiple files in a request. Rename/move a<br>file by deleting the old path and adding the content at the new path.<br><br>This endpoint accepts `multipart/form-data` (as in the examples above),<br>as well as `application/x-www-form-urlencoded`.<br><br>Note: `multipart/form-data` is currently not supported by Forge apps<br>for this API.<br><br>#### multipart/form-data<br><br>A `multipart/form-data` post contains a series of "form fields" that<br>identify both the individual files that are being uploaded, as well as<br>additional, optional meta data.<br><br>Files are uploaded in file form fields (those that have a<br>`Content-Disposition` parameter) whose field names point to the remote<br>path in the repository where the file should be stored. Path field<br>names are always interpreted to be absolute from the root of the<br>repository, regardless whether the client uses a leading slash (as the<br>above `curl` example did).<br><br>File contents are treated as bytes and are not decoded as text.<br><br>The commit message, as well as other non-file meta data for the<br>request, is sent along as normal form field elements. Meta data fields<br>share the same namespace as the file objects. For `multipart/form-data`<br>bodies that should not lead to any ambiguity, as the<br>`Content-Disposition` header will contain the `filename` parameter to<br>distinguish between a file named "message" and the commit message field.<br><br>#### application/x-www-form-urlencoded<br><br>It is also possible to upload new files using a simple<br>`application/x-www-form-urlencoded` POST. This can be convenient when<br>uploading pure text files:<br><br>```<br>$ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src \<br>  --data-urlencode "/path/to/me.txt=Lorem ipsum." \<br>  --data-urlencode "message=Initial commit" \<br>  --data-urlencode "author=Erik van Zijst "<br>```<br><br>There could be a field name clash if a client were to upload a file<br>named "message", as this filename clashes with the meta data property<br>for the commit message. To avoid this and to upload files whose names<br>clash with the meta data properties, use a leading slash for the files,<br>e.g. `curl --data-urlencode "/message=file contents"`.<br><br>When an explicit slash is omitted for a file whose path matches that of<br>a meta data parameter, then it is interpreted as meta data, not as a<br>file.<br><br>#### Executables and links<br><br>While this API aims to facilitate the most common use cases, it is<br>possible to perform some more advanced operations like creating a new<br>symlink in the repository, or creating an executable file.<br><br>Files can be supplied with a `x-attributes` value in the<br>`Content-Disposition` header. For example, to upload an executable<br>file, as well as create a symlink from `README.txt` to `README`:<br><br>```<br>--===============1438169132528273974==<br>Content-Type: text/plain; charset="us-ascii"<br>MIME-Version: 1.0<br>Content-Transfer-Encoding: 7bit<br>Content-ID: "bin/shutdown.sh"<br>Content-Disposition: attachment; filename="shutdown.sh"; x-attributes:"executable"<br><br>#!/bin/sh<br>halt<br><br>--===============1438169132528273974==<br>Content-Type: text/plain; charset="us-ascii"<br>MIME-Version: 1.0<br>Content-Transfer-Encoding: 7bit<br>Content-ID: "/README.txt"<br>Content-Disposition: attachment; filename="README.txt"; x-attributes:"link"<br><br>README<br>--===============1438169132528273974==--<br>```<br><br>Links are files that contain the target path and have<br>`x-attributes:"link"` set.<br><br>When overwriting links with files, or vice versa, the newly uploaded<br>file determines both the new contents, as well as the attributes. That<br>means uploading a file without specifying `x-attributes="link"` will<br>create a regular file, even if the parent commit hosted a symlink at<br>the same path.<br><br>The same applies to executables. When modifying an existing executable<br>file, the form-data file element must include<br>`x-attributes="executable"` in order to preserve the executable status<br>of the file.<br><br>Note that this API does not support the creation or manipulation of<br>subrepos / submodules.'
      summary: Atlassian Create A Commit By Uploading A File
      responses:
        '201':
          description: '

            '
        '403':
          description: If the authenticated user does not have write or admin access
          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: message
        in: query
        description: The commit message. When omitted, Bitbucket uses a canned string.
        required: false
        schema:
          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
        schema:
          type: string
      - name: parents
        in: query
        description: '

          A comma-separated list of SHA1s of the commits that should

          be the parents 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.


          When more than one SHA1 is provided, the first SHA1

          identifies the commit from which the content will be

          inherited.".'
        required: false
        schema:
          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
        schema:
          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
        schema:
          type: string
      security:
      - oauth2:
        - repository:write
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - write:repository:bitbucket
      operationId: atlassianCreateACommitByUploadingAFile
  /repositories/{workspace}/{repo_slug}/src/{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:
      - Source - Repositories
      description: 'This endpoints is used to retrieve the contents of a single file,<br>or the contents of a directory at a specified revision.<br><br>#### Raw file contents<br><br>When `path` points to a file, this endpoint returns the raw contents.<br>The response''s Content-Type is derived from the filename<br>extension (not from the contents). The file contents are not processed<br>and no character encoding/recoding is performed and as a result no<br>character encoding is included as part of the Content-Type.<br><br>The `Content-Disposition` header will be "attachment" to prevent<br>browsers from running executable files.<br><br>If the file is managed by LFS, then a 301 redirect pointing to<br>Atlassian''s media services platform is returned.<br><br>The response includes an ETag that is based on the contents of the file<br>and its attributes. This means that an empty `__init__.py` always<br>returns the same ETag, regardless on the directory it lives in, or the<br>commit it is on.<br><br>#### File meta data<br><br>When the request for a file path includes the query parameter<br>`?format=meta`, instead of returning the file''s raw contents, Bitbucket<br>instead returns the JSON object describing the file''s properties:<br><br>```javascript<br>$ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef/tests/__init__.py?format=meta<br>{<br>  "links": {<br>    "self": {<br>      "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py"<br>    },<br>    "meta": {<br>      "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py?format=meta"<br>    }<br>  },<br>  "path": "tests/__init__.py",<br>  "commit": {<br>    "type": "commit",<br>    "hash": "eefd5ef5d3df01aed629f650959d6706d54cd335",<br>    "links": {<br>      "self": {<br>        "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335"<br>      },<br>      "html": {<br>        "href": "https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335"<br>      }<br>    }<br>  },<br>  "attributes": [],<br>  "type": "commit_file",<br>  "size": 0<br>}<br>```<br><br>File objects contain an `attributes` element that contains a list of<br>possible modifiers. Currently defined values are:<br><br>* `link` -- indicates that the entry is a symbolic link. The contents<br>    of the file represent the path the link points to.<br>* `executable` -- indicates that the file has the executable bit set.<br>* `subrepository` -- indicates that the entry points to a submodule or<br>    subrepo. The contents of the file is the SHA1 of the repository<br>    pointed to.<br>* `binary` -- indicates whether Bitbucket thinks the file is binary.<br><br>This endpoint can provide an alternative to how a HEAD request can be<br>used to check for the existence of a file, or a file''s size without<br>incurring the overhead of receiving its full contents.<br><br><br>#### Directory listings<br><br>When `path` points to a directory instead of a file, the response is a<br>paginated list of directory and file objects in the same order as the<br>underlying SCM system would return them.<br><br>For example:<br><br>```javascript<br>$ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef/tests<br>{<br>  "pagelen": 10,<br>  "values": [<br>    {<br>      "path": "tests/test_project",<br>      "type": "commit_directory",<br>      "links": {<br>        "self": {<br>          "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/"<br>        },<br>        "meta": {<br>          "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/?format=meta"<br>        }<br>      },<br>      "commit": {<br>        "type": "commit",<br>        "hash": "eefd5ef5d3df01aed629f650959d6706d54cd335",<br>        "links": {<br>          "self": {<br>            "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335"<br>          },<br>          "html": {<br>            "href": "https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335"<br>          }<br>        }<br>      }<br>    },<br>    {<br>      "links": {<br>        "self": {<br>          "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py"<br>        },<br>        "meta": {<br>          "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/__init__.py?format=meta"<br>        }<br>      },<br>      "path": "tests/__init__.py",<br>      "commit": {<br>        "type": "commit",<br>        "hash": "eefd5ef5d3df01aed629f650959d6706d54cd335",<br>        "links": {<br>          "self": {<br>            "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/commit/eefd5ef5d3df01aed629f650959d6706d54cd335"<br>          },<br>          "html": {<br>            "href": "https://bitbucket.org/atlassian/bbql/commits/eefd5ef5d3df01aed629f650959d6706d54cd335"<br>          }<br>        }<br>      },<br>      "attributes": [],<br>      "type": "commit_file",<br>      "size": 0<br>    }<br>  ],<br>  "page": 1,<br>  "size": 2<br>}<br>```<br><br>When listing the contents of the repo''s root directory, the use of a<br>trailing slash at the end of the URL is required.<br><br>The response by default is not recursive, meaning that only the direct contents of<br>a path are returned. The response does not recurse down into<br>subdirectories. In order to "walk" the entire directory tree, the<br>client can either parse each response and follow the `self` links of each<br>`commit_directory` object, or can specify a `max_depth` to recurse to.<br><br>The max_depth parameter will do a breadth-first search to return the contents of the subdirectories<br>up to the depth specified. Breadth-first search was chosen as it leads to the least amount of<br>file system operations for git. If the `max_depth` parameter is specified to be too<br>large, the call will time out and return a 555.<br><br>Each returned object is either a `commit_file`, or a `commit_directory`,<br>both of which contain a `path` element. This path is the absolute path<br>from the root of the repository. Each object also contains a `commit`<br>object which embeds the commit the file is on. Note that this is merely<br>the commit that was used in the URL. It is *not* the commit that last<br>modified the file.<br><br>Directory objects have 2 representations. Their `self` link returns the<br>paginated contents of the directory. The `meta` link on the other hand<br>returns the actual `directory` object itself, e.g.:<br><br>```javascript<br>{<br>  "path": "tests/test_project",<br>  "type": "commit_directory",<br>  "links": {<br>    "self": {<br>      "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/"<br>    },<br>    "meta": {<br>      "href": "https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src/eefd5ef5d3df01aed629f650959d6706d54cd335/tests/test_project/?format=meta"<br>    }<br>  },<br>  "commit": { ... }<br>}<br>```<br><br>#### Querying, filtering and sorting<br><br>Like most API endpoints, this API supports the Bitbucket<br>querying/filtering syntax and so you could filter a directory listing<br>to only include entries that match certain criteria. For instance, to<br>list all binary files over 1kb use the expression:<br><br>`size > 1024 and attributes = "binary"`<br><br>which after urlencoding yields the query string:<br><br>`?q=size%3E1024+and+attributes%3D%22binary%22`<br><br>To change the ordering of the response, use the `?sort` parameter:<br><br>`.../src/eefd5ef/?sort=-size`<br><br>See [filtering and sorting](/cloud/bitbucket/rest/intro/#filtering) for more<br>details.'
      summary: Atlassian 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.)

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/paginated_treeentries'
        '404':
          description: If the path or commit in the URL does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '555':
          description: If the call times out, possibly because the specified recursion depth is too large.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/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
        schema:
          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
        schema:
          type: string
      - name: sort
        in: query
        description: Optional sorting parameter as per [filtering and sorting](/cloud/bitbucket/rest/intro/#sorting-query-results).
        required: false
        schema:
          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
        schema:
          type: integer
      security:
      - oauth2:
        - repository
      - basic: []
      - api_key: []
      x-atlassian-oauth2-scopes:
      - state: Current
        scheme: oauth2
        scopes:
        - read:repository:bitbucket
      operationId: atlassianGetFileOrDirectoryContents
components:
  schemas:
    commit_file:
      type: object
      title: Commit File
      description: A file object, representing a file at a commit in a repository
      properties:
        type:
          type: string
        path:
          type: string
          description: The path in the repository
        commit:
          $ref: '#/components/schemas/commit'
        attributes:
          type: string
          enum:
          - link
          - executable
          - subrepository
          - binary
          - lfs
        escaped_path:
          type: string
          description: The escaped version of the path as it appears in a diff. If the path does not require escaping this will be the same as path.
      required:
      - type
      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: '#/components/schemas/treeentry'
          minItems: 0
    

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