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

# init

> Initialize the SDK and mount the widget.

```javascript theme={null}
Hacktionbase.init(config)
```

Initializes the SDK, fetches widget configuration from the server, and mounts the chat bubble and iframe on the page.

## Parameters

<ParamField body="config" type="ActiobaseConfig" required>
  Configuration object.

  <Expandable>
    <ParamField body="sdkKey" type="string" required>
      Your SDK key from **Settings → Widget** in the dashboard.
    </ParamField>

    <ParamField body="tenant" type="string" required>
      Your tenant slug (the subdomain used to identify your workspace).
    </ParamField>

    <ParamField body="position" type="string" default="bottom-right">
      Widget position: `'bottom-right'` or `'bottom-left'`.
    </ParamField>

    <ParamField body="offset" type="object" default="{ x: 20, y: 20 }">
      Pixel offset from the corner. `{ x: number, y: number }`.
    </ParamField>

    <ParamField body="hidden" type="boolean" default="false">
      If `true`, the widget bubble is hidden on load. Use `Hacktionbase.show()` to reveal it later.
    </ParamField>

    <ParamField body="environment" type="string" default="prod">
      Environment tag attached to all events: `'prod'` or `'staging'`.
    </ParamField>
  </Expandable>
</ParamField>

## Example

```javascript theme={null}
Hacktionbase.init({
  sdkKey: 'sk_live_abc123',
  tenant: 'acme',
  position: 'bottom-left',
  offset: { x: 16, y: 16 },
  hidden: false
});
```

## Behavior

* Calling `init` twice without calling `destroy()` first logs a warning and does nothing.
* If `sdkKey` or `tenant` is missing, the SDK logs an error and does not mount.
* If the document is still loading, mounting is deferred until `DOMContentLoaded`.

## Pre-queue pattern

You can set configuration on the global `Hacktionbase` object before the script loads. The SDK will auto-initialize when it detects a queued config:

```html theme={null}
<script>
  window.Hacktionbase = {
    sdkKey: 'sk_live_abc123',
    tenant: 'acme'
  };
</script>
<script src="https://s3.eu-west-3.amazonaws.com/hacktionbase.sdk/latest/hacktionbase.js" async></script>
```
