# Parallel Developer Documentation **Legacy – v1.x**

This is documentation for Parallel Developer Documentation **Legacy – v1.x**, which is no longer actively maintained.

For up-to-date documentation, see the **[latest version](https://developer.parallelmarkets.com/docs/javascript/sdk)** (Current – v2.x).

Version: Legacy – v1.x

The Parallel Javascript SDK includes the following functions on the `Parallel` object if you're including our JavaScript directly or via the [NPM Module](https://www.npmjs.com/package/@parallelmarkets/vanilla).

- React Module
- ES Module
- Manual Loading

```js
import { useParallel } from '@parallelmarkets/react'

const ButtonBox = () => {

const { parallel } = useParallel()

// library may still be loading

if (!parallel) return null

// you can now call any of the functions below on the `parallel` variable

return <button onClick={() => parallel.login()}>Custom Parallel Button</button>

}
```

```js
import { loadParallel } from '@parallelmarkets/vanilla'

const parallel = await loadParallel({

client_id: '123',

environment: 'demo',

flow_type: 'overlay',

})

// initiate a flow

parallel.login()
```

```html
<script src="https://app.parallelmarkets.com/sdk/v1/parallel.js"></script>

<script>

Parallel.init({

client_id: '123',

environment: 'demo',

flow_type: 'overlay',

})

// initiate a flow

Parallel.login()

</script>
```

| Function                          | Description |
| ---------------------------------- | ----------- |
| `api(path, callback)`             | Call any of the Parallel APIs, and define callback functions for handling the response. See [this page](https://developer.parallelmarkets.com/docs/1.x/javascript/server-api) for more information on calling Server APIs from JavaScript. |
| `getLoginStatus(callback)`         | Get the login status of a user. It takes a single argument that is a callback function, which will be called once the user's login status can be determined. The callback function will be called with one argument [described here](https://developer.parallelmarkets.com/docs/1.x/javascript/events#event-callback-arguments). |
| `hideButton()`                     | Hide the Parallel Login button that was rendered inside any elements on the page with the class `parallel-login-button`. |
| `init(config)`                     | Initialize the Parallel Javascript SDK. Takes a single argument that is an object containing a `client_id` and any other desired [configuration options](https://developer.parallelmarkets.com/docs/1.x/javascript/configuration). |
| `login(opts)`                      | Initiate a Parallel Markets user login flow explicitly. This is useful if you want to start a flow based on some user action (apart from clicking a Parallel Passport button). Takes a single optional argument that is an object. The following optional keys are supported:  
  - `email`: A user's email, used to pre-fill the signup page form.  
  - `first_name`: A user's first name, used to pre-fill the signup page form.  
  - `last_name`: A user's last name, used to pre-fill the signup page form.  
  - `expected_entity_id`: A connected entity ID that can be used to send a user directly into the desired flow(s) for the User or Business after authenticating, skipping the entity selection step.  
  - `expected_entity_type`: Either `self` or a [`business_type`](https://developer.parallelmarkets.com/docs/1.x/server/data-structures#business-profile). Providing `self` will initiate desired flows for the user as an individual (skipping the option to select a business). A `business_type` can be used to send a user directly to the creation page for a new Business after authenticating, with the `expected_entity_type` pre-filled in the form.  
  - `expected_business_name`: The legal name of a Business. Used with the name of an existing Business to send a user directly into the desired flow(s) for the Business after authentication, skipping the entity selection step. Otherwise, used to send a user directly to the creation page for a new Business, with the `expected_business_name` prefilled in the form.  
  - `handoff_id`: A unique reference to this handoff which can be used in the [Handoff API](https://developer.parallelmarkets.com/docs/1.x/server/handoff-api). Note: only the first 255 characters will be used  
  - `partner_supporting`: If data will be shared with any downstream organizations (e.g. Investment management platforms with many issuers), your client's name can be set here. This will update the messaging on the OAuth consent screen to indicate that the user is sharing data with your organization for the purposes of onboarding with your client. |
| `logout()`                        | End the user's session on your site. Note that this will only invalidate the authentication tokens from the context of your site and will not affect the user's session (if any) on parallelmarkets.com. |
| `showButton()`                    | Show the Parallel Login button inside any elements on the page with the class `parallel-login-button`. |
| `subscribe(event, callback)`      | Subscribe to a range of [events](https://developer.parallelmarkets.com/docs/1.x/javascript/events) by passing a string value which is the name of the event and defining a callback function for when the event fires. The callback will take in a [response object](https://developer.parallelmarkets.com/docs/1.x/javascript/events#event-callback-arguments) containing any relevant status values, errors, authentication responses, etc. |
| `subscribeWithButton(callback, errback)` | Show the Login button if user is not authenticated, and if/when user is authenticated `callback` will be called with [one argument](https://developer.parallelmarkets.com/docs/1.x/javascript/events#event-callback-arguments). On authentication issue or user cancelation, `errback` will be called. |
| `unsubscribe(event, callback)`    | Un-subscribe a callback from any [events](https://developer.parallelmarkets.com/docs/1.x/javascript/events) previously subscribed to using `subscribe()`. |
