The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

ERROR APPROVE PR FOR API TOKEN PERSONAL

Jesus Alejandro Cardenas Vilca
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 23, 2026

Endpoint: POST /2.0/repositories/{workspace}/{repo}/pullrequests/{id}/approve
Token type: api_token (ATATT)
Scopes configured: write:pullrequest:bitbucket, read:pullrequest:bitbucket
x-accepted-oauth-scopes: pullrequest:write ← formato viejo
x-oauth-scopes: write:pullrequest:bitbucket ← formato nuevo
Result: HTTP 400 Bad Request

The endpoint is not accepting the new API token scope format
even though documentation states write:pullrequest:bitbucket
should allow approving PRs.

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 26, 2026

Hi @Jesus Alejandro Cardenas Vilca 

Without seeing the cURL request, 9/10 times the problem is the way that the authentication is being used.

Full instructions are below - please review these and let me know if you still encounter issues:

To start using API tokens with Bitbucket Cloud - you'll need to create the API token and specify the scope - this is mentioned in our deprecation documentation:

  1. Click the gear cog icon, select Atlassian Account settings > Security tab > Create and manage API Tokens

  2. Click Create API token with scopes and select Bitbucket Cloud

  3. You’ll now need to define the scopes necessary for the API commands you’re intending to execute. A summary of these for common API operations is as follows - you can find more information on scopes in our API scopes documentation:
    Repository Operations

    • GET (Read):

      • Scope: read:repository:bitbucket

      • Allows viewing repository data, including source code and configurations.

    • POST/UPDATE (Write):

      • Scope: write:repository:bitbucket

      • Allows modifying repository data (e.g., updating source, branches, tags, forking).

    • DELETE:

      • Scope: delete:repository:bitbucket

      • Allows deletion of repositories.

    Pull Requests

    • GET (Read):

      • Scope: read:pullrequest:bitbucket

      • Allows viewing pull requests and commenting.

    • POST/UPDATE (Write):

      • Scope: write:pullrequest:bitbucket

      • Allows creating, updating, approving, declining, and merging pull requests.

    Issues

    • GET (Read):

      • Scope: read:issue:bitbucket

      • Allows viewing, listing, searching, and commenting on issues.

    • POST/UPDATE (Write):

      • Scope: write:issue:bitbucket

      • Allows creating, updating, transitioning, and deleting issues.

    Wikis

    • GET/POST/UPDATE/DELETE:

      • Scope: wiki:bitbucket

      • Provides both read and write access to wikis (view, create, edit, push, clone).

    Snippets

    • GET (Read):

      • Scope: read:snippet:bitbucket

    • POST/UPDATE (Write):

      • Scope: write:snippet:bitbucket

    • DELETE:

      • Scope: delete:snippet:bitbucket

    Pipelines

    • GET (Read):

      • Scope: read:pipeline:bitbucket

    • POST/UPDATE (Write):

      • Scope: write:pipeline:bitbucket

  4. Perform the API command by using the API token with either of the sample commands below.

    Example 1: The API token, along with your Atlassian account email, can be sent as login credentials. For example:

    curl --request POST \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repository}/commits' \ --user '{atlassian_account_email}:{api_token}' \ --header 'Accept: application/json'

    Example 2: Alternatively the API token can be sent in a HTTP Authorization header after the Bitbucket email and API token have been base64 encoded. For example:

    my_credentials_after_base64_encoding=`echo -n '{atlassian_account_email}:{api_token}' | base64` curl --request POST \ --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repository}/commits' \ --header "Authorization: Basic $my_credentials_after_base64_encoding" \ --header 'Accept: application/json'

Cheers!

- Ben (Bitbucket Cloud Support)

 

DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events