The Official Dropbox API V2 SDK for Javascript
970
stars
481
commits
JavaScript
primary language
Sep 10, 2026
updated
The official Dropbox API v2 SDK for JavaScript.
The SDK supports Node.js 22 and newer, modern web browsers, and Web Workers.
Continuous integration currently tests Node.js 22 and 24, and Node.js uses its
built-in fetch implementation. Browser and Worker environments must provide
Promise, fetch, and TextEncoder; PKCE authentication also requires the Web
Crypto API. Add polyfills when targeting older environments that do not provide
the required APIs.
Create an app in the Developer Console, then install the SDK from npm. Published npm packages already contain CommonJS, ES module, browser, and TypeScript builds; applications do not need to build the SDK from source. Published versions and release history are available on the npm versions page.
npm install dropbox
const { Dropbox } = require('dropbox');
const dbx = new Dropbox({
accessToken: process.env.DROPBOX_ACCESS_TOKEN,
});
dbx.filesListFolder({ path: '' })
.then(({ result }) => console.log(result.entries))
.catch(console.error);
Webpack, Rollup, Vite, and similar tools can use the package's ES module build.
import { Dropbox } from 'dropbox';
const dbx = new Dropbox({ accessToken: 'YOUR_ACCESS_TOKEN' });
The browser bundle exposes the SDK through the global Dropbox object. Pin an
exact SDK version so a future breaking release cannot change your application
unexpectedly.
<script src="https://cdn.jsdelivr.net/npm/dropbox@10.34.0/dist/Dropbox-sdk.min.js"></script>
<script>
const dbx = new Dropbox.Dropbox({ accessToken: 'YOUR_ACCESS_TOKEN' });
</script>
Do not hard-code production access tokens in public source code.
The same browser bundle can be loaded in a Worker:
importScripts('https://cdn.jsdelivr.net/npm/dropbox@10.34.0/dist/Dropbox-sdk.min.js');
const dbx = new Dropbox.Dropbox({ accessToken: 'YOUR_ACCESS_TOKEN' });
Building is required only when developing the SDK itself or running examples directly from this repository.
git clone https://github.com/dropbox/dropbox-sdk-js.git
cd dropbox-sdk-js
npm install
npm run build
Client-side applications cannot keep an app secret confidential. Never embed a Dropbox app secret in browser or Worker code. Use the OAuth authorization-code flow with PKCE and your app key instead. See the browser PKCE example and the Dropbox OAuth guide. PKCE requires a secure context and the Web Crypto API.
Server applications can keep an app secret confidential and may use the regular authorization-code flow.
The complete generated API reference is published on GitHub Pages.
The examples demonstrate common SDK operations. Most are available in both JavaScript and TypeScript, with additional Node.js OAuth examples.
OAuth
Other Examples
For Node.js applications that need resumable local downloads or retrying uploads, the SDK exports file transfer helpers alongside the generated API methods.
const {
Dropbox,
DropboxFileUploader,
bytesUpload,
downloadFile,
fileUpload,
readerUpload,
sizedReaderUpload,
} = require('dropbox');
const dbx = new Dropbox({ accessToken: process.env.DROPBOX_ACCESS_TOKEN });
await downloadFile(dbx, '/large-file.bin', './large-file.bin', {
parallelDownloads: 4,
progress: ({ bytesWritten, totalBytes }) => {
console.log(`${bytesWritten}/${totalBytes}`);
},
});
const uploader = new DropboxFileUploader(dbx, {
progress: ({ bytesCommitted, totalBytes }) => {
console.log(`${bytesCommitted}/${totalBytes}`);
},
});
await uploader.upload(
await fileUpload('./large-file.bin'),
{ path: '/large-file.bin', mode: { '.tag': 'overwrite' } },
);
await uploader.upload(
bytesUpload('hello from the Dropbox SDK\n'),
{ path: '/hello.txt' },
);
Downloads write to localPath + ".part" and rename the file after validating
the final size and Dropbox content_hash metadata when present. Uploads retry
transient failures at the individual session request, reconcile committed
offsets after lost responses, and use upload sessions for every source. Pass
parallelUploads for repeatable byte or file sources, or use readerUpload()
and sizedReaderUpload() for one-shot Node readable streams.
If you find a bug, please see CONTRIBUTING.md for information on how to report it.
If you need help that is not specific to this SDK, please reach out to Dropbox Support.
This SDK is distributed under the MIT license, please see LICENSE for more information.
(top 30 of 46)
JavaScript
98.8%
The Official Dropbox API V2 SDK for Javascript
970
stars
481
commits
JavaScript
primary language
Sep 10, 2026
updated
The official Dropbox API v2 SDK for JavaScript.
The SDK supports Node.js 22 and newer, modern web browsers, and Web Workers.
Continuous integration currently tests Node.js 22 and 24, and Node.js uses its
built-in fetch implementation. Browser and Worker environments must provide
Promise, fetch, and TextEncoder; PKCE authentication also requires the Web
Crypto API. Add polyfills when targeting older environments that do not provide
the required APIs.
Create an app in the Developer Console, then install the SDK from npm. Published npm packages already contain CommonJS, ES module, browser, and TypeScript builds; applications do not need to build the SDK from source. Published versions and release history are available on the npm versions page.
npm install dropbox
const { Dropbox } = require('dropbox');
const dbx = new Dropbox({
accessToken: process.env.DROPBOX_ACCESS_TOKEN,
});
dbx.filesListFolder({ path: '' })
.then(({ result }) => console.log(result.entries))
.catch(console.error);
Webpack, Rollup, Vite, and similar tools can use the package's ES module build.
import { Dropbox } from 'dropbox';
const dbx = new Dropbox({ accessToken: 'YOUR_ACCESS_TOKEN' });
The browser bundle exposes the SDK through the global Dropbox object. Pin an
exact SDK version so a future breaking release cannot change your application
unexpectedly.
<script src="https://cdn.jsdelivr.net/npm/dropbox@10.34.0/dist/Dropbox-sdk.min.js"></script>
<script>
const dbx = new Dropbox.Dropbox({ accessToken: 'YOUR_ACCESS_TOKEN' });
</script>
Do not hard-code production access tokens in public source code.
The same browser bundle can be loaded in a Worker:
importScripts('https://cdn.jsdelivr.net/npm/dropbox@10.34.0/dist/Dropbox-sdk.min.js');
const dbx = new Dropbox.Dropbox({ accessToken: 'YOUR_ACCESS_TOKEN' });
Building is required only when developing the SDK itself or running examples directly from this repository.
git clone https://github.com/dropbox/dropbox-sdk-js.git
cd dropbox-sdk-js
npm install
npm run build
Client-side applications cannot keep an app secret confidential. Never embed a Dropbox app secret in browser or Worker code. Use the OAuth authorization-code flow with PKCE and your app key instead. See the browser PKCE example and the Dropbox OAuth guide. PKCE requires a secure context and the Web Crypto API.
Server applications can keep an app secret confidential and may use the regular authorization-code flow.
The complete generated API reference is published on GitHub Pages.
The examples demonstrate common SDK operations. Most are available in both JavaScript and TypeScript, with additional Node.js OAuth examples.
OAuth
Other Examples
For Node.js applications that need resumable local downloads or retrying uploads, the SDK exports file transfer helpers alongside the generated API methods.
const {
Dropbox,
DropboxFileUploader,
bytesUpload,
downloadFile,
fileUpload,
readerUpload,
sizedReaderUpload,
} = require('dropbox');
const dbx = new Dropbox({ accessToken: process.env.DROPBOX_ACCESS_TOKEN });
await downloadFile(dbx, '/large-file.bin', './large-file.bin', {
parallelDownloads: 4,
progress: ({ bytesWritten, totalBytes }) => {
console.log(`${bytesWritten}/${totalBytes}`);
},
});
const uploader = new DropboxFileUploader(dbx, {
progress: ({ bytesCommitted, totalBytes }) => {
console.log(`${bytesCommitted}/${totalBytes}`);
},
});
await uploader.upload(
await fileUpload('./large-file.bin'),
{ path: '/large-file.bin', mode: { '.tag': 'overwrite' } },
);
await uploader.upload(
bytesUpload('hello from the Dropbox SDK\n'),
{ path: '/hello.txt' },
);
Downloads write to localPath + ".part" and rename the file after validating
the final size and Dropbox content_hash metadata when present. Uploads retry
transient failures at the individual session request, reconcile committed
offsets after lost responses, and use upload sessions for every source. Pass
parallelUploads for repeatable byte or file sources, or use readerUpload()
and sizedReaderUpload() for one-shot Node readable streams.
If you find a bug, please see CONTRIBUTING.md for information on how to report it.
If you need help that is not specific to this SDK, please reach out to Dropbox Support.
This SDK is distributed under the MIT license, please see LICENSE for more information.
(top 30 of 46)
JavaScript
98.8%