> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.dropboxapi.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.dropboxapi.com/_mcp/server.

# JavaScript

#### Overview

## Dropbox for JavaScript

Here's our JavaScript SDK for API v2, which helps you easily integrate Dropbox into your JavaScript app.

### Code

[Dropbox for JavaScript](https://github.com/dropbox/dropbox-sdk-js) - Dropbox JavaScript SDK is open source on GitHub.

#### Install

## Install Dropbox for JavaScript

To get started with Dropbox for JavaScript, we recommend you add the SDK to your project using [npm](https://www.npmjs.com).

### Install the JavaScript SDK

Download and install the SDK.

```bash
npm install --save dropbox
```

Then use with a module bundler

```javascript
require('isomorphic-fetch'); // or another library of choice.
var Dropbox = require('dropbox').Dropbox;
var dbx = new Dropbox({ accessToken: 'YOUR_ACCESS_TOKEN_HERE' });
dbx.filesListFolder({path: ''})
  .then(function(response) {
    console.log(response);
  })
  .catch(function(error) {
    console.log(error);
  });
```

#### Tutorial

## Dropbox for JavaScript tutorial

A good way to start using the JavaScript SDK is to follow this quick tutorial. Just make sure you have the the JavaScript SDK installed first!

### Register a Dropbox API app

To use the Dropbox API, you'll need to register a new app in the [App Console](https://www.dropbox.com/developers/apps). Select Dropbox API app and choose your app's permission. You'll need to use the app key created with this app to access API v2.

### Link an account

In order to make calls to the API, you'll need an instance of the Dropbox object. To instantiate, pass in the access token for the account you want to link. (Tip: You can [generate an access token](https://dropbox.tech/developers/generate-an-access-token-for-your-own-account) for your own account through the [App Console](https://www.dropbox.com/developers/apps)).

```javascript
var dbx = new Dropbox({ accessToken: ACCESS_TOKEN });
```

Test it out to make sure you've linked the right account:

```javascript
dbx.usersGetCurrentAccount()
  .then(function(response) {
    console.log(response);
  })
  .catch(function(error) {
    console.error(error);
  });
```

### Try some API requests

You can use the Dropbox object you instantiated above to make API calls. Try out some of the files requests.

List all of the contents in the user's root directory:

```javascript
dbx.filesListFolder({path: ''})
    .then(function(response) {
      console.log(response.entries);
    })
    .catch(function(error) {
      console.error(error);
    });
```

You can read more in the documentation. Also checkout the [examples](https://github.com/dropbox/dropbox-sdk-js/tree/master/examples) folder on GitHub.

#### Documentation

## Dropbox for JavaScript documentation

Here's the [full documentation](http://dropbox.github.io/dropbox-sdk-js/) for the JavaScript SDK.