Error when creating and then merging a pull request via the rest api

I’m creating a pull request in order to merge a release branch into the main branch. The pull request is created successfully but when I attempt the merge the pull request via the api I get the following error. I can’t find anywhere to set branch level permissions for my oath consumer.

{
  "type": "error",
  "error": {
    "message": "newstatus: Merging a pull request requires write access to the destination branch.",
    "fields": {
      "newstatus": [
        "Merging a pull request requires write access to the destination branch."
      ]
    }
  }
}
1 Like

I don’t know if Bitbucket works seamlessly with oauth consumers. Have you tried using a workspace user and app-password with sufficient scopes?

1 Like

This case is not solved.
Workspace user can merge, but oauth cannot do that, even the access token cannot, too.

1 Like

Ditto to @CTWu 's comment.

This does not work for Access Token based requests, even though workspace users can do this.

This is a hard blocker for automation auto-merging pull requests, unless there’s an aspect of the feature I’m misunderstanding.

Got the solution from Atlassian support.

Be sure the request body includes

{
“type”:“pullrequest”
}

Once I added this property, the merge worked flawlessly.

Hello Falken224…

You can put the complete example, I can’t understand where that type would go. Thank you so much…

anyone able to resolve this issue?