POST /repositories/{workspace}/{repo_slug}/forks

Creates a new fork of the specified repository.

Forking a repository

To create a fork, specify the workspace explicitly as part of the request body:

$ curl -X POST -u jdoe https://api.bitbucket.org/2.0/repositories/atlassian/bbql/forks \
  -H 'Content-Type: application/json' -d '{
    "name": "bbql_fork",
    "workspace": {
      "slug": "atlassian"
    }
}'

To fork a repository into the same workspace, also specify a new name.

When you specify a value for name, it will also affect the slug. The slug is reflected in the repository URL of the new fork. It is derived from name by substituting non-ASCII characters, removes whitespace, and changes characters to lower case. For example, My repo would turn into my_repo.

You need contributor access to create new forks within a workspace.

Change the properties of a new fork

By default the fork inherits most of its properties from the parent. However, since the optional POST body document follows the normal repository JSON schema and you can override the new fork's properties.

Properties that can be overridden include:

Properties that cannot be modified include:

Servers

Path parameters

Name Type Required Description
repo_slug String Yes

This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: {repository UUID}.

workspace String Yes

This can either be the workspace ID (slug) or the workspace UUID surrounded by curly-braces, for example: {workspace UUID}.

Request headers

Name Type Required Description
Content-Type String Yes The media type of the request body.

Default value: "application/json"

Request body fields

Name Type Required Description
size Integer No
description String No
uuid String No

The repository's immutable id. This can be used as a substitute for the slug segment in URLs. Doing this guarantees your URLs will survive renaming of the repository by its owner, or even transfer of the repository to a different user.

has_issues Boolean No

The issue tracker for this repository is enabled. Issue Tracker features are not supported for repositories in workspaces administered through admin.atlassian.com.

created_on String No
fork_policy String No

Controls the rules for forking this repository.

  • allow_forks: unrestricted forking
  • no_public_forks: restrict forking to private forks (forks cannot be made public later)
  • no_forks: deny all forking

Possible values:

  • "no_public_forks"
  • "no_forks"
  • "allow_forks"
has_wiki Boolean No

The wiki for this repository is enabled. Wiki features are not supported for repositories in workspaces administered through admin.atlassian.com.

links Object No
links.html Object No

A link to a resource related to this object.

links.html.href String No
links.html.name String No
links.watchers Object No

A link to a resource related to this object.

links.watchers.href String No
links.watchers.name String No
links.self Object No

A link to a resource related to this object.

links.self.href String No
links.self.name String No
links.commits Object No

A link to a resource related to this object.

links.commits.href String No
links.commits.name String No
links.forks Object No

A link to a resource related to this object.

links.forks.href String No
links.forks.name String No
links.clone[] Array No
links.clone[].href String No
links.clone[].name String No
links.hooks Object No

A link to a resource related to this object.

links.hooks.href String No
links.hooks.name String No
links.pullrequests Object No

A link to a resource related to this object.

links.pullrequests.href String No
links.pullrequests.name String No
links.avatar Object No

A link to a resource related to this object.

links.avatar.href String No
links.avatar.name String No
links.downloads Object No

A link to a resource related to this object.

links.downloads.href String No
links.downloads.name String No
is_private Boolean No
scm String No

Possible values:

  • "git"
name String No
full_name String No

The concatenation of the repository owner's username and the slugified name, e.g. "evzijst/interruptingcow". This is the same string used in Bitbucket URLs.

type String Yes
updated_on String No
language String No

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.