You can use the Bitbucket REST API to set the Pipelines build number $BITBUCKET_BUILD_NUMBER to a higher value. You might want to do this if you are moving from another build tool where you already have built versions of your software with a higher build number.
HTTP/1.1 401 Unauthorized – this comes back as an HTTP header if Bitbucket cannot identify your username. Make sure you update the command above to have the correct username in both the URL and --user parameter.
Your credentials lack one or more required privilege scopes – you need to ensure your app password has the permission to edit Pipelines variables.
An invalid field was found in the JSON payload – you need to ensure your JSON payload matches the format above, a single object with a next field with an integer value (type is optional).
The request body contains invalid properties - your build number is lower than existing builds in Pipelines.