Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Create pull request via API: destination repository cannot be changed?



I'm trying to create a PR via the API, where the source is my own fork, the the destination is the main repository. 

I get this error:

{"type": "error", "error": {"fields": {"destination": ["destination repository cannot be changed"]}, "message": "destination: destination repository cannot be changed"}}

 Here's my command:

curl \    
  -H "Content-Type: application/json" \
  -u username:app_password\ \
  -d '{      
"title": "test",
"description": "testing automated PR",
"source": {
"branch": {
"name": "test"
"repository": {
"full_name": "username/repo-fork"
"destination": {
"branch": {
  "name": "master"
"repository": {
"full_name": "username2/repo"
"reviewers": [ { "username": "user" } ],
"close_source_branch": false

Why does this editor remove all my newline breaks when I paste code from my editor? Anyway... any ideas how do I make a PR from a fork to the main repository?

Thank you! 

1 answer

1 accepted

0 votes
Answer accepted

Hi @joel ,

When you create a PR from a fork to the main repo, this PR is created in the main repo (and the fork is specified in the source).

Therefore, the API URL in the call should be the one of the main repo. I believe the issue with your call is that the URL of the fork is used and then you attempt to change the destination repo in the data.

You can change the URL and omit the "repository" part in the destination, like this:

curl \ 
-H "Content-Type: application/json" \
-u username:app_password\ \
-d '{
"title": "test",
"description": "testing automated PR",
"source": {
"branch": {
"name": "test"
"repository": {
"full_name": "username/repo-fork"
"destination": {
"branch": {
"name": "master"
"reviewers": [ { "username": "user" } ],
"close_source_branch": false

Is this something that works for you?

Kind regards,

Yes it works, thank you!

Like Theodora Boudale likes this

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,706 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you