# REST API to disable fork

**URL:** <https://community.developer.atlassian.com/t/rest-api-to-disable-fork/46843>\
**Category:** Bitbucket Cloud\
**Tags:** rest-api\
**Created:** [April 6, 2021, 7:47am UTC](https://community.developer.atlassian.com/t/rest-api-to-disable-fork/46843 "2021-04-06T07:47:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![KotaSreenivasaShrava](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@KotaSreenivasaShrava](https://community.developer.atlassian.com/u/KotaSreenivasaShrava)\
**Post date:** [April 6, 2021, 7:47am UTC](https://community.developer.atlassian.com/t/rest-api-to-disable-fork/46843/1 "2021-04-06T07:47:48Z")

</div>

Greetings

Is there any REST API call to disable the fork for a repository in Bitbucket cloud ?

Thanks !

---

<div class="post-metadata">

**Author:** ![ibuchanan](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/ibuchanan/32/35815_2.png) [@ibuchanan](https://community.developer.atlassian.com/u/ibuchanan)\
**Post date:** [April 6, 2021, 12:49pm UTC](https://community.developer.atlassian.com/t/rest-api-to-disable-fork/46843/2 "2021-04-06T12:49:16Z")

</div>

Welcome to the Atlassian developer community, @KotaSreenivasaShrava.

Yes, you can disable fork on a repository using [`PUT /2.0/repositories/{workspace}/{repo_slug}`](https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D#put). You will need to send an attribute for `fork_policy` like:

```json
{
  fork_policy: no_forks
}

```

The options come from the following enumeration:

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

---

<div class="post-metadata">

**Author:** ![KotaSreenivasaShrava](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@KotaSreenivasaShrava](https://community.developer.atlassian.com/u/KotaSreenivasaShrava)\
**Post date:** [April 7, 2021, 8:26am UTC](https://community.developer.atlassian.com/t/rest-api-to-disable-fork/46843/3 "2021-04-07T08:26:04Z")

</div>

Hi - Thanks for quick reply. I am executing this and its not working. Am I doing anything wrong?

curl --request PUT --user username:apppassword [https://api.bitbucket.org/2.0/repositories/workspacename/sample](https://api.bitbucket.org/2.0/repositories/workspacename/sample) --data ‘{fork\_policy: no\_forks}’

---

<div class="post-metadata">

**Author:** ![ibuchanan](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/ibuchanan/32/35815_2.png) [@ibuchanan](https://community.developer.atlassian.com/u/ibuchanan)\
**Post date:** [April 7, 2021, 11:11am UTC](https://community.developer.atlassian.com/t/rest-api-to-disable-fork/46843/4 "2021-04-07T11:11:17Z")

</div>

Could you share the response?

---

<div class="post-metadata">

**Author:** ![KotaSreenivasaShrava](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@KotaSreenivasaShrava](https://community.developer.atlassian.com/u/KotaSreenivasaShrava)\
**Post date:** [April 7, 2021, 11:25am UTC](https://community.developer.atlassian.com/t/rest-api-to-disable-fork/46843/5 "2021-04-07T11:25:41Z")

</div>

There was no response. It exits without any error or success message

---

<div class="post-metadata">

**Author:** ![ibuchanan](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/ibuchanan/32/35815_2.png) [@ibuchanan](https://community.developer.atlassian.com/u/ibuchanan)\
**Post date:** [April 7, 2021, 1:23pm UTC](https://community.developer.atlassian.com/t/rest-api-to-disable-fork/46843/6 "2021-04-07T13:23:09Z")

</div>

I realized the example that I provided you isn’t valid JSON. I’m not sure how I forgot the double quotes:

```json
{
  "fork_policy": "no_forks"
}

```

However, I tried with both double quotes and without and I still get a response from Bitbucket. It sounds like something is blocking your network access to the Bitbucket API.
