# Bitbucket API tokens and the username that causes a 401

DevFeed: [Bitbucket API tokens and the username that causes a 401](<https://devfeed.tech/articles/bitbucket-api-tokens-and-the-username-that-causes-a-401-109704.md>)

Original publisher: [Read original article](<https://www.swytchcode.com/content/bitbucket-api-code-agents>)

Author: Swytchcode Team

Published: 2026-10-30T19:04:52Z

Content type: tutorial

Language: en

Sources: [Swytchcode](<https://devfeed.tech/sources/swytchcode.md>)

Topics: [bitbucket](<https://devfeed.tech/topics/bitbucket.md>), [Secrets Management](<https://devfeed.tech/topics/secrets-management.md>), [personal access token](<https://devfeed.tech/topics/personal-access-token.md>), [Secure token management](<https://devfeed.tech/topics/secure-token-management.md>), [REST API](<https://devfeed.tech/topics/rest-api.md>), [API Governance](<https://devfeed.tech/topics/api-governance.md>)

Tags: [2026](<https://devfeed.tech/tags/2026.md>), [agent](<https://devfeed.tech/tags/agent.md>), [api](<https://devfeed.tech/tags/api.md>), [app](<https://devfeed.tech/tags/app.md>), [atlassian](<https://devfeed.tech/tags/atlassian.md>), [bitbucket](<https://devfeed.tech/tags/bitbucket.md>), [email](<https://devfeed.tech/tags/email.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [scopes](<https://devfeed.tech/tags/scopes.md>), [tokens](<https://devfeed.tech/tags/tokens.md>)

## AI overview

For Bitbucket Cloud REST Basic auth, use the Atlassian account email as the username and the API token as the password; an API token paired with the old Bitbucket username can cause a 401. Tokens need endpoint-appropriate scopes, are set at creation and cannot be edited later, and can be limited to one workspace. Match that workspace to the API URL and grant write scope only when the agent must push. The text says app-password creation stopped on September 9, 2025, and existing passwords were disabled June 9, 2026; API tokens are the documented Basic-auth path from that date. Git over HTTPS has separate username examples, including `x-bitbucket-api-token-auth`, and requires repository read or write scopes as appropriate.

## Source excerpt

Bitbucket app passwords stopped being the supported path in 2026. API tokens use your Atlassian email, need scopes, and can be limited to one workspace.