> ## Documentation Index
> Fetch the complete documentation index at: https://developers.partoo.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Partoo SDK Reference

## Global `Partoo`

The `Partoo` object is available globally when you include the JS SDK in your page:

```html theme={null}
<script src="https://static.partoo.co/jssdk/partoo.js" type="text/javascript"></script>
```

This object exposes the `Partoo.init()` method to embed and manage Partoo views inside an iframe.

***

## `Partoo.init(divId, options)`

Initializes a Partoo App instance by inserting an iframe into the specified DOM element.

### Parameters

<ParamField path="divId" type="string" required>
  ID of the target `<div>` where the iframe will be rendered.
</ParamField>

<ParamField path="options" type="object">
  Optional configuration object. See [Options](/guides/sdk/references/reference#options) for details.
</ParamField>

### Returns

Returns a `Page` object used to interact with the embedded iframe.

```javascript theme={null}
const partooPage = Partoo.init('your-container-id', options);
```

***

## Page

The `Page` object returned by `Partoo.init()` provides methods for navigation, authentication, event handling, and more.

```javascript theme={null}
const partooPage = Partoo.init('divId');
```

### Methods

#### `setOptions(options)`

Updates the iframe configuration after initialization.

<ParamField path="options" type="object" required>
  Options object to update the view behavior. See [Options](/guides/sdk/references/reference#options).
</ParamField>

***

#### `login(connectionToken)`

Authenticates the user and navigates to the defined `startPage`.

<ParamField path="connectionToken" type="string" required>
  One-time connection token generated from the Partoo API.
</ParamField>

```javascript theme={null}
partooPage.login('your-connection-token');
```

***

#### `navigate(route, seedData, additionalParams)`

Navigates to a specific page in the Partoo App.

<ParamField path="route" type="string" required>
  Target page identifier. See [Supported Pages](/guides/sdk/references/supported-routes).
</ParamField>

<ParamField path="seedData" type="object">
  Deprecated.
</ParamField>

<ParamField path="additionalParams" type="object">
  Page-specific parameters (e.g. `businessId`, `status`, etc.).
</ParamField>

```javascript theme={null}
partooPage.navigate('business', null, { businessId: 'abc123' });
```

***

#### `back()`

Navigates to the previous page in iframe history.

```javascript theme={null}
partooPage.back();
```

***

#### `forward()`

Navigates forward in iframe history (opposite of `back()`).

```javascript theme={null}
partooPage.forward();
```

***

#### `on(eventId, callback)`

Registers a callback function for a specific event triggered in the Partoo App.

<ParamField path="eventId" type="string" required>
  ID of the event. See [Available callback events](/guides/sdk/guides/events-callbacks).
</ParamField>

<ParamField path="callback" type="function" required>
  Function triggered when the event occurs. Receives event-specific `data`.
</ParamField>

```javascript theme={null}
partooPage.on('subscribe', function(data) {
  console.log('Subscription data:', data);
});
```

***

## Options

The `options` parameter is accepted by both `Partoo.init()` and `setOptions()`:

```javascript theme={null}
const options = {
  startPage: 'businesses',
  displayIntercom: false,
  selectedBusinessId: 'abc123',
  // more options...
};

const partooPage = Partoo.init('partoo-container', options);
partooPage.setOptions(options);
```

### Configuration Fields

| Parameter                           | Type      | Default      | Description                                                                            |
| ----------------------------------- | --------- | ------------ | -------------------------------------------------------------------------------------- |
| `startPage`                         | `string`  | `businesses` | Initial route displayed after login                                                    |
| `startPageAnchorParam`              | `string`  | `null`       | Anchor parameter appended to login URL                                                 |
| `displayIntercom`                   | `boolean` | `true`       | Show or hide the Intercom help widget                                                  |
| `displayAddButton`                  | `boolean` | `true`       | Show or hide the add business button on the top banner                                 |
| `displayPresenceManagementDownload` | `boolean` | `true`       | Show or hide the download button on Presence Management view                           |
| `displayBusinessModalFilters`       | `boolean` | `true`       | Show or hide business filters on relevant pages (e.g. Posts, Reviews, Messaging)       |
| `displayVerificationRequiredButton` | `boolean` | `false`      | Display a verification banner in business list and business pages                      |
| `selectedBusinessId`                | `string`  | `null`       | Preselect a business on applicable views (e.g. Review, Messaging). Use `null` to reset |

<Tip>
  Use `setOptions()` if you need to update configuration dynamically after initialization.
</Tip>
