bitbucket (Bitbucket.js) is a comprehensive JavaScript API client for interacting with the Bitbucket Cloud API, designed for both Node.js and browser environments. The current stable version is 2.12.0. This library aims to provide a robust and type-safe interface, shipping with TypeScript definitions, making it well-suited for modern JavaScript and TypeScript projects. It supports various authentication methods, including username/password and token-based authentication, and provides access to numerous Bitbucket API namespaces such as repositories, pull requests, pipelines, and users. The project draws heavy inspiration from `octokit/rest.js`, suggesting a similar, well-structured, and idiomatic approach to API interactions. While no explicit release cadence is stated, it appears to be actively maintained, with regular updates to reflect the latest Bitbucket API changes and bug fixes. Its key differentiators include its dual Node.js/browser support, extensive API coverage, and strong typing, simplifying complex API interactions.
npm install bitbucketVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the Bitbucket client with token authentication and list repositories for the authenticated user ('me'). It includes error handling for common API issues like authentication failures.
Consult the release notes and migration guides (if available) on the package's GitHub repository or documentation site when upgrading to a new major version. Test your application thoroughly after any major version upgrade.
Implement custom retry logic with exponential backoff for `429` status codes. Monitor `Retry-After` headers in API responses if provided. Design your application to minimize unnecessary API calls.
Verify that your `username`/`password` or `token` is correct and current. Ensure the Bitbucket user or app associated with the token has the necessary scopes/permissions for the API operations being attempted.
Proxy Bitbucket API requests through your backend server to avoid CORS issues, or ensure your Bitbucket App/configuration is set up to allow CORS from your specific frontend origin if applicable.
For Node.js ESM projects, use `import { Bitbucket } from 'bitbucket'`. For CommonJS Node.js, use `const { Bitbucket } = require('bitbucket')`. In a browser with the UMD build, ensure the `Bitbucket` global is available after script loading.Verify the method name and namespace against the official documentation (e.g., `bitbucketjs.netlify.app`). Ensure all required parameters are passed as an object to the API method.
Review the `err.error` object in the catch block for specific details from the Bitbucket API about what caused the bad request. Ensure all required parameters for the specific API method are correctly formatted and provided.
No dependency data recorded yet.