# node-bitbucket **Repository Path**: mirrors_atlassian/node-bitbucket ## Basic Information - **Project Name**: node-bitbucket - **Description**: BitBucket API client for Browser and Node.js - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-01-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README [![version:@latest](https://img.shields.io/npm/v/bitbucket.svg?style=for-the-badge)](https://www.npmjs.com/package/bitbucket) [![Documentation](https://img.shields.io/badge/docs-bitbucket.js-blue.svg?style=for-the-badge)](https://bitbucketjs.netlify.com) [![License](https://img.shields.io/github/license/MunifTanjim/node-bitbucket.svg?style=for-the-badge)](https://github.com/MunifTanjim/node-bitbucket/blob/master/LICENSE) # Bitbucket.js Bitbucket API client for Browser and Node.js Bitbucket API docs: [https://api.bitbucket.org](https://api.bitbucket.org) **BITBUCKET CLOUD API CHANGING NOTICE**: [https://developer.atlassian.com/cloud/bitbucket/bitbucket-api-changes-gdpr](https://developer.atlassian.com/cloud/bitbucket/bitbucket-api-changes-gdpr) **BITBUCKET CLOUD API MIGRATION GUIDE**: [https://developer.atlassian.com/cloud/bitbucket/bbc-gdpr-api-migration-guide](https://developer.atlassian.com/cloud/bitbucket/bbc-gdpr-api-migration-guide) ## Installation via **npm**: ```sh $ npm install bitbucket --save ``` via **yarn**: ```sh $ yarn add bitbucket ``` ## Usage ### Browser ```html ``` ### Node ```js const Bitbucket = require('bitbucket') const bitbucket = new Bitbucket() ``` #### Client Options You can set the APIs' `baseUrl` and modify some behaviors (e.g. request timeout etc.) by passing a clientOptions object to the `Bitbucket` constructor. ```js const clientOptions = { baseUrl: 'https://api.bitbucket.org/2.0', headers: {}, options: { timeout: 10 } } const bitbucket = new Bitbucket(clientOptions) ``` This enables you to use `bitbucket` with both Bitbucket Cloud and Bitbucket Server. #### Authentication ```js bitbucket.authenticate({ type: 'basic', username: 'username', password: 'password' }) ``` #### API Methods **async/await** ```js try { let { data, headers } = await bitbucket..({ ...params }) } catch (err) {} ``` **Promise** ```js bitbucket. .({ ...params }) .then(({ data, headers }) => {}) .catch(err => {}) ``` **Callback** ```js bitbucket..({ ...params }, (err, { data, headers }) => {}) ``` Notes: - `` is one of the _Namespace Names_ - `` is one of the _API Names_ #### Namespace Names `addon`, `hook_events`, `webhooks`, `repositories`, `branchrestrictions`, `commits`, `commitstatuses`, `issue_tracker`, `pullrequests`, `downloads`, `source`, `pipelines`, `refs`, `snippets`, `teams`, `projects`, `users`, `search`, `user`, `ssh` #### API Names Check API client docs: [https://bitbucketjs.netlify.com](https://bitbucketjs.netlify.com) ##### Examples ```js bitbucket.repositories .list({ username: 'MunifTanjim' }) .then(({ data, headers }) => console.log(data.values)) .catch(err => console.error(err)) ``` ## Acknowledgement This API client is heavily inspired by the **[`octokit/rest.js`](https://github.com/octokit/rest.js/)** and a lot of ideas are taken from there. So, thanks goes to the maintainer [Gregor Martynus](https://github.com/gr2m) and all the [awesome contributors](https://github.com/octokit/rest.js/graphs/contributors) of `octokit/rest.js`. ## License Licensed under the MIT License. Check the [LICENSE](https://github.com/MunifTanjim/node-bitbucket/blob/master/LICENSE) file for details.