Bitbucket Cloud API gives 500 Internal Server error when trying to update Repository visibility

I am trying to update the Repository visibility via Bitbucket cloud API. But I am getting 500 Internal Server Error from Atlassian.

requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://api.bitbucket.org/2.0/repositories

Attaching the code for reference

workspace_uuid  = '{<redacted>}'
repository_uuid = '{<redacted>}'

data = {'scm': 'git', 'is_private': True}

session = _create_atlassian_jwt_session(new_jwt_token) # internal implementation that works correctly
client = Bitbucket(url='https://api.bitbucket.org/2.0/', session=session)
rsp = client.put(f"/repositories/{workspace_uuid}/{repository_uuid}", data=json.dumps(data))

Insights:

  • Authentication mechanism works well since it is not throwing 403. The _create_atlassian_jwt_session works as expected since we are able to make GET request calls properly
  • The API path is correct since we are not getting 404.

I am pretty sure this is issue with payload format, but I can’t find exact examples of the payload anywhere. I have tried the payload mentioned here Solved: How do I change a project from public to private v... but it still throws 500 error.

Even this documentation has missing working example for Python payload. https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-put

Can someone help with the correct payload format that needs to be sent?
Thanks