I want to create a PR from curl command by sending a `POST` request to the `https://api.bitbucket.org/2.0/repositories/my-workspace/my-repository/pullrequests` endpoint
https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pullrequests/#api-repositories-workspace-repo-slug-pullrequests-post
My pipeline step where the curl command is executed is:
- step:
name: Create a PR
script:
# Checkout and update the release branch
- git checkout $BITBUCKET_BRANCH
- git pull origin $BITBUCKET_BRANCH
# Create a pull request via Bitbucket's REST API
- >
curl -v -X POST -u "$BITBUCKET_PR_APP_USERNAME:$BITBUCKET_PR_APP_PASSWORD"
--header 'Content-Type: application/json'
--header 'Accept: application/json'
https://api.bitbucket.org/2.0/repositories/energyworx/ewx-intelligence/pullrequests
--data '{
"title": "PR",
"source": {
"branch": {
"name": "'"${BITBUCKET_BRANCH}"'"
}
},
"destination": {
"branch": {
"name": "develop"
}
}
}'
For this, I've created a bitbucket app password giving the following permissions:

And I have as a pipelines repository variables:
`BITBUCKET_PR_APP_USERNAME=create-pr`
`BITBUCKET_PR_APP_PASSWORD=<password-value>`
However I've been seeing when executing the curl command I got 401 error
THis is the verbosity output of the curl command
```
<span>< HTTP/2 401 </span>
<span>< server: envoy</span><span>* Authentication problem. Ignoring this.</span><span>< www-authenticate: Basic realm="<a href="http://bitbucket.org/" rel="noopener noreferrer" target="_blank">Bitbucket.org</a> HTTP"</span><span>< vary: Origin</span><span>< cache-control: max-age=0, no-cache, no-store, must-revalidate</span><span>< content-type: text/plain</span><span>< x-b3-traceid: def6c2c311ea3b29</span><span>< x-usage-output-ops: 0</span><span>< x-used-mesh: None</span><span>< x-dc-location: Micros-3</span><span>< strict-transport-security: max-age=31536000; includeSubDomains; preload</span><span>< date: Wed, 24 May 2023 10:37:47 GMT</span><span>< x-request-id: def6c2c311ea3b29</span><span>< x-usage-user-time: 0.014742</span><span>< x-usage-system-time: 0.000426</span><span>< x-served-by: 872230c0fe40</span><span>< expires: Wed, 24 May 2023 10:37:47 GMT</span><span>< x-xss-protection: 1; mode=block</span><span>< x-envoy-upstream-service-time: 24</span><span>< x-static-version: 9999a04deee1</span><span>< x-content-type-options: nosniff</span><span>< x-render-time: 0.013472795486450195</span><span>< x-trace-id: def6c2c311ea3b29</span><span>< x-usage-input-ops: 0</span><span>< x-frame-options: SAMEORIGIN</span><span>< x-version: 9999a04deee1</span><span>< x-request-count: 2670</span><span>< content-length: 0</span><span>{ [0 bytes data]</span>```<br><br>However when I use an oauth2 consumer with pull request write permissions and I create a token and I use that token as a bearer token in the header authorization to execute the above curl pull request command creation, I can create the PR, and everything goes well.
Why using an app password account with write pull request permissions did not create the PR and the Oauth consumer did it?