---
updatedAt: 2025-06-05T20:53:23.000Z
agentTools:
  projectIndex: https://developers.mindmeister.com/llms.txt
---

# JavaScript API

The JavaScript API is built for web apps running in a browser. It allows quick access to MindMeister's Rest API using the [implicit flow](https://developers.mindmeister.com/docs/oauth-2#section-implicit-flow) of the OAuth 2.0 protocol.

**To get started** a client application has to be registered. See [Register your Application](https://developers.mindmeister.com/docs/register-application) for details. Make sure that the URL of your web app is added as a **redirect URI**, otherwise the authorization step will fail.

Next, add the following line to the HTML header of your web app with the client id, that was created in the previous step.

```html api.js
<script src="https://www.mindmeister.com/api/v2/js/api.js?client_id=[Client_ID]"></script>
```

After including the JavaScript source file, you have access to the **global ML object**. It represents the interface to the entire JavaScript API of MindMeister.

## Authorization

Before any API resource can be accessed, the resource owner, so the user has to grant permissions. This is done through *ML.authorize()*. It opens the **OAuth 2.0 consent screen** in a separate window and initiates the [OAuth 2.0 implicit flow](https://developers.mindmeister.com/docs/oauth-2#section-implicit-flow).

After the user granted permissions for the requested scope, the window is closed automatically and the callback onSuccess is called. In case of a failure the callback onError is called.

After authorization an access token is received and stored internally. This is used automatically for any subsequent API call.

```javascript JavaScript example
ML.authorize({
  onSuccess: function() {},
  onError: function() {},
  persist: true,
  scope: 'userinfo.email userinfo.profile mindmeister'
});
```

### Parameters of ML.authorize(...)

<Table align={["left","left"]}>
  <thead>
    <tr>
      <th>
        Parameter
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        onSuccess
      </td>

      <td>
        A method that is called when the authorization is granted.
      </td>
    </tr>

    <tr>
      <td>
        onError
      </td>

      <td>
        A method that is called in case the authorization failed.
      </td>
    </tr>

    <tr>
      <td>
        persist
      </td>

      <td>
        A boolean flag that indicates if the access token will be stored to window\.localStorage. Default is *true*.
      </td>
    </tr>

    <tr>
      <td>
        scope
      </td>

      <td>
        The requested [scopes](https://developers.mindmeister.com/docs/scopes) separated by space, e.g. 'userinfo.email mindmeister'. Default is '*userinfo.email userinfo.profile mindmeister*'.
      </td>
    </tr>
  </tbody>
</Table>

The **authorization status** can be check with *ML.authorized()*. To **deauthorize** the API access for the user, call *ML.deauthorize()*.

```javascript JavaScript example
if (ML.authorized()) {
	ML.deauthorize();
}
```

## API Access

All Rest API endpoints can be accessed through *ML.rest(...)* .

### Parameters of ML.rest(...)

<Table align={["left","left"]}>
  <thead>
    <tr>
      <th>
        Parameter
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        method
      </td>

      <td>
        One of the HTTP methods "GET", "POST", "PUT" or "DELETE".
      </td>
    </tr>

    <tr>
      <td>
        path
      </td>

      <td>
        The path of the API endpoint e.g., "/maps/1".
      </td>
    </tr>

    <tr>
      <td>
        params
      </td>

      <td>
        A params object with params for the specific API endpoint. Default is \{}.
      </td>
    </tr>

    <tr>
      <td>
        onSuccess
      </td>

      <td>
        A success callback method. The API response is provided with the first parameter.
      </td>
    </tr>

    <tr>
      <td>
        onError
      </td>

      <td>
        An error callback method. The error response is provided with the first parameter.
      </td>
    </tr>
  </tbody>
</Table>

```javascript JavaScript example
var method = 'GET',
    path = '/maps/1',
    params = {},
    onSuccess = function(respObj) {},
    onError = function(respObj) {};

ML.rest(method, path, params, onSuccess, onError);
```

Additional helper methods for API access are:

* ML.get(path, params, onSuccess, onError)

* ML.post(path, params, onSuccess, onError)

* ML.put(path, params, onSuccess, onError)

* ML.delete(path, params, onSuccess, onError)

* ML.users(id, params, onSuccess, onError)

* ML.maps(id, params, onSuccess, onError)

* ML.files(id, params, onSuccess, onError)

> 📘 /users/me
>
> To receive user profile data from the resource owner, use the path '/users/me'. And make sure that the related scopes 'userinfo.email userinfo.profile' are provided during the authorization.